I have a very simple code to test if an exception error code is pushed right after 'int 0x08', for example
When I run it, I do NOT get any error code for int 0x8.
Here is the snapshot of the code
Code: Select all
disable_interrupts(); // same as 'cli'
// Initialize 8259 PIC and remapping
outb(0x20, 0x11);
outb(0xA0, 0x11);
outb(0x21, 0x20);
outb(0xA1, 0x28);
outb(0x21, 0x04);
outb(0xA1, 0x02);
outb(0x21, 0x01);
outb(0xA1, 0x01);
outb(0x21, 0x0);
outb(0xA1, 0x0);
// trigger Double Fault
asm ("int $0x08");
>> Right before the execution of 'init 0x08'
| STACK 0x00001b10 [0x000000a1]
| STACK 0x00001b14 [0x00000000]
| STACK 0x00001b18 [0x00000000]
| STACK 0x00001b1c [0x00000000]
| STACK 0x00001b20 [0x000e0000]
| STACK 0x00001b24 [0x0000ffac]
| STACK 0x00001b28 [0x00000000]
| STACK 0x00001b2c [0x00000616]
| STACK 0x00001b30 [0x00000000]
| STACK 0x00001b34 [0x00000000]
| STACK 0x00001b38 [0x00000000]
| STACK 0x00001b3c [0x00000000]
| STACK 0x00001b40 [0x00000000]
| STACK 0x00001b44 [0x00000000]
| STACK 0x00001b48 [0x00000000]
| STACK 0x00001b4c [0x00000000]
>>Right after in 0x08 (first line of the exception hanlder)
| STACK 0x00001b04 [0x000008c8]
| STACK 0x00001b08 [0x00000008]
| STACK 0x00001b0c [0x00000002]
| STACK 0x00001b10 [0x000000a1]
| STACK 0x00001b14 [0x00000000]
| STACK 0x00001b18 [0x00000000]
| STACK 0x00001b1c [0x00000000]
| STACK 0x00001b20 [0x000e0000]
| STACK 0x00001b24 [0x0000ffac]
| STACK 0x00001b28 [0x00000000]
| STACK 0x00001b2c [0x00000616]
| STACK 0x00001b30 [0x00000000]
| STACK 0x00001b34 [0x00000000]
| STACK 0x00001b38 [0x00000000]
| STACK 0x00001b3c [0x00000000]
| STACK 0x00001b40 [0x00000000]
I'm sure that only EFLAGS, CS and EIP are pushed, not ERR CODE for the exception
| STACK 0x00001b04 [0x000008c8] ==> EIP
| STACK 0x00001b08 [0x00000008] ==> CS
| STACK 0x00001b0c [0x00000002] ==> EFLAGS
I think there are two possible problems
1. There is not 8259PIC in my Bochs
2. My initialization of 8259PIC is wrong
Can someone kindly explain/advise me to fix the problem.
Appreicated!
Jason