System call implementation
Posted: Fri Mar 09, 2007 4:32 am
Hello !
I have searched the wiki and the forum for threads on system call implementation, but I did not find what I was looking for.
Context: x86 protected mode + paging, kernel ring 0, user process ring 3, kernel is not mapped in user space (might be a problem in the near future).
Currently the only thing I know how to do (thanks to you ) is using interrupts for system calls.
However I would like to have a clean API. I plan to create a library to encapsulate the system calls and link all user code against this library (currently interruption are hardcoded in user code).
From what I have read there is another method using the "syscall/sysenter/sysexit" (sorry if I mixed up those). But how could I implement it ?
From what I understood, I should make a kernel page that contains those entry points available to other process, and then I could use those entry points instead of interrupts.
But how do I access those entry points ? May I use some library trick to be able to link directly to it ?
I understand very well the interrupt implementation of system call, but I don't see how to do it properly with the syscall instructions.
Do you have any pointer or information about it ?
PS: I had some difficulties to make myself clear in this message, if it is not understandable, I will try to rewrite it properly in a few hours.
I have searched the wiki and the forum for threads on system call implementation, but I did not find what I was looking for.
Context: x86 protected mode + paging, kernel ring 0, user process ring 3, kernel is not mapped in user space (might be a problem in the near future).
Currently the only thing I know how to do (thanks to you ) is using interrupts for system calls.
However I would like to have a clean API. I plan to create a library to encapsulate the system calls and link all user code against this library (currently interruption are hardcoded in user code).
From what I have read there is another method using the "syscall/sysenter/sysexit" (sorry if I mixed up those). But how could I implement it ?
From what I understood, I should make a kernel page that contains those entry points available to other process, and then I could use those entry points instead of interrupts.
But how do I access those entry points ? May I use some library trick to be able to link directly to it ?
I understand very well the interrupt implementation of system call, but I don't see how to do it properly with the syscall instructions.
Do you have any pointer or information about it ?
PS: I had some difficulties to make myself clear in this message, if it is not understandable, I will try to rewrite it properly in a few hours.