OSDev.org
https://forum.osdev.org/

Page fault when returning from software interrupt
https://forum.osdev.org/viewtopic.php?f=1&t=11409
Page 1 of 1

Author:  McZ [ Thu Mar 02, 2006 2:29 pm ]
Post subject:  Page fault when returning from software interrupt

I have just tried to make a connection between kernel and my clib using a software interrupt..

well it works so far that I get the interrupt and my service routine catch it and do what it is supposed to do. but then I get a page fault when returning.

Here is my NASM wrapper code
Code:
_isr50:
    cli
    push byte 0
    push byte 50
    jmp isr_common_stub

isr_common_stub:
    pusha
    push ds
    push es
    push fs
    push gs
    mov ax, 0x10
    mov ds, ax
    mov es, ax
    mov fs, ax
    mov gs, ax
    mov eax, esp
    push eax
    mov eax, isr_handler
    call eax
    pop eax
    pop gs
    pop fs
    pop es
    pop ds
    popa
    add esp, 8
    iret


Code:
void isr_handler( struct regs *r )
{
   if( isr_handlers[r->int_no] != NULL )
   {
      /* call ISR for this interrupt */
      isr_handlers[r->int_no]( r );
   }
   else
   {
      /* Print error message and halt */
      ...
   }
}


at the moment my ISR only prints the registers so I can see that it recived what I sent and then returns. and on returning I get a page fault if I halt (while(1)) I don't get any page fault.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/