why ADD triggers a GP exception?
Posted: Fri Jan 06, 2012 12:57 pm
Hi, everyone
I'm writing a toy os and I came across a new exception-related problem. I've constructed a dummy IDT and exception handler. The case is when a instruction "add $4, %esp " is executed, a GP exception is triggered and the dummy exception handler is invoked and the system halts. As you know, the vector is 13.
An interesting thing is before the instruction triggers the exception, it is executed properly once earlier. That is, the second time execution cases exception.
the memory contents of the instruction is like the below
<native_restore_fl + 10>: 0xc304c483 0xdae8c3fa 0xc3ffffff
=>0xc01032dc <native_restore_fl+10>: add $4, %esp
0xc01032df <native_restore_fl+13>: ret
Could anyone give me a hint?
I'm writing a toy os and I came across a new exception-related problem. I've constructed a dummy IDT and exception handler. The case is when a instruction "add $4, %esp " is executed, a GP exception is triggered and the dummy exception handler is invoked and the system halts. As you know, the vector is 13.
An interesting thing is before the instruction triggers the exception, it is executed properly once earlier. That is, the second time execution cases exception.
the memory contents of the instruction is like the below
<native_restore_fl + 10>: 0xc304c483 0xdae8c3fa 0xc3ffffff
=>0xc01032dc <native_restore_fl+10>: add $4, %esp
0xc01032df <native_restore_fl+13>: ret
Could anyone give me a hint?