Existing macro system for doing interrupt system calls?
Posted: Mon Nov 13, 2017 4:46 pm
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:
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?
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 ...)
Does something like this exist, and somewhat portable between both GCC and Clang?