plan9fox/sys/src/9/port/mksystab
cinap_lenrek 6c2e983d32 kernel: apply uintptr for ulong when a pointer is stored
this change is in preparation for amd64. the systab calling
convention was also changed to return uintptr (as segattach
returns a pointer) and the arguments are now passed as
va_list which handles amd64 arguments properly (all arguments
are passed in 64bit quantities on the stack, tho the upper
part will not be initialized when the element is smaller
than 8 bytes).

this is partial. xalloc needs to be converted in the future.
2014-01-20 00:47:55 +01:00

51 lines
787 B
Bash
Executable file

#!/bin/rc
file=/sys/src/libc/9syscall/sys.h
cat <<'!'
#include "/sys/src/libc/9syscall/sys.h"
typedef uintptr Syscall(va_list);
!
sed 's/#define[ ]*([A-Z0-9_][A-Z0-9_]*).*/SYS\1/; s/SYSSYSR1/SYSR1/' $file |
tr A-Z a-z |
sed 's/.*/Syscall &;/'
cat <<'!'
Syscall sysdeath;
Syscall *systab[]={
!
sam -d $file >[2] /dev/null <<'!'
,s/#define.([A-Z0-9_]+).*/ [\1] SYS\1,/g
,x/SYS[A-Z0-9_]+,/ | tr A-Z a-z
,x/syssysr1/c/sysr1
,x/sys_x[0-9]*/c/sysdeath
,x v/\[......+\]/ s/\]/]
,p
!
cat <<'!'
};
char *sysctab[]={
!
sam -d $file >[2] /dev/null <<'!'
,s/#define.([A-Z0-9_]+).*/ [\1] "\1",/g
,x/"[A-Z0-9_]+",/ y/"[A-Z]/ | tr A-Z a-z
,x/_"/c/"
,x/Sysr1/c/Running
,x/Rendezvous/c/Rendez
,x v/\[......+\]/ s/\]/]
,p
!
cat <<'!'
};
int nsyscall = (sizeof systab/sizeof systab[0]);
!