Page 1 of 1

what's special about syscall?

Posted: Sun Jul 20, 2008 3:50 pm
by sancho1980
hi
i have a working keyboard and clock handler
i even got multitasking to work, so now i have 2 tasks that are executing alternatively, each displaying some message in a tight loop

now i tried to install a system call handler
i wrote a simple routine that just prints out some message like "hi i'm a system call"
next i hooked this routine with an interrupt task gate, the exact same way as i did for my keyboard and clock handler

then i inserted some int(32) instruction into one of my tasks, but they still execute as before (i was of course expecting the system call message!)

can someone help me? is there something special with the int instruction as opposed to hardware interrupts?

thanks

martin

Re: what's special about syscall?

Posted: Sun Jul 20, 2008 5:51 pm
by Brendan
Hi,
sancho1980 wrote:next i hooked this routine with an interrupt task gate, the exact same way as i did for my keyboard and clock handler
Um, why are you using interrupt task gates (with slow hardware task switches, and a complete lack of re-entrancy) rather than trap gates and/or interrupt gates?
sancho1980 wrote:can someone help me? is there something special with the int instruction as opposed to hardware interrupts?
The only difference between software interrupts and hardware interrupts is that you don't need to send an EOI, and the interrupt flag (CLI/STI) has no effect on software interrupts.


Cheers,

Brendan

Re: what's special about syscall?

Posted: Mon Jul 21, 2008 5:18 am
by sancho1980
Brendan wrote:
The only difference between software interrupts and hardware interrupts is that you don't need to send an EOI, and the interrupt flag (CLI/STI) has no effect on software interrupts.
Then how come it doesn't work? Am I allowed to hook my system call to just about ANY vector number, or are there restrictions?
Which vector number *should* I use?

Thanks

Martin

Re: what's special about syscall?

Posted: Mon Jul 21, 2008 5:37 am
by AJ
Other than reserving Ints 0x00-0x1F for CPU exceptions, you can pretty much do what you like. Many people seem to like mapping the IRQs to ints 0x20-0x2F, but the only restriciton on this is that using the PIC's, IRQ's must be mapped to a base that is divisisble by 8.

One other word of warning. If you are thinking of using int 0x80 (used by Linux), it may be worth making your syscalls equivalent to Linux's to avoid later confusion.

Cheers,
Adam