Windows stop UNEXPECTED_KERNEL_MODE_TRAP error

Updated: 06/07/2020 by Computer Hope
Popcorn kernels

The UNEXPECTED_KERNEL_MODE_TRAP or Stop 0x0000007F error message occurs when an Intel CPU (central processing unit) created a trap, and the kernel did not catch the trap. The trap can either be bound, where the kernel is not permitted to catch it, or a double fault, where simultaneous faults result in system failure.

In the Stop code, the first parameter displayed on the blue screen indicates the trap code. The more common trap codes encountered are:

  • 0x00000000 Divide by Zero Error - DIV instruction is executed and divisor is zero; often caused by corrupted system memory, hardware problems or software failures.
  • 0x00000004 Overflow - Processor (CPU) executes a call to an interrupt handler when the OF (overflow flag) is set.
  • 0x00000005 Bounds Check Fault - While executing a BOUND instruction, the processor finds the operand exceeds specified limits.
  • 0x00000006 Invalid Opcode - Processor attempts to execute an invalid instruction; often caused by corrupt instruction pointers (pointing to an invalid location), commonly due to corrupted system memory.
  • 0x00000008 Double Fault - Exception occurs when the handler of a previous exception is called; common causes include a kernel stack overflow or a hardware problem.

Other trap codes include the following:

  • 0x00000001 - A call to the system debugger.
  • 0x00000003 - Debugger breakpoint.
  • 0x00000007 - Hardware coprocessor instruction with no coprocessor present.
  • 0x0000000A - Corrupted task state segment.
  • 0x0000000B - Access to a memory segment that was a segment.
  • 0x0000000C - Access to memory beyond the limits of a stack.
  • 0x0000000D - Exception not covered by some exception; a protection fault that relates to access violations for software applications.

Other trap codes exist and can be viewed by referring to the Intel architecture manual.

Cause of the STOP error

The 0x7F error can be caused by defective or incorrectly matched hardware, especially system memory. Existing hardware that fails can also cause this error to occur.

A double fault error can be caused by a kernel stack overflow, which occurs when multiple drivers are attached to the same stack.

General troubleshooting

Remove any new hardware

Adding new hardware can cause this error to occur if the hardware or driver is defective or the hardware is not compatible with the computer. Make sure this is not the case by turning the computer off, removing the new hardware, and restarting the computer. If no error occurs after doing this, you may need to get a new piece of hardware. You can also try downloading the latest driver software from the manufacturer website and install that driver software instead of the software that came with the hardware. Also, make sure your computer meets the minimum requirements needed to use the new piece of hardware.

Test for defective memory

Check for defective system memory by running a memory diagnostic utility. If the diagnostic reveals a memory chip that is bad, replace the memory chip.

Check for BIOS and driver updates

Check the website of the manufacturer of your computer's motherboard. If they have an updated version of the BIOS (basic input/output system) available, we recommend you download and install it.

We recommend checking for updated drivers for hardware installed in your computer. Using the most updated drivers can prevent this error from occurring.

Fix any overclocked settings

If your computer uses an overclocked processor, access the motherboard's BIOS and set the processor to the default speed setting. Restart to the computer to see if this resolves the error.

Update any old software on new operating system

This error can sometimes occur after upgrading to a newer version of an operating system. You may need to remove all third-party hardware drivers and disable any antivirus or anti-spyware software and then try upgrading to the newer operating system. Also, make sure you install the latest updates or service packs for the operating system.

Check Event Viewer

If you are still encountering this error after trying all of these options, access the Event Viewer and check the System Log to view any error messages. These error messages may help in identifying what's causing the error.

Try last known good configuration

To put the computer back in a usable state, previous to the error occurring, you can reset the computer back to the last good configuration. To do this, when starting your computer, press the F8 key on your keyboard until the Advanced Options menu appears. In the menu, select the last known good configuration option.

Disable memory caching

Finally, if none of the above options help resolve the issue, try disabling "memory caching" in CMOS setup, if available on your computer.

Debugging for developers of drivers

It's best to start by debugging the error first, using the !analyze extension.

If this doesn't work, use the kv (Display Stack Backtrace) debugger command.

  • If the kv command shows a taskGate, use the .tss (Display Task State Segment) command on the part of the taskGate before the colon.
  • If the kv command shows a trap frame, use the .trap (Display Trap Frame) command to format the frame.

In general, use the .trap (Display Trap Frame) command on the appropriate frame, which, on an x86-based platform, is associated with the NT!KiTrap procedure.

Use the kv command again to display the new stack, after you have used one of the above commands to debug the stack.