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?
why ADD triggers a GP exception?
why ADD triggers a GP exception?
I'm writing a toy os and my current goal is to resemble, simplify and understand the linux kernel. In the early stage, it's designed to be a UP/UMA preemptive kernel and will be extended to support SMP/NUMA etc in the future.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: why ADD triggers a GP exception?
It's not the instruction that causes that interrupt. Check your error codes and PIC configuration.
Re: why ADD triggers a GP exception?
you're right. It's none business of interrupts. I feel shame I spent four days solving this stupid problem...Combuster wrote:It's not the instruction that causes that interrupt. Check your error codes and PIC configuration.
I'm writing a toy os and my current goal is to resemble, simplify and understand the linux kernel. In the early stage, it's designed to be a UP/UMA preemptive kernel and will be extended to support SMP/NUMA etc in the future.