

Segment error (privilege, type, limit, read/write rights).
Syncback touch invalid point operation code#
Otherwise (for present segments and already in use), the error code is 0.Ī General Protection Fault may occur for various reasons. The saved instruction pointer points to the instruction which caused the exception, unless the fault occurred because of loading a non-present stack segment during a hardware task switch, in which case it points to the next instruction of the new task.Įrror code: The Stack-Segment Fault sets an error code, which is the stack segment selector index when a non-present segment descriptor was referenced or a limit check failed during a hardware task switch.

The Segment Not Present exception occurs when trying to load a segment or gate which has it's Present-bit set to 0. Otherwise, and this is more common, it points to the first instruction in the new task.Įrror code: The Invalid TSS exception sets an error code, which is a selector index.

When the exception occurred before loading the segment selectors from the TSS, the saved instruction pointer points to the instruction which caused the exception. The saved instruction pointer points to the instruction that caused the exception.Īn Invalid TSS exception occurs when an invalid segment selector is referenced as part of a task which, or as a result of a control transfer through a gate descriptor, which results in an invalid stack-segment reference using an SS selector in the TSS. This feature is useful because the operating system can detect when a user program uses the FPU or XMM registers and then save/restore them appropriately when multitasking. However, there are flags in the CR0 register that disable the FPU/MMX/SSE instructions, causing this exception when they are attempted. This is not likely, as modern processors have built-in FPUs.

The Device Not Available exception occurs when an FPU instruction is attempted but there is no FPU. The saved instruction pointer points to the instruction which caused the exception. The instruction tries to access a non-existent control register (for example, mov cr6, eax).The instruction length exceeds 15 bytes, but this only occurs with redundant prefixes.The Invalid Opcode exception occurs when the processor tries to execute an invalid or undefined opcode, or an instruction with invalid prefixes. The saved instruction pointer points to the BOUND instruction which caused the exception. When the index is out of bounds, the Bound Range Exceeded exception occurs. The BOUND instruction compares an array index with the lower and upper bounds of an array. This exception can occur when the BOUND instruction is executed. The saved instruction pointer points to the DIV or IDIV instruction which caused the exception. Since a faulting DIV or IDIV instruction is very easy to insert anywhere in the code, many OS developers use this exception to test whether their exception handling code works. The Divide-by-zero Error occurs when dividing any number by 0 using the DIV or IDIV instruction, or when the division result is too large to be represented in the destination. This value must be pulled from the stack before returning control back to the currently running program. Some exceptions will push a 32-bit "error code" on to the top of the stack, which provides additional information about the error. Aborts: Some severe unrecoverable error.Traps: Traps are reported immediately after the execution of the trapping instruction.Faults: These can be corrected and the program may continue as if nothing happened.Some exceptions are not really errors in most cases, such as page faults. Exceptions, as described in this article, are a type of interrupt generated by the CPU when an 'error' occurs.
