Existing macro system for doing interrupt system calls?

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
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Existing macro system for doing interrupt system calls?

Post by earlz »

So, I'm developing something not quite an OS, but it resembles it in enough ways to restore my decade old account and ask a question.

Anyway, I have an interrupt system call setup (x86 32bit targeting i686) where all of the arguments etc to the system call is placed on a stack in standard C ABI format. I need a macro or some kind of existing code that allows me to easily implement wrappers around these calls so that user-mode programmers don't need to worry about writing assembly, and so that I don't need a huge amount of assembly for every system call wrapper. I've look at linux/syscalls.h, but it's incredibly difficult to understand and I assume provides a lot more than I need. It would be ideal if there was some way of defining something like:

Code: Select all

__interrupt(0x80) void someCall(int which, uint32_t buffer ...) 


Where the compiler pushes things onto the stack like a normal function, but instead of doing a CALL to some address, it does `int 0x80`

Does something like this exist, and somewhat portable between both GCC and Clang?
Post Reply