diff options
author | "Jan-Benedict Glaw" <jbglaw@lug-owl.de> | 2006-01-27 21:20:28 +0000 |
---|---|---|
committer | "Jan-Benedict Glaw" <jbglaw@lug-owl.de> | 2006-01-27 21:20:28 +0000 |
commit | 0934f142036f12292711770d353f1c01ab718db7 (patch) | |
tree | bad0873c1bbd8c81ec70180d6ca4e4006d01fa62 /libc/sysdeps/linux/vax/bits/syscalls.h | |
parent | 9f341620c14e959d333fb26d8ec5e9f9dc5209d6 (diff) |
First round of VAX patches. This isn't complete right now, there are for
sure still bugs (properly hidden, of course), a libm is completely missing
(I've got one that implements some basic stuff, but that's really not
ready for checking in...)
I've also got a list of other things that need touch-ups, but that's mostly
minor stuff that'll be done during the next days.
Diffstat (limited to 'libc/sysdeps/linux/vax/bits/syscalls.h')
-rw-r--r-- | libc/sysdeps/linux/vax/bits/syscalls.h | 264 |
1 files changed, 264 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/vax/bits/syscalls.h b/libc/sysdeps/linux/vax/bits/syscalls.h new file mode 100644 index 000000000..caa62118d --- /dev/null +++ b/libc/sysdeps/linux/vax/bits/syscalls.h @@ -0,0 +1,264 @@ +#ifndef _BITS_SYSCALLS_H +#define _BITS_SYSCALLS_H +#ifndef _SYSCALL_H +# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead." +#endif + +/* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel + * header files. It also defines the traditional `SYS_<name>' macros for older + * programs. */ +#include <bits/sysnum.h> + +#ifndef __set_errno +# define __set_errno(val) (*__errno_location())=(val) +#endif + +#ifndef SYS_ify +# define SYS_ify(syscall_name) (__NR_##syscall_name) +#endif + +#undef _syscall_return +#define _syscall_return(type) \ + do { \ + if ((unsigned long) (_sc_ret) >= (unsigned long) (-125)) { \ + __set_errno(-_sc_ret); \ + _sc_ret = -1; \ + } \ + \ + return (type) (_sc_ret); \ + } while (0) + +#define _syscall_clobbers \ + "r1", "r2", "r3", "r4", \ + "r5", "r6", "r7", "r8", \ + "r9", "r10", "r11" + +#ifdef _syscall0 +# undef _syscall0 +#endif +#define _syscall0(type, name) \ +type name (void) \ +{ \ + register long _sc_0 __asm__("r0") = SYS_ify (name); \ + long _sc_ret; \ + \ + __asm__ __volatile__ ( \ + " pushl %%ap \n" \ + " pushl $0x0 \n" \ + " movl %%sp, %%ap \n" \ + " chmk %%r0 \n" \ + " addl2 $4, %%sp \n" \ + " movl (%%sp)+, %%ap \n" \ + : "=r" (_sc_0) \ + : "0" (_sc_0) \ + : _syscall_clobbers); \ + \ + _sc_ret = _sc_0; \ + _syscall_return (type); \ +} + +#ifdef _syscall1 +# undef _syscall1 +#endif +#define _syscall1(type, name, type1, arg1) \ +type name (type1 arg1) \ +{ \ + register long _sc_0 __asm__("r0") = SYS_ify (name); \ + long _sc_ret; \ + \ + __asm__ __volatile__ ( \ + " pushl %%ap \n" \ + " pushl %2 \n" \ + " pushl $0x1 \n" \ + " movl %%sp, %%ap \n" \ + " chmk %%r0 \n" \ + " addl2 $8, %%sp \n" \ + " movl (%%sp)+, %%ap \n" \ + : "=r" (_sc_0) \ + : "0" (_sc_0), \ + "m" (arg1) \ + : _syscall_clobbers); \ + \ + _sc_ret = _sc_0; \ + _syscall_return (type); \ +} + +#ifdef _syscall2 +# undef _syscall2 +#endif +#define _syscall2(type, name, type1, arg1, type2, arg2) \ +type name (type1 arg1, \ + type2 arg2) \ +{ \ + register long _sc_0 __asm__("r0") = SYS_ify (name); \ + long _sc_ret; \ + \ + __asm__ __volatile__ ( \ + " pushl %%ap \n" \ + " pushl %3 \n" \ + " pushl %2 \n" \ + " pushl $0x2 \n" \ + " movl %%sp, %%ap \n" \ + " chmk %%r0 \n" \ + " addl2 $12, %%sp \n" \ + " movl (%%sp)+, %%ap \n" \ + : "=r" (_sc_0) \ + : "0" (_sc_0), \ + "m" (arg1), \ + "m" (arg2) \ + : _syscall_clobbers); \ + \ + _sc_ret = _sc_0; \ + _syscall_return (type); \ +} + +#ifdef _syscall3 +# undef _syscall3 +#endif +#define _syscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \ +type name (type1 arg1, \ + type2 arg2, \ + type3 arg3) \ +{ \ + register long _sc_0 __asm__("r0") = SYS_ify (name); \ + long _sc_ret; \ + \ + __asm__ __volatile__ ( \ + " pushl %%ap \n" \ + " pushl %4 \n" \ + " pushl %3 \n" \ + " pushl %2 \n" \ + " pushl $0x3 \n" \ + " movl %%sp, %%ap \n" \ + " chmk %%r0 \n" \ + " addl2 $16, %%sp \n" \ + " movl (%%sp)+, %%ap \n" \ + : "=r" (_sc_0) \ + : "0" (_sc_0), \ + "m" (arg1), \ + "m" (arg2), \ + "m" (arg3) \ + : _syscall_clobbers); \ + \ + _sc_ret = _sc_0; \ + _syscall_return (type); \ +} + +#ifdef _syscall4 +# undef _syscall4 +#endif +#define _syscall4(type, name, type1, arg1, type2, arg2, type3, arg3, \ + type4, arg4) \ +type name (type1 arg1, \ + type2 arg2, \ + type3 arg3, \ + type4 arg4) \ +{ \ + register long _sc_0 __asm__("r0") = SYS_ify (name); \ + long _sc_ret; \ + \ + __asm__ __volatile__ ( \ + " pushl %%ap \n" \ + " pushl %5 \n" \ + " pushl %4 \n" \ + " pushl %3 \n" \ + " pushl %2 \n" \ + " pushl $0x4 \n" \ + " movl %%sp, %%ap \n" \ + " chmk %%r0 \n" \ + " addl2 $20, %%sp \n" \ + " movl (%%sp)+, %%ap \n" \ + : "=r" (_sc_0) \ + : "0" (_sc_0), \ + "m" (arg1), \ + "m" (arg2), \ + "m" (arg3), \ + "m" (arg4) \ + : _syscall_clobbers); \ + \ + _sc_ret = _sc_0; \ + _syscall_return (type); \ +} + +#ifdef _syscall5 +# undef _syscall5 +#endif +#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) \ +{ \ + register long _sc_0 __asm__("r0") = SYS_ify (name); \ + long _sc_ret; \ + \ + __asm__ __volatile__ ( \ + " pushl %%ap \n" \ + " pushl %6 \n" \ + " pushl %5 \n" \ + " pushl %4 \n" \ + " pushl %3 \n" \ + " pushl %2 \n" \ + " pushl $0x5 \n" \ + " movl %%sp, %%ap \n" \ + " chmk %%r0 \n" \ + " addl2 $24, %%sp \n" \ + " movl (%%sp)+, %%ap \n" \ + : "=r" (_sc_0) \ + : "0" (_sc_0), \ + "m" (arg1), \ + "m" (arg2), \ + "m" (arg3), \ + "m" (arg4), \ + "m" (arg5) \ + : _syscall_clobbers); \ + \ + _sc_ret = _sc_0; \ + _syscall_return (type); \ +} + +#ifdef _syscall6 +# undef _syscall6 +#endif +#define _syscall6(type, name, type1, arg1, type2, arg2, type3, arg3, \ + type4, arg4, type5, arg5, type6, arg6) \ +type name (type1 arg1, \ + type2 arg2, \ + type3 arg3, \ + type4 arg4, \ + type5 arg5, \ + type6 arg6) \ +{ \ + register long _sc_0 __asm__("r0") = SYS_ify (name); \ + long _sc_ret; \ + \ + __asm__ __volatile__ ( \ + " pushl %%ap \n" \ + " pushl %7 \n" \ + " pushl %6 \n" \ + " pushl %5 \n" \ + " pushl %4 \n" \ + " pushl %3 \n" \ + " pushl %2 \n" \ + " pushl $0x6 \n" \ + " movl %%sp, %%ap \n" \ + " chmk %%r0 \n" \ + " addl2 $28, %%sp \n" \ + " movl (%%sp)+, %%ap \n" \ + : "=r" (_sc_0) \ + : "0" (_sc_0), \ + "m" (arg1), \ + "m" (arg2), \ + "m" (arg3), \ + "m" (arg4), \ + "m" (arg5), \ + "m" (arg6) \ + : _syscall_clobbers); \ + \ + _sc_ret = _sc_0; \ + _syscall_return (type); \ +} + +#endif /* _BITS_SYSCALLS_H */ |