It's been rumoured that jschlst said:
>
> Hello. I know that this is a tad off topic but I am hoping someone can
> enlighten me on how to do this. I need to create a system call on a x86
> one call requires 7 args, the other 8, and one 9.
>
> I realize my problem could be avoided by using a data structure but in
> order to be compatible with the API I am implementing it must use the
> exact same number of args.
Why?
excuse me, but any api that takes that many args for s subr call is,
well, um, uh, ok, i'll just out and say it: badly designed.
> I have no problem implementing syscalls w/ Linux, but I have no idea how
> to implment more a syscall with more than 5 args.
>
> For example the 5 arg syscall is like such:
> #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
> type5,arg5) \
> type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
> { \
> long __res; \
> __asm__ volatile ("int $0x80" \
> : "=a" (__res) \
> : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
> "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
> __syscall_return(type,__res); \
> }
>
> How would I do this for 7, 8, and 9 arguments.
I assume that the reason that you asking this is because the Intel
architecture is short on registers? The obvious answer is to pass the
parameters on stack (and use copyin/copyout to validate the address
space).
--linas