From: Dave A. <ai...@us...> - 2001-05-20 19:34:12
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax In directory usw-pr-cvs1:/tmp/cvs-serv25739/include/asm-vax Modified Files: unistd.h Log Message: DA: unistd.h updated to actually syscall execve and dup and loads of others.. more like mips one than alpha one now .. fixed up all the syscall macros .. still need to do syscall6 + 7 Index: unistd.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/unistd.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- unistd.h 2001/02/26 02:43:55 1.4 +++ unistd.h 2001/05/20 19:34:09 1.5 @@ -200,17 +200,14 @@ /* user-visible error numbers are in the range -1 - -122: see <asm-i386/errno.h> */ -#if defined(__LIBRARY__) && defined(__GNUC__) -#error These syscall macros are all wrong. Kenn - 2000-10-14 - /* this from alpha port, easier to rework - atp */ #define _syscall_return(type) \ return (_sc_err ? errno = _sc_ret, _sc_ret = -1L : 0), (type) _sc_ret #define _syscall_clobbers \ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \ - "r9", "r10", "r11" \ + "r9", "r10", "r11" #define _syscall0(type, name) \ type name(void) \ @@ -220,10 +217,12 @@ register long _sc_0 __asm__("r0"); \ register long _sc_9 __asm__("r9"); \ \ - _sc_0 = __NR_##name; \ - __asm__("chmk # %0 %1 %2" \ + _sc_0 = __NR_##name; \ + __asm__ __volatile__ ("pushl $0x0\n\t" \ + "movl sp, ap\n\t" \ + "chmk r0 # %0 %1 %2\n\t" \ : "=r"(_sc_0), "=r"(_sc_9) \ - : "0"(_sc_0) \ + : "0"(_sc_0) \ : _syscall_clobbers); \ _sc_ret = _sc_0, _sc_err = _sc_9; \ } \ @@ -236,15 +235,16 @@ long _sc_ret, _sc_err; \ { \ register long _sc_0 __asm__("r0"); \ - register long _sc_6 __asm__("r6"); \ register long _sc_9 __asm__("r9"); \ \ _sc_0 = __NR_##name; \ - _sc_6 = (long) (arg1); \ - __asm__("chmk # %0 %1 %2 %3" \ + __asm__ __volatile__ ("pushl %3\n\t" \ + "pushl $0x1\n\t" \ + "movl sp, ap\n\t" \ + "chmk r0 # %0 %1 %2 %3\n\t" \ : "=r"(_sc_0), "=r"(_sc_9) \ - : "0"(_sc_0), "r"(_sc_6) \ - : _syscall_clobbers); \ + : "0"(_sc_0), "m"((long)arg1) \ + : _syscall_clobbers); \ _sc_ret = _sc_0, _sc_err = _sc_9; \ } \ _syscall_return(type); \ @@ -256,17 +256,17 @@ long _sc_ret, _sc_err; \ { \ register long _sc_0 __asm__("r0"); \ - register long _sc_6 __asm__("r6"); \ - register long _sc_7 __asm__("r7"); \ - register long _sc_9 __asm__("r9"); \ + register long _sc_9 __asm__("r9"); \ \ _sc_0 = __NR_##name; \ - _sc_6 = (long) (arg1); \ - _sc_7 = (long) (arg2); \ - __asm__("chmk # %0 %1 %2 %3 %4" \ + __asm__ __volatile__ ("pushl %4\n\t" \ + "pushl %3\n\t" \ + "pushl $0x2\n\t" \ + "movl sp, ap\n\t" \ + "chmk r0 # %0 %1 %2 %3 %4\n\t" \ : "=r"(_sc_0), "=r"(_sc_9) \ - : "0"(_sc_0), "r"(_sc_6), "r"(_sc_7) \ - : _syscall_clobbers); \ + : "0"(_sc_0), "m"((long)arg1), "m"((long)arg2), \ + : _syscall_clobbers); \ _sc_ret = _sc_0, _sc_err = _sc_9; \ } \ _syscall_return(type); \ @@ -276,21 +276,20 @@ type name(type1 arg1,type2 arg2,type3 arg3) \ { \ long _sc_ret, _sc_err; \ - { \ + { \ register long _sc_0 __asm__("r0"); \ - register long _sc_6 __asm__("r6"); \ - register long _sc_7 __asm__("r7"); \ - register long _sc_8 __asm__("r8"); \ register long _sc_9 __asm__("r9"); \ \ _sc_0 = __NR_##name; \ - _sc_6 = (long) (arg1); \ - _sc_7 = (long) (arg2); \ - _sc_8 = (long) (arg3); \ - __asm__("chmk # %0 %1 %2 %3 %4 %5" \ + __asm__ __volatile__ ("pushl %5\n\t" \ + "pushl %4\n\t" \ + "pushl %3\n\t" \ + "pushl $0x3\n\t" \ + "movl sp, ap\n\t" \ + "chmk r0 # %0 %1 %2 %3 %4 %5\n\t" \ : "=r"(_sc_0), "=r"(_sc_9) \ - : "0"(_sc_0), "r"(_sc_6), "r"(_sc_7), \ - "r"(_sc_8) \ + : "0"(_sc_0), "m"((long)arg1), "m"((long)arg2), \ + "m"((long)arg3) \ : _syscall_clobbers); \ _sc_ret = _sc_0, _sc_err = _sc_9; \ } \ @@ -303,25 +302,24 @@ long _sc_ret, _sc_err; \ { \ register long _sc_0 __asm__("r0"); \ - register long _sc_16 __asm__("r6"); \ - register long _sc_17 __asm__("r7"); \ - register long _sc_18 __asm__("r8"); \ - register long _sc_19 __asm__("r9"); \ + register long _sc_9 __asm__("r9"); \ \ _sc_0 = __NR_##name; \ - _sc_6 = (long) (arg1); \ - _sc_7 = (long) (arg2); \ - _sc_8 = (long) (arg3); \ - _sc_9 = (long) (arg4); \ - __asm__("chmk # %0 %1 %2 %3 %4 %5 %6" \ - : "=r"(_sc_0), "=r"(_sc_9) \ - : "0"(_sc_0), "r"(_sc_6), "r"(_sc_7), \ - "r"(_sc_8), "1"(_sc_9) \ - : _syscall_clobbers); \ + __asm__ __volatile__ ("pushl %6\n\t" \ + "pushl %5\n\t" \ + "pushl %4\n\t" \ + "pushl %3\n\t" \ + "pushl $0x4\n\t" \ + "movl sp, ap\n\t" \ + "chmk r0 # %0 %1 %2 %3 %4 %5 %6\n\t" \ + : "=r"(_sc_0), "=r"(_sc_9) \ + : "0"(_sc_0), "m"((long)arg1), "m"((long)arg2), \ + "m"((long) arg3), "m"((long) arg4) \ + : _syscall_clobbers); \ _sc_ret = _sc_0, _sc_err = _sc_9; \ } \ _syscall_return(type); \ -} +} #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ type5,arg5) \ @@ -330,28 +328,26 @@ long _sc_ret, _sc_err; \ { \ register long _sc_0 __asm__("r0"); \ - register long _sc_6 __asm__("r6"); \ - register long _sc_7 __asm__("r7"); \ - register long _sc_8 __asm__("r8"); \ register long _sc_9 __asm__("r9"); \ - register long _sc_10 __asm__("r10"); \ \ _sc_0 = __NR_##name; \ - _sc_6 = (long) (arg1); \ - _sc_7 = (long) (arg2); \ - _sc_8 = (long) (arg3); \ - _sc_9 = (long) (arg4); \ - _sc_10 = (long) (arg5); \ - __asm__("chmk # %0 %1 %2 %3 %4 %5 %6 %7" \ - : "=r"(_sc_0), "=r"(_sc_9) \ - : "0"(_sc_0), "r"(_sc_6), "r"(_sc_7), \ - "r"(_sc_8), "1"(_sc_9), "r"(_sc_10) \ - : _syscall_clobbers); \ - _sc_ret = _sc_0, _sc_err = _sc_9; \ + __asm__ __volatile__ ("pushl %7\n\t" \ + "pushl %6\n\t" \ + "pushl %5\n\t" \ + "pushl %4\n\t" \ + "pushl %3\n\t" \ + "pushl $0x5\n\t" \ + "movl sp, ap\n\t" \ + "chmk r0 # %0 %1 %2 %3 %4 %5 %6 %7\n\t" \ + : "=r"(_sc_0), "=r"(_sc_9) \ + : "0"(_sc_0), "m"((long)arg1), "m"((long)arg2), \ + "m"((long)arg3), "m"((long)arg4), \ + "m"((long)arg5) \ + : _syscall_clobbers); \ + _sc_ret = _sc_0, _sc_err = _sc_9; \ } \ _syscall_return(type); \ } -#endif /* __LIBRARY__ && __GNUC__ */ #ifdef __KERNEL_SYSCALLS__ @@ -386,88 +382,31 @@ extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); +#define __NR__exit __NR_exit +static inline _syscall0(int,sync) +static inline _syscall0(pid_t,setsid) +static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) +static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) +static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) +static inline _syscall1(int,dup,int,fd) +static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) +static inline _syscall3(int,open,const char *,file,int,flag,int,mode) +static inline _syscall1(int,close,int,fd) +static inline _syscall1(int,_exit,int,exitcode) +static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) +static inline _syscall1(int,delete_module,const char *,name) + extern int sys_idle(void); static inline int idle(void) { return sys_idle(); } -static inline int open(const char * name, int mode, int flags) -{ - return sys_open(name, mode, flags); -} - -extern int sys_dup(int); -static inline int dup(int fd) -{ - return sys_dup(fd); -} - -static inline int close(int fd) -{ - return sys_close(fd); -} - -extern off_t sys_lseek(int, off_t, int); -static inline off_t lseek(int fd, off_t off, int whense) -{ - return sys_lseek(fd, off, whense); -} - -extern int sys_exit(int); -static inline int _exit(int value) -{ - return sys_exit(value); -} - #define exit(x) _exit(x) -extern int sys_write(int, const char *, int); -static inline int write(int fd, const char * buf, int nr) -{ - return sys_write(fd, buf, nr); -} - -extern int sys_read(int, char *, int); -static inline int read(int fd, char * buf, int nr) -{ - return sys_read(fd, buf, nr); -} - -extern int sys_execve(char * file, char ** argvp, char ** envp, struct pt_regs *regs); -static inline int execve(char * file, char ** argvp, char ** envp) -{ - struct pt_regs regs; - memset(®s, 0, sizeof(regs)); - return sys_execve(file, argvp, envp, ®s); -} - -extern int sys_setsid(void); -static inline int setsid(void) -{ - return sys_setsid(); -} - -extern int sys_sync(void); -static inline int sync(void) -{ - return sys_sync(); -} - -static inline pid_t waitpid(int pid, int * wait_stat, int flags) -{ - return sys_wait4(pid, wait_stat, flags, NULL); -} - static inline pid_t wait(int * wait_stat) { return waitpid(-1,wait_stat,0); -} - -extern int sys_delete_module(const char *name); -static inline int delete_module(const char *name) -{ - return sys_delete_module(name); } #endif |