OSDev.org

The Place to Start for Operating System Developers
It is currently Mon Apr 29, 2024 11:20 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Custom syscalls and how to install them.
PostPosted: Sun Feb 03, 2008 7:55 pm 
Offline
Member
Member
User avatar

Joined: Thu Dec 21, 2006 7:42 pm
Posts: 1391
Location: Unknown. Momentum is pretty certain, however.
I am at the point of allowing modules to create their own syscalls.
I have a syscall table (syscalls[MAXSYSCALL]). How would a module add a syscall to it?

I could have a 'total_syscalls' value and the module adds the syscall and then increments that value.

Or, I could have syscalls[WHATEVER_VALUE] call whatever is stored in another array, called custom_syscalls[]. Then you call syscalls[WHATEVER_VALUE] which calls custom_syscalls[registers->ebx] or something.

Thoughts? Other ideas?
-JL

_________________
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 03, 2008 8:24 pm 
Offline
Member
Member
User avatar

Joined: Wed Jan 23, 2008 7:13 pm
Posts: 115
I thought about something like this once. I thought about assigning each call a value and having a pointer to that function entered into a syscall table when the modules are loaded. All that is needed is the documentation for the driver and you can write assembly programs that utilize them. It's of course a bit more complicated than this, and there is the problem of having more than one driver trying to create a syscall with the same index into the table.

you could have something like this in asm.
Code:
mov ax,[index];the index into the table
;load parameters and such here
int 0x80;or whatever value you choose.

_________________
I thought I wasn't thinking, I thought wrong.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 03, 2008 8:31 pm 
Offline
Member
Member
User avatar

Joined: Thu Dec 21, 2006 7:42 pm
Posts: 1391
Location: Unknown. Momentum is pretty certain, however.
Thats what I have working, I just want to figure out how to have modules create custom syscalls.

-JL

_________________
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 03, 2008 8:44 pm 
Offline
Member
Member
User avatar

Joined: Wed Jan 23, 2008 7:13 pm
Posts: 115
Well if you don't have your OS link the modules with the kernel, you could just have all your modules run once in userspace with a main procedure that calls the system call to create a system call for all of the necessary driver functions.

_________________
I thought I wasn't thinking, I thought wrong.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 04, 2008 5:45 pm 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
I'm not sure what sort of driver/server system you are using, but basically store a list of (however big you want) of ints. Each int is the process ID of the server/driver to call when the syscall is fired.

When a syscall is fired, the kernel sends a SYSCALL event to the module (just like the kernel would call READ, WRITE, KILL, etc to the module). Attached to the message would include what syscall was called and the PID of the calling processes. You could possibly point to a struct which includes things like:
- Time of the syscall
- A bool that indicates if to wake the receiving program when the syscall has completed (if a program put itself to sleep after making the syscall (you'lld need sort of atomic syscall-and-sleep operation) for blocking operations). This could also be implemented as a address to a callback function.

_________________
My OS is Perception.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: SemrushBot [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group