what's special about syscall?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
sancho1980
Member
Member
Posts: 199
Joined: Fri Jul 13, 2007 6:37 am
Location: Stuttgart/Germany
Contact:

what's special about syscall?

Post 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
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: what's special about syscall?

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
sancho1980
Member
Member
Posts: 199
Joined: Fri Jul 13, 2007 6:37 am
Location: Stuttgart/Germany
Contact:

Re: what's special about syscall?

Post 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
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: what's special about syscall?

Post 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
Post Reply