well I store where the stack is in a variable(in memory) and then I call the C interrupt handler then when it returns it puts whats in that stack variable into ESP so that the interrupt handler can change the stack quickly and easily and should be safely
this is my code:
Code: Select all
_irqm_template: ;compiled once but edited and used as a template
push byte 0 ;error code
push byte 0 ;interrupt number
pusha
push ds
push es
push fs
push gs
mov ax, 0x0 ; Load the Kernel Data Segment descriptor! -this is changed at template time
cli
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss,ax
mov eax, esp ; Push us the stack
mov [_int_stack],esp
push eax ;for whatever reason
mov eax, _int_catcher ;this stays constant
call eax ; A special call, preserves the 'eip' register
pop eax
mov esp,[_int_stack] ;if I comment this out theirs no problems
pop gs
pop fs
pop es
pop ds
mov al,0x20 ;for master irq
out 0x20, al
popa
add esp, 8 ; Cleans up the pushed error code and pushed ISR number
iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP!
what could possibly cause the variable toi be changed!
