OK, but I am still generating my General Protection Fault.
Here is my IRQ handler code:
Code: Select all
;-----Assembler doesn't like it when macro args are
; pushed onto stack... So, a PUSHMacro was made-----
macro PUSHM 1
db 6Ah
db %1
;-----Saves all, calls do_IRQ(int, pt_regs*);
; Argument is 1 -----
macro BUILD_IRQ 1
push gs
push fs
push es
push ds
push ss
pusha
mov eax, KERNEL_DS
mov ds,eax
mov es,eax
mov fs,eax
mov gs,eax
sti
mov ebp,esp
push ebp
PUSHM %1 ; push macro
call _do_IRQ
mov esp, ebp
cli
popa
pop ss
pop ds
pop es
pop fs
pop gs
iret
void do_IRQ(int irq, struct pt_regs * regs)
{
/* The sigaction structure from LINUX */
struct sigaction * sa;
sa = irq + irq_sigaction;
sa->sa_handler(regs);
}
void timer(struct pt_regs *regs);
void key(struct pt_regs *regs);
timer increments int timer; if timer = 91(5 seconds), reset it and display "[t]"
key gets input from keyboard. When you press 'r', it will display all the registers in pt_regs. pt_regs contains eax, ebx, ebp, etc... as well as ds-gs.
Whenever regs is accessed inside void key(regs), it generates a GPF...
What am I doing wrong??? I have absolutely no clue what is wrong, yet it generates GPF. When the timer fires then it blows up...