add _nsec() syscall 53 for binary compatibility with labs distribution

the new syscall is added under the symbol _nsec() for
binary compatibility.

nsec() is still a library function reading /dev/bintime.
This commit is contained in:
cinap_lenrek 2014-05-20 05:06:31 +02:00
parent 7abf926bcf
commit 3207e8b6a4
8 changed files with 31 additions and 177 deletions

View file

@ -130,6 +130,7 @@ syscalls = {
{50, {"pread", "DADZ", code(*syspread:list)}},
{51, {"pwrite", "DTDZ", code(*syspwrite:list)}},
{52, {"tsemacquire", "AD", code(*systsemacquire:list)}},
{53, {"_nsec", "A", code(*sys_nsec:list)}},
};
defn syscall() {

View file

@ -98,6 +98,7 @@ trusscalls = {
"pread",
"pwrite",
"tsemacquire",
"_nsec",
};
trussapecalls = {

View file

@ -297,6 +297,10 @@ syscallfmt(ulong syscallno, uintptr pc, va_list list)
fmtprint(&fmt, " %lld", vl);
}
break;
case _NSEC:
v = va_arg(list, vlong*);
fmtprint(&fmt, "%#p", v);
break;
}
a = fmtstrflush(&fmt);

View file

@ -879,6 +879,7 @@ sysseek(va_list list)
vlong n, *v;
v = va_arg(list, vlong*);
evenaddr((uintptr)v);
validaddr((uintptr)v, sizeof(vlong), 1);
fd = va_arg(list, int);

View file

@ -1182,3 +1182,16 @@ syssemrelease(va_list list)
error(Ebadarg);
return (uintptr)semrelease(s, addr, delta);
}
/* For binary compatibility */
uintptr
sys_nsec(va_list list)
{
vlong *v;
v = va_arg(list, vlong*);
evenaddr((uintptr)v);
validaddr((uintptr)v, sizeof(vlong), 1);
*v = todget(nil);
return 0;
}

View file

@ -1,166 +0,0 @@
#include "/sys/src/libc/9syscall/sys.h"
typedef uintptr Syscall(va_list);
Syscall sysr1;
Syscall sys_errstr;
Syscall sysbind;
Syscall syschdir;
Syscall sysclose;
Syscall sysdup;
Syscall sysalarm;
Syscall sysexec;
Syscall sysexits;
Syscall sys_fsession;
Syscall sysfauth;
Syscall sys_fstat;
Syscall syssegbrk;
Syscall sys_mount;
Syscall sysopen;
Syscall sys_read;
Syscall sysoseek;
Syscall syssleep;
Syscall sys_stat;
Syscall sysrfork;
Syscall sys_write;
Syscall syspipe;
Syscall syscreate;
Syscall sysfd2path;
Syscall sysbrk_;
Syscall sysremove;
Syscall sys_wstat;
Syscall sys_fwstat;
Syscall sysnotify;
Syscall sysnoted;
Syscall syssegattach;
Syscall syssegdetach;
Syscall syssegfree;
Syscall syssegflush;
Syscall sysrendezvous;
Syscall sysunmount;
Syscall sys_wait;
Syscall syssemacquire;
Syscall syssemrelease;
Syscall sysseek;
Syscall sysfversion;
Syscall syserrstr;
Syscall sysstat;
Syscall sysfstat;
Syscall syswstat;
Syscall sysfwstat;
Syscall sysmount;
Syscall sysawait;
Syscall syspread;
Syscall syspwrite;
Syscall systsemacquire;
Syscall sysdeath;
Syscall *systab[]={
[SYSR1] sysr1,
[_ERRSTR] sys_errstr,
[BIND] sysbind,
[CHDIR] syschdir,
[CLOSE] sysclose,
[DUP] sysdup,
[ALARM] sysalarm,
[EXEC] sysexec,
[EXITS] sysexits,
[_FSESSION] sys_fsession,
[FAUTH] sysfauth,
[_FSTAT] sys_fstat,
[SEGBRK] syssegbrk,
[_MOUNT] sys_mount,
[OPEN] sysopen,
[_READ] sys_read,
[OSEEK] sysoseek,
[SLEEP] syssleep,
[_STAT] sys_stat,
[RFORK] sysrfork,
[_WRITE] sys_write,
[PIPE] syspipe,
[CREATE] syscreate,
[FD2PATH] sysfd2path,
[BRK_] sysbrk_,
[REMOVE] sysremove,
[_WSTAT] sys_wstat,
[_FWSTAT] sys_fwstat,
[NOTIFY] sysnotify,
[NOTED] sysnoted,
[SEGATTACH] syssegattach,
[SEGDETACH] syssegdetach,
[SEGFREE] syssegfree,
[SEGFLUSH] syssegflush,
[RENDEZVOUS] sysrendezvous,
[UNMOUNT] sysunmount,
[_WAIT] sys_wait,
[SEMACQUIRE] syssemacquire,
[SEMRELEASE] syssemrelease,
[SEEK] sysseek,
[FVERSION] sysfversion,
[ERRSTR] syserrstr,
[STAT] sysstat,
[FSTAT] sysfstat,
[WSTAT] syswstat,
[FWSTAT] sysfwstat,
[MOUNT] sysmount,
[AWAIT] sysawait,
[PREAD] syspread,
[PWRITE] syspwrite,
[TSEMACQUIRE] systsemacquire,
};
char *sysctab[]={
[SYSR1] "Running",
[_ERRSTR] "_errstr",
[BIND] "Bind",
[CHDIR] "Chdir",
[CLOSE] "Close",
[DUP] "Dup",
[ALARM] "Alarm",
[EXEC] "Exec",
[EXITS] "Exits",
[_FSESSION] "_fsession",
[FAUTH] "Fauth",
[_FSTAT] "_fstat",
[SEGBRK] "Segbrk",
[_MOUNT] "_mount",
[OPEN] "Open",
[_READ] "_read",
[OSEEK] "Oseek",
[SLEEP] "Sleep",
[_STAT] "_stat",
[RFORK] "Rfork",
[_WRITE] "_write",
[PIPE] "Pipe",
[CREATE] "Create",
[FD2PATH] "Fd2path",
[BRK_] "Brk",
[REMOVE] "Remove",
[_WSTAT] "_wstat",
[_FWSTAT] "_fwstat",
[NOTIFY] "Notify",
[NOTED] "Noted",
[SEGATTACH] "Segattach",
[SEGDETACH] "Segdetach",
[SEGFREE] "Segfree",
[SEGFLUSH] "Segflush",
[RENDEZVOUS] "Rendez",
[UNMOUNT] "Unmount",
[_WAIT] "_wait",
[SEMACQUIRE] "Semacquire",
[SEMRELEASE] "Semrelease",
[SEEK] "Seek",
[FVERSION] "Fversion",
[ERRSTR] "Errstr",
[STAT] "Stat",
[FSTAT] "Fstat",
[WSTAT] "Wstat",
[FWSTAT] "Fwstat",
[MOUNT] "Mount",
[AWAIT] "Await",
[PREAD] "Pread",
[PWRITE] "Pwrite",
[TSEMACQUIRE] "Tsemacquire",
};
int nsyscall = (sizeof systab/sizeof systab[0]);

View file

@ -6,7 +6,7 @@ install:V:
for(I in $SYS) {
i=`{echo $I|tr A-Z a-z}
n=`{sed -n '/[ ]'$I'[ ]/s/.* //p' sys.h}
if(~ $i exits) i=_exits
if(~ $i (exits nsec)) i=_$i
{switch($objtype){
case 68000 68020
echo TEXT $i'(SB)', 1, '$0'
@ -18,7 +18,7 @@ install:V:
echo MOVW R1, '0(FP)'
echo MOVW '$'$n, R1
echo SYSCALL
if(~ $i seek) {
if(~ $i (seek _nsec)) {
echo 'MOVW $-1,R5
BNE R1,R5,4(PC)
MOVW a+0(FP),R5
@ -41,7 +41,7 @@ install:V:
echo ADD '$4',R29
echo SYSCALL
echo ADD '$-4',R29
if(~ $i seek) { # untested so far - geoff
if(~ $i (seek _nsec)) { # untested so far - geoff
echo 'MOVW $-1,R5
BNE R1,R5,4(PC)
MOVW a+0(FP),R5
@ -53,7 +53,7 @@ install:V:
echo TEXT $i'(SB)', 1, '$0'
echo MOVL '$'$n, AX
echo INT '$'64
if(~ $i seek) {
if(~ $i (seek _nsec)) {
echo 'CMPL AX,$-1
JNE 4(PC)
MOVL a+0(FP),CX
@ -62,10 +62,9 @@ install:V:
}
echo RET
case amd64
if(~ $i seek)
echo TEXT _seek'(SB)', 1, '$0'
if not
echo TEXT $i'(SB)', 1, '$0'
j=$i
if(~ $i seek) j=_seek
echo TEXT $j'(SB)', 1, '$0'
echo MOVQ RARG, 'a0+0(FP)'
echo MOVQ '$'$n, RARG
echo SYSCALL
@ -75,7 +74,7 @@ install:V:
echo MOVW R7, '0(FP)'
echo MOVW '$'$n, R7
echo TA R0
if(~ $i seek) {
if(~ $i (seek _nsec)) {
echo 'CMP R7,$-1
BNE 4(PC)
MOVW a+0(FP),R8
@ -100,7 +99,7 @@ install:V:
echo MOVW R0, '0(FP)'
echo MOVW '$'$n, R0
echo SWI 0
if(~ $i seek) {
if(~ $i (seek _nsec)) {
echo 'CMP $-1,R0
BNE 4(PC)
MOVW a+0(FP),R1
@ -113,7 +112,7 @@ install:V:
echo MOVW R3, '0(FP)'
echo MOVW '$'$n, R3
echo SYSCALL
if(~ $i seek) {
if(~ $i (seek _nsec)) {
echo 'CMP R3,$-1
BNE 4(PC)
MOVW a+0(FP),R8

View file

@ -49,3 +49,4 @@
#define PREAD 50
#define PWRITE 51
#define TSEMACQUIRE 52
#define _NSEC 53