【译】x86程序员手册34-9.7错误代码
9.7 Error Code 错误代码
With exceptions that relate to a specific segment, the processor pushes an error code onto the stack of the exception handler (whether procedure or task). The error code has the format shown in Figure 9-7 . The format of the error code resembles that of a selector; however, instead of an RPL field, the error code contains two one-bit items:
与特定段相关的异常发生时,处理器将错误代码压入到异常处理程序的栈中(程序或任务中的一个)。错误代码的格式见图9-7。错误代码的格式与选择子相似;然而,没有RPL字段,取而代之的是错误代码包含一个两位的项:
- The processor sets the EXT bit if an event external to the program caused the exception.
如果中程序外部引发的异常,处理器设置EXT位。
- The processor sets the I-bit (IDT-bit) if the index portion of the error code refers to a gate descriptor in the IDT.
如果错误代码的索引部分指向一个IDT中的门描述符,处理器设置I位(IDT位)。
If the I-bit is not set, the TI bit indicates whether the error code refers to the GDT (value 0) or to the LDT (value 1). The remaining 14 bits are the upper 14 bits of the segment selector involved. In some cases the error code on the stack is null, i.e., all bits in the low-order word are zero.
如果I位没有设置,TI位表明错误代码引用GDT(值为0)还是LDT(值为1)。剩余的14位是相关段选择子的高14位。在一些情况下,栈上的错误代码是空,也就是说,低位字的所有位都为0。