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:
parent
7abf926bcf
commit
3207e8b6a4
8 changed files with 31 additions and 177 deletions
|
@ -130,6 +130,7 @@ syscalls = {
|
||||||
{50, {"pread", "DADZ", code(*syspread:list)}},
|
{50, {"pread", "DADZ", code(*syspread:list)}},
|
||||||
{51, {"pwrite", "DTDZ", code(*syspwrite:list)}},
|
{51, {"pwrite", "DTDZ", code(*syspwrite:list)}},
|
||||||
{52, {"tsemacquire", "AD", code(*systsemacquire:list)}},
|
{52, {"tsemacquire", "AD", code(*systsemacquire:list)}},
|
||||||
|
{53, {"_nsec", "A", code(*sys_nsec:list)}},
|
||||||
};
|
};
|
||||||
|
|
||||||
defn syscall() {
|
defn syscall() {
|
||||||
|
|
|
@ -98,6 +98,7 @@ trusscalls = {
|
||||||
"pread",
|
"pread",
|
||||||
"pwrite",
|
"pwrite",
|
||||||
"tsemacquire",
|
"tsemacquire",
|
||||||
|
"_nsec",
|
||||||
};
|
};
|
||||||
|
|
||||||
trussapecalls = {
|
trussapecalls = {
|
||||||
|
|
|
@ -297,6 +297,10 @@ syscallfmt(ulong syscallno, uintptr pc, va_list list)
|
||||||
fmtprint(&fmt, " %lld", vl);
|
fmtprint(&fmt, " %lld", vl);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case _NSEC:
|
||||||
|
v = va_arg(list, vlong*);
|
||||||
|
fmtprint(&fmt, "%#p", v);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
a = fmtstrflush(&fmt);
|
a = fmtstrflush(&fmt);
|
||||||
|
|
|
@ -879,6 +879,7 @@ sysseek(va_list list)
|
||||||
vlong n, *v;
|
vlong n, *v;
|
||||||
|
|
||||||
v = va_arg(list, vlong*);
|
v = va_arg(list, vlong*);
|
||||||
|
evenaddr((uintptr)v);
|
||||||
validaddr((uintptr)v, sizeof(vlong), 1);
|
validaddr((uintptr)v, sizeof(vlong), 1);
|
||||||
|
|
||||||
fd = va_arg(list, int);
|
fd = va_arg(list, int);
|
||||||
|
|
|
@ -1182,3 +1182,16 @@ syssemrelease(va_list list)
|
||||||
error(Ebadarg);
|
error(Ebadarg);
|
||||||
return (uintptr)semrelease(s, addr, delta);
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -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]);
|
|
|
@ -6,7 +6,7 @@ install:V:
|
||||||
for(I in $SYS) {
|
for(I in $SYS) {
|
||||||
i=`{echo $I|tr A-Z a-z}
|
i=`{echo $I|tr A-Z a-z}
|
||||||
n=`{sed -n '/[ ]'$I'[ ]/s/.* //p' sys.h}
|
n=`{sed -n '/[ ]'$I'[ ]/s/.* //p' sys.h}
|
||||||
if(~ $i exits) i=_exits
|
if(~ $i (exits nsec)) i=_$i
|
||||||
{switch($objtype){
|
{switch($objtype){
|
||||||
case 68000 68020
|
case 68000 68020
|
||||||
echo TEXT $i'(SB)', 1, '$0'
|
echo TEXT $i'(SB)', 1, '$0'
|
||||||
|
@ -18,7 +18,7 @@ install:V:
|
||||||
echo MOVW R1, '0(FP)'
|
echo MOVW R1, '0(FP)'
|
||||||
echo MOVW '$'$n, R1
|
echo MOVW '$'$n, R1
|
||||||
echo SYSCALL
|
echo SYSCALL
|
||||||
if(~ $i seek) {
|
if(~ $i (seek _nsec)) {
|
||||||
echo 'MOVW $-1,R5
|
echo 'MOVW $-1,R5
|
||||||
BNE R1,R5,4(PC)
|
BNE R1,R5,4(PC)
|
||||||
MOVW a+0(FP),R5
|
MOVW a+0(FP),R5
|
||||||
|
@ -41,7 +41,7 @@ install:V:
|
||||||
echo ADD '$4',R29
|
echo ADD '$4',R29
|
||||||
echo SYSCALL
|
echo SYSCALL
|
||||||
echo ADD '$-4',R29
|
echo ADD '$-4',R29
|
||||||
if(~ $i seek) { # untested so far - geoff
|
if(~ $i (seek _nsec)) { # untested so far - geoff
|
||||||
echo 'MOVW $-1,R5
|
echo 'MOVW $-1,R5
|
||||||
BNE R1,R5,4(PC)
|
BNE R1,R5,4(PC)
|
||||||
MOVW a+0(FP),R5
|
MOVW a+0(FP),R5
|
||||||
|
@ -53,7 +53,7 @@ install:V:
|
||||||
echo TEXT $i'(SB)', 1, '$0'
|
echo TEXT $i'(SB)', 1, '$0'
|
||||||
echo MOVL '$'$n, AX
|
echo MOVL '$'$n, AX
|
||||||
echo INT '$'64
|
echo INT '$'64
|
||||||
if(~ $i seek) {
|
if(~ $i (seek _nsec)) {
|
||||||
echo 'CMPL AX,$-1
|
echo 'CMPL AX,$-1
|
||||||
JNE 4(PC)
|
JNE 4(PC)
|
||||||
MOVL a+0(FP),CX
|
MOVL a+0(FP),CX
|
||||||
|
@ -62,10 +62,9 @@ install:V:
|
||||||
}
|
}
|
||||||
echo RET
|
echo RET
|
||||||
case amd64
|
case amd64
|
||||||
if(~ $i seek)
|
j=$i
|
||||||
echo TEXT _seek'(SB)', 1, '$0'
|
if(~ $i seek) j=_seek
|
||||||
if not
|
echo TEXT $j'(SB)', 1, '$0'
|
||||||
echo TEXT $i'(SB)', 1, '$0'
|
|
||||||
echo MOVQ RARG, 'a0+0(FP)'
|
echo MOVQ RARG, 'a0+0(FP)'
|
||||||
echo MOVQ '$'$n, RARG
|
echo MOVQ '$'$n, RARG
|
||||||
echo SYSCALL
|
echo SYSCALL
|
||||||
|
@ -75,7 +74,7 @@ install:V:
|
||||||
echo MOVW R7, '0(FP)'
|
echo MOVW R7, '0(FP)'
|
||||||
echo MOVW '$'$n, R7
|
echo MOVW '$'$n, R7
|
||||||
echo TA R0
|
echo TA R0
|
||||||
if(~ $i seek) {
|
if(~ $i (seek _nsec)) {
|
||||||
echo 'CMP R7,$-1
|
echo 'CMP R7,$-1
|
||||||
BNE 4(PC)
|
BNE 4(PC)
|
||||||
MOVW a+0(FP),R8
|
MOVW a+0(FP),R8
|
||||||
|
@ -100,7 +99,7 @@ install:V:
|
||||||
echo MOVW R0, '0(FP)'
|
echo MOVW R0, '0(FP)'
|
||||||
echo MOVW '$'$n, R0
|
echo MOVW '$'$n, R0
|
||||||
echo SWI 0
|
echo SWI 0
|
||||||
if(~ $i seek) {
|
if(~ $i (seek _nsec)) {
|
||||||
echo 'CMP $-1,R0
|
echo 'CMP $-1,R0
|
||||||
BNE 4(PC)
|
BNE 4(PC)
|
||||||
MOVW a+0(FP),R1
|
MOVW a+0(FP),R1
|
||||||
|
@ -113,7 +112,7 @@ install:V:
|
||||||
echo MOVW R3, '0(FP)'
|
echo MOVW R3, '0(FP)'
|
||||||
echo MOVW '$'$n, R3
|
echo MOVW '$'$n, R3
|
||||||
echo SYSCALL
|
echo SYSCALL
|
||||||
if(~ $i seek) {
|
if(~ $i (seek _nsec)) {
|
||||||
echo 'CMP R3,$-1
|
echo 'CMP R3,$-1
|
||||||
BNE 4(PC)
|
BNE 4(PC)
|
||||||
MOVW a+0(FP),R8
|
MOVW a+0(FP),R8
|
||||||
|
|
|
@ -49,3 +49,4 @@
|
||||||
#define PREAD 50
|
#define PREAD 50
|
||||||
#define PWRITE 51
|
#define PWRITE 51
|
||||||
#define TSEMACQUIRE 52
|
#define TSEMACQUIRE 52
|
||||||
|
#define _NSEC 53
|
||||||
|
|
Loading…
Reference in a new issue