GPF caused by interrupt handler
Posted: Mon May 14, 2007 8:04 pm
Hey everyone,
I previosuly posted here reguarding color problems and GPF.
The color was easily fixed, the GPF however, is not.
Please note that:
-My code works fine in Bochs emulator
-My code works fine on laptops
The problem is that a GPF happens on PCs, and PCs only.
From both machines, the GPF interrupt gave me the same
EIP, but different error codes:
I have done research on what the problem might be (I have looked at the
Intel docs)
Im kind of stuck n what the problem might be though.
Here is where the GPF is getting triggered:
The pop gs is the failing instruction. I know nothing is wrong
with the above code, and am confused on how a pop instruction
could generate the fault.
I suspect it might be my GDT or IDT. But, Why would it work on laptops
but not PCs...?
I am posting here hoping someone more experienced with OS dev
and GPFs can give me some suggestions.
Thanks!
I previosuly posted here reguarding color problems and GPF.
The color was easily fixed, the GPF however, is not.
Please note that:
-My code works fine in Bochs emulator
-My code works fine on laptops
The problem is that a GPF happens on PCs, and PCs only.
From both machines, the GPF interrupt gave me the same
EIP, but different error codes:
Code: Select all
; pc 1:
eip: 0x265e
eflags: 0x1006
error code: 0x18
; pc 2:
eip: 0x265e
eflags: 0x1006
error code: 0xf000
Intel docs)
Im kind of stuck n what the problem might be though.
Here is where the GPF is getting triggered:
Code: Select all
extern _Sys_IRQ_Handler
IRQ_Stub:
; save state information
pusha
push ds
push es
push fs
push gs
; set stack
mov ax, 010h
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
; save stack address
mov eax, esp
push eax
; execute IRQ handler
mov eax, _Sys_IRQ_Handler
call eax
; restore registers
pop eax
; 0x0008:0265e --------------------------
pop gs ; << for GPFs, EIP points to triggering instruction
pop fs
pop es
pop ds
popa
; IRQs push 2 values on stack, so restore stack
add esp, 8
iret
with the above code, and am confused on how a pop instruction
could generate the fault.
I suspect it might be my GDT or IDT. But, Why would it work on laptops
but not PCs...?
I am posting here hoping someone more experienced with OS dev
and GPFs can give me some suggestions.
Thanks!