diff --git a/sys/doc/backup.ms b/sys/doc/backup.ms index 1a059de3c..6699e7ad9 100644 --- a/sys/doc/backup.ms +++ b/sys/doc/backup.ms @@ -32,9 +32,9 @@ as the term is used by everyone but disk manufacturers. In the case of BDs, even that is an exaggeration, with the actual capacity being closer to $48.44 times 10 sup 9$ bytes, -so the claimed capacity should be read as `50 VAX-gigabytes', +so the claimed capacity should be read as `50 BD-gigabytes', where a -.I VAX-gigabyte +.I BD-gigabyte is 968,800,338 bytes. The default .I venti diff --git a/sys/doc/backup.pdf b/sys/doc/backup.pdf new file mode 100644 index 000000000..162f2c0d6 Binary files /dev/null and b/sys/doc/backup.pdf differ diff --git a/sys/doc/backup.ps b/sys/doc/backup.ps index 7c7e3f6ad..e61447d5e 100644 Binary files a/sys/doc/backup.ps and b/sys/doc/backup.ps differ diff --git a/sys/man/2/time b/sys/man/2/time index ceb377fae..9e1054c68 100644 --- a/sys/man/2/time +++ b/sys/man/2/time @@ -33,18 +33,27 @@ should be stored in and treated as .BR ulong s; this extends the range of valid times into the year 2106. .PP -These functions work by reading +.I Time +simply calls +.I nsec +and returns the value divided by 1000000000. +.PP +.I Nsec +is a system call. +Previous implementations read .BR /dev/bintime , -opening that file when they are first called. +opening that file when first called, +and maintaining a static file descriptor; +however, +the maintenance of file descriptors in the face +of process forks is overly complex and prone to error. .SH SOURCE .B /sys/src/libc/9sys/time.c .br -.B /sys/src/libc/9sys/nsec.c +.B /sys/src/libc/9syscall .SH SEE ALSO .IR cputime (2), .IR cons (3) .SH DIAGNOSTICS Sets .IR errstr . -.SH BUGS -These routines maintain a static file descriptor. diff --git a/sys/src/9/bcm/fns.h b/sys/src/9/bcm/fns.h index d3d6d6a37..a20427f5b 100644 --- a/sys/src/9/bcm/fns.h +++ b/sys/src/9/bcm/fns.h @@ -95,11 +95,11 @@ extern int fpuemu(Ureg*); extern void delay(int); /* only scheddump() */ extern int islo(void); extern void microdelay(int); /* only edf.c */ -extern void evenaddr(uintptr); extern void idlehands(void); extern void setkernur(Ureg*, Proc*); /* only devproc.c */ extern void* sysexecregs(uintptr, ulong, int); extern void sysprocsetup(Proc*); +extern void validalign(uintptr, unsigned); extern void kexit(Ureg*); diff --git a/sys/src/9/kw/arch.c b/sys/src/9/kw/arch.c index c800ffc77..3c7d6cf65 100644 --- a/sys/src/9/kw/arch.c +++ b/sys/src/9/kw/arch.c @@ -28,15 +28,32 @@ setkernur(Ureg* ureg, Proc* p) } /* - * called in sysfile.c + * called in syscallfmt.c, sysfile.c, sysproc.c */ void -evenaddr(uintptr addr) -{ - if(addr & 3){ - postnote(up, 1, "sys: odd address", NDebug); - error(Ebadarg); - } +validalign(uintptr addr, unsigned align) +{ + /* + * Plan 9 is a 32-bit O/S, and the hardware it runs on + * does not usually have instructions which move 64-bit + * quantities directly, synthesizing the operations + * with 32-bit move instructions. Therefore, the compiler + * (and hardware) usually only enforce 32-bit alignment, + * if at all. + * + * Take this out if the architecture warrants it. + */ + if(align == sizeof(vlong)) + align = sizeof(long); + + /* + * Check align is a power of 2, then addr alignment. + */ + if((align != 0 && !(align & (align-1))) && !(addr & (align-1))) + return; + postnote(up, 1, "sys: odd address", NDebug); + error(Ebadarg); + /*NOTREACHED*/ } /* go to user space */ diff --git a/sys/src/9/kw/fns.h b/sys/src/9/kw/fns.h index 6e8db4201..3766bcbf0 100644 --- a/sys/src/9/kw/fns.h +++ b/sys/src/9/kw/fns.h @@ -128,13 +128,13 @@ extern Block* uciallocb(int); extern void delay(int); /* only scheddump() */ extern int islo(void); extern void microdelay(int); /* only edf.c */ -extern void evenaddr(uintptr); extern void idlehands(void); extern void setkernur(Ureg*, Proc*); /* only devproc.c */ extern void spldone(void); extern int splfhi(void); extern int splflo(void); extern void sysprocsetup(Proc*); +extern void validalign(uintptr, unsigned); /* * PCI diff --git a/sys/src/9/mtx/fns.h b/sys/src/9/mtx/fns.h index d88d0d636..023d483d1 100644 --- a/sys/src/9/mtx/fns.h +++ b/sys/src/9/mtx/fns.h @@ -15,7 +15,6 @@ void delay(int); void dumpregs(Ureg*); void delayloopinit(void); void eieio(void); -void evenaddr(ulong); void faultpower(Ureg*, ulong addr, int read); void fprestore(FPsave*); void fpsave(FPsave*); @@ -103,6 +102,7 @@ void trapvec(void); void tlbflush(ulong); void tlbflushall(void); #define userureg(ur) (((ur)->status & MSR_PR) != 0) +void validalign(uintptr, unsigned); void watchreset(void); #define waserror() (up->nerrlab++, setlabel(&up->errlab[up->nerrlab-1])) diff --git a/sys/src/9/mtx/trap.c b/sys/src/9/mtx/trap.c index abd84f37a..5f7f9d523 100644 --- a/sys/src/9/mtx/trap.c +++ b/sys/src/9/mtx/trap.c @@ -522,15 +522,32 @@ kprocchild(Proc *p, void (*func)(void*), void *arg) } /* - * called in sysfile.c + * called in syscallfmt.c, sysfile.c, sysproc.c */ void -evenaddr(ulong addr) +validalign(uintptr addr, unsigned align) { - if(addr & 3){ - postnote(up, 1, "sys: odd address", NDebug); - error(Ebadarg); - } + /* + * Plan 9 is a 32-bit O/S, and the hardware it runs on + * does not usually have instructions which move 64-bit + * quantities directly, synthesizing the operations + * with 32-bit move instructions. Therefore, the compiler + * (and hardware) usually only enforce 32-bit alignment, + * if at all. + * + * Take this out if the architecture warrants it. + */ + if(align == sizeof(vlong)) + align = sizeof(long); + + /* + * Check align is a power of 2, then addr alignment. + */ + if((align != 0 && !(align & (align-1))) && !(addr & (align-1))) + return; + postnote(up, 1, "sys: odd address", NDebug); + error(Ebadarg); + /*NOTREACHED*/ } long diff --git a/sys/src/9/omap/arch.c b/sys/src/9/omap/arch.c index a9b9537a9..2b2d11aee 100644 --- a/sys/src/9/omap/arch.c +++ b/sys/src/9/omap/arch.c @@ -28,15 +28,32 @@ setkernur(Ureg* ureg, Proc* p) } /* - * called in sysfile.c + * called in syscallfmt.c, sysfile.c, sysproc.c */ void -evenaddr(uintptr addr) -{ - if(addr & 3){ - postnote(up, 1, "sys: odd address", NDebug); - error(Ebadarg); - } +validalign(uintptr addr, unsigned align) +{ + /* + * Plan 9 is a 32-bit O/S, and the hardware it runs on + * does not usually have instructions which move 64-bit + * quantities directly, synthesizing the operations + * with 32-bit move instructions. Therefore, the compiler + * (and hardware) usually only enforce 32-bit alignment, + * if at all. + * + * Take this out if the architecture warrants it. + */ + if(align == sizeof(vlong)) + align = sizeof(long); + + /* + * Check align is a power of 2, then addr alignment. + */ + if((align != 0 && !(align & (align-1))) && !(addr & (align-1))) + return; + postnote(up, 1, "sys: odd address", NDebug); + error(Ebadarg); + /*NOTREACHED*/ } /* go to user space */ diff --git a/sys/src/9/omap/fns.h b/sys/src/9/omap/fns.h index 30ff4c467..a46dff739 100644 --- a/sys/src/9/omap/fns.h +++ b/sys/src/9/omap/fns.h @@ -138,11 +138,11 @@ extern void ucfreeb(Block*); extern void delay(int); /* only scheddump() */ extern int islo(void); extern void microdelay(int); /* only edf.c */ -extern void evenaddr(uintptr); extern void idlehands(void); extern void setkernur(Ureg*, Proc*); /* only devproc.c */ extern void* sysexecregs(uintptr, ulong, int); extern void sysprocsetup(Proc*); +extern void validalign(uintptr, unsigned); /* * PCI stuff. diff --git a/sys/src/9/pc/fns.h b/sys/src/9/pc/fns.h index f7462a2ce..a79d4d894 100644 --- a/sys/src/9/pc/fns.h +++ b/sys/src/9/pc/fns.h @@ -26,7 +26,6 @@ int dmadone(int); void dmaend(int); int dmainit(int, int); long dmasetup(int, void*, long, int); -#define evenaddr(x) /* x86 doesn't care */ void fpclear(void); void fpenv(FPsave*); void fpinit(void); @@ -182,6 +181,7 @@ ulong upaalloc(int, int); void upafree(ulong, int); void upareserve(ulong, int); #define userureg(ur) (((ur)->cs & 0xFFFF) == UESEL) +void validalign(uintptr, unsigned); void vectortable(void); void* vmap(ulong, int); int vmapsync(ulong); @@ -190,6 +190,9 @@ void wbinvd(void); void wrmsr(int, vlong); int xchgw(ushort*, int); +#define PTR2UINT(p) ((uintptr)(p)) +#define UINT2PTR(i) ((void*)(i)) + #define waserror() (up->nerrlab++, setlabel(&up->errlab[up->nerrlab-1])) #define KADDR(a) kaddr(a) #define PADDR(a) paddr((void*)(a)) diff --git a/sys/src/9/pc/trap.c b/sys/src/9/pc/trap.c index 561fa24c9..51ea084ce 100644 --- a/sys/src/9/pc/trap.c +++ b/sys/src/9/pc/trap.c @@ -953,6 +953,32 @@ if(0) print("%s %lud: noted %.8lux %.8lux\n", } } +void +validalign(uintptr addr, unsigned align) +{ + /* + * Plan 9 is a 32-bit O/S, and the hardware it runs on + * does not usually have instructions which move 64-bit + * quantities directly, synthesizing the operations + * with 32-bit move instructions. Therefore, the compiler + * (and hardware) usually only enforce 32-bit alignment, + * if at all. + * + * Take this out if the architecture warrants it. + */ + if(align == sizeof(vlong)) + align = sizeof(long); + + /* + * Check align is a power of 2, then addr alignment. + */ + if((align != 0 && !(align & (align-1))) && !(addr & (align-1))) + return; + postnote(up, 1, "sys: odd address", NDebug); + error(Ebadarg); + /*NOTREACHED*/ +} + long execregs(ulong entry, ulong ssize, ulong nargs) { diff --git a/sys/src/9/port/syscallfmt.c b/sys/src/9/port/syscallfmt.c index c22968c13..76abb46be 100644 --- a/sys/src/9/port/syscallfmt.c +++ b/sys/src/9/port/syscallfmt.c @@ -113,7 +113,7 @@ syscallfmt(int syscallno, ulong pc, va_list list) a = va_arg(list, char*); fmtuserstring(&fmt, a, ""); argv = va_arg(list, char**); - evenaddr(PTR2UINT(argv)); + validalign(PTR2UINT(argv), sizeof(char*)); for(;;){ validaddr((ulong)argv, sizeof(char**), 0); a = *(char **)argv; @@ -299,6 +299,10 @@ syscallfmt(int syscallno, ulong pc, va_list list) fmtprint(&fmt, " %lld", vl); } break; + case NSEC: + v = va_arg(list, vlong*); + fmtprint(&fmt, "%#p", v); + break; } up->syscalltrace = fmtstrflush(&fmt); @@ -400,6 +404,9 @@ sysretfmt(int syscallno, va_list list, long ret, uvlong start, uvlong stop) } fmtprint(&fmt, " = %ld", ret); break; + case NSEC: + fmtprint(&fmt, " = %ld", ret); /* FoV */ + break; } fmtprint(&fmt, " %s %#llud %#llud\n", errstr, start, stop); up->syscalltrace = fmtstrflush(&fmt); diff --git a/sys/src/9/port/sysfile.c b/sys/src/9/port/sysfile.c index 3109e0623..4b8597649 100644 --- a/sys/src/9/port/sysfile.c +++ b/sys/src/9/port/sysfile.c @@ -190,8 +190,8 @@ syspipe(ulong *arg) Dev *d; static char *datastr[] = {"data", "data1"}; - validaddr(arg[0], 2*BY2WD, 1); - evenaddr(arg[0]); + validaddr(arg[0], sizeof(fd), 1); + validalign(arg[0], sizeof(int)); d = devtab[devno('|', 0)]; c[0] = namec("#|", Atodir, 0, 0); c[1] = 0; @@ -215,8 +215,8 @@ syspipe(ulong *arg) error(Enofd); poperror(); - ((long*)arg[0])[0] = fd[0]; - ((long*)arg[0])[1] = fd[1]; + ((int*)arg[0])[0] = fd[0]; + ((int*)arg[0])[1] = fd[1]; return 0; } @@ -859,7 +859,8 @@ sseek(ulong *arg) long sysseek(ulong *arg) { - validaddr(arg[0], BY2V, 1); + validaddr(arg[0], sizeof(vlong), 1); + validalign(arg[0], sizeof(vlong)); sseek(arg); return 0; } diff --git a/sys/src/9/port/sysproc.c b/sys/src/9/port/sysproc.c index ca4924ccd..d8098d8ee 100644 --- a/sys/src/9/port/sysproc.c +++ b/sys/src/9/port/sysproc.c @@ -315,7 +315,7 @@ sysexec(ulong *arg) nargs++; } } - evenaddr(arg[1]); + validalign(arg[1], sizeof(char**)); argp = (char**)arg[1]; validaddr((ulong)argp, BY2WD, 0); while(*argp){ @@ -591,7 +591,7 @@ sys_wait(ulong *arg) return pwait(nil); validaddr(arg[0], sizeof(OWaitmsg), 1); - evenaddr(arg[0]); + validalign(arg[0], BY2WD); /* who cares? */ pid = pwait(&w); if(pid >= 0){ ow = (OWaitmsg*)arg[0]; @@ -1083,7 +1083,7 @@ syssemacquire(ulong *arg) Segment *s; validaddr(arg[0], sizeof(long), 1); - evenaddr(arg[0]); + validalign(arg[0], sizeof(long)); addr = (long*)arg[0]; block = arg[1]; @@ -1102,7 +1102,7 @@ systsemacquire(ulong *arg) Segment *s; validaddr(arg[0], sizeof(long), 1); - evenaddr(arg[0]); + validalign(arg[0], sizeof(long)); addr = (long*)arg[0]; ms = arg[1]; @@ -1120,7 +1120,7 @@ syssemrelease(ulong *arg) Segment *s; validaddr(arg[0], sizeof(long), 1); - evenaddr(arg[0]); + validalign(arg[0], sizeof(long)); addr = (long*)arg[0]; delta = arg[1]; @@ -1131,3 +1131,14 @@ syssemrelease(ulong *arg) error(Ebadarg); return semrelease(s, addr, delta); } + +long +sysnsec(ulong *arg) +{ + validaddr(arg[0], sizeof(vlong), 1); + validalign(arg[0], sizeof(vlong)); + + *(vlong*)arg[0] = todget(nil); + + return 0; +} diff --git a/sys/src/9/port/systab.h b/sys/src/9/port/systab.h index c80b55508..c0bf76c8e 100644 --- a/sys/src/9/port/systab.h +++ b/sys/src/9/port/systab.h @@ -53,6 +53,7 @@ Syscall sysawait; Syscall syspread; Syscall syspwrite; Syscall systsemacquire; +Syscall sysnsec; Syscall sysdeath; Syscall *systab[]={ @@ -107,6 +108,7 @@ Syscall *systab[]={ [PREAD] syspread, [PWRITE] syspwrite, [TSEMACQUIRE] systsemacquire, + [NSEC] sysnsec, }; char *sysctab[]={ @@ -161,6 +163,7 @@ char *sysctab[]={ [PREAD] "Pread", [PWRITE] "Pwrite", [TSEMACQUIRE] "Tsemacquire", + [NSEC] "Nsec", }; int nsyscall = (sizeof systab/sizeof systab[0]); diff --git a/sys/src/9/ppc/fns.h b/sys/src/9/ppc/fns.h index 7e44d4415..120d11e12 100644 --- a/sys/src/9/ppc/fns.h +++ b/sys/src/9/ppc/fns.h @@ -17,7 +17,6 @@ void delayloopinit(void); void dmiss(void); void dumpregs(Ureg*); void eieio(void); -void evenaddr(ulong); void faultpower(Ureg*, ulong addr, int read); void flashprogpower(int); void fpgareset(void); @@ -111,6 +110,7 @@ void touser(void*); void trapinit(void); void trapvec(void); #define userureg(ur) (((ur)->status & MSR_PR) != 0) +void validalign(uintptr, unsigned); #define waserror() (up->nerrlab++, setlabel(&up->errlab[up->nerrlab-1])) #define KADDR(a) ((void*)((ulong)(a)|KZERO)) #define PADDR(a) ((((ulong)(a)&0xf0000000)==0xf0000000)?(ulong)(a):((ulong)(a)&~KZERO)) diff --git a/sys/src/9/ppc/trap.c b/sys/src/9/ppc/trap.c index 5e0c39cae..d4174511b 100644 --- a/sys/src/9/ppc/trap.c +++ b/sys/src/9/ppc/trap.c @@ -583,15 +583,32 @@ kprocchild(Proc *p, void (*func)(void*), void *arg) } /* - * called in sysfile.c + * called in syscallfmt.c, sysfile.c, sysproc.c */ void -evenaddr(ulong addr) +validalign(uintptr addr, unsigned align) { - if(addr & 3){ - postnote(up, 1, "sys: odd address", NDebug); - error(Ebadarg); - } + /* + * Plan 9 is a 32-bit O/S, and the hardware it runs on + * does not usually have instructions which move 64-bit + * quantities directly, synthesizing the operations + * with 32-bit move instructions. Therefore, the compiler + * (and hardware) usually only enforce 32-bit alignment, + * if at all. + * + * Take this out if the architecture warrants it. + */ + if(align == sizeof(vlong)) + align = sizeof(long); + + /* + * Check align is a power of 2, then addr alignment. + */ + if((align != 0 && !(align & (align-1))) && !(addr & (align-1))) + return; + postnote(up, 1, "sys: odd address", NDebug); + error(Ebadarg); + /*NOTREACHED*/ } long diff --git a/sys/src/9/rb/faultmips.c b/sys/src/9/rb/faultmips.c index 40a912e55..b4e412411 100644 --- a/sys/src/9/rb/faultmips.c +++ b/sys/src/9/rb/faultmips.c @@ -226,13 +226,30 @@ faultmips(Ureg *ur, int user, int code) } /* - * called in sysfile.c + * called in syscallfmt.c, sysfile.c, sysproc.c */ void -evenaddr(ulong addr) +validalign(uintptr addr, unsigned align) { - if(addr & 3){ - postnote(up, 1, "sys: odd address", NDebug); - error(Ebadarg); - } + /* + * Plan 9 is a 32-bit O/S, and the hardware it runs on + * does not usually have instructions which move 64-bit + * quantities directly, synthesizing the operations + * with 32-bit move instructions. Therefore, the compiler + * (and hardware) usually only enforce 32-bit alignment, + * if at all. + * + * Take this out if the architecture warrants it. + */ + if(align == sizeof(vlong)) + align = sizeof(long); + + /* + * Check align is a power of 2, then addr alignment. + */ + if((align != 0 && !(align & (align-1))) && !(addr & (align-1))) + return; + postnote(up, 1, "sys: odd address", NDebug); + error(Ebadarg); + /*NOTREACHED*/ } diff --git a/sys/src/9/rb/fns.h b/sys/src/9/rb/fns.h index 73716c7f0..2f7231534 100644 --- a/sys/src/9/rb/fns.h +++ b/sys/src/9/rb/fns.h @@ -12,7 +12,6 @@ int cmpswap(long*, long, long); void coherence(void); void cycles(uvlong *); void dcflush(void*, ulong); -void evenaddr(ulong); void faultmips(Ureg*, int, int); ulong fcr31(void); void firmware(int); @@ -123,6 +122,7 @@ ulong tlbvirt(void); void touser(uintptr); void unleash(void); #define userureg(ur) ((ur)->status & KUSER) +void validalign(uintptr, unsigned); void vecinit(void); void vector0(void); void vector100(void); diff --git a/sys/src/9/teg2/arch.c b/sys/src/9/teg2/arch.c index edfe16136..825639ac0 100644 --- a/sys/src/9/teg2/arch.c +++ b/sys/src/9/teg2/arch.c @@ -28,15 +28,32 @@ setkernur(Ureg* ureg, Proc* p) } /* - * called in sysfile.c + * called in syscallfmt.c, sysfile.c, sysproc.c */ void -evenaddr(uintptr addr) +validalign(uintptr addr, unsigned align) { - if(addr & 3){ - postnote(up, 1, "sys: odd address", NDebug); - error(Ebadarg); - } + /* + * Plan 9 is a 32-bit O/S, and the hardware it runs on + * does not usually have instructions which move 64-bit + * quantities directly, synthesizing the operations + * with 32-bit move instructions. Therefore, the compiler + * (and hardware) usually only enforce 32-bit alignment, + * if at all. + * + * Take this out if the architecture warrants it. + */ + if(align == sizeof(vlong)) + align = sizeof(long); + + /* + * Check align is a power of 2, then addr alignment. + */ + if((align != 0 && !(align & (align-1))) && !(addr & (align-1))) + return; + postnote(up, 1, "sys: odd address", NDebug); + error(Ebadarg); + /*NOTREACHED*/ } /* go to user space */ diff --git a/sys/src/9/teg2/fns.h b/sys/src/9/teg2/fns.h index 49319a538..ca0087a25 100644 --- a/sys/src/9/teg2/fns.h +++ b/sys/src/9/teg2/fns.h @@ -197,13 +197,13 @@ extern void ucfreeb(Block*); extern void delay(int); /* only scheddump() */ extern int islo(void); extern void microdelay(int); /* only edf.c */ -extern void evenaddr(uintptr); extern void idlehands(void); extern void setkernur(Ureg*, Proc*); /* only devproc.c */ extern void syscallfmt(int syscallno, ulong pc, va_list list); extern void sysretfmt(int syscallno, va_list list, long ret, uvlong start, uvlong stop); extern void* sysexecregs(uintptr, ulong, int); extern void sysprocsetup(Proc*); +extern void validalign(uintptr, unsigned); /* libc */ long labs(long); diff --git a/sys/src/libc/9sys/mkfile b/sys/src/libc/9sys/mkfile index 3b7d95e8e..73e3ebd40 100644 --- a/sys/src/libc/9sys/mkfile +++ b/sys/src/libc/9sys/mkfile @@ -26,7 +26,6 @@ OFILES=\ getppid.$O\ getwd.$O\ iounit.$O\ - nsec.$O\ nulldir.$O\ postnote.$O\ privalloc.$O\ diff --git a/sys/src/libc/9sys/time.c b/sys/src/libc/9sys/time.c index 3e5f83b04..23ef3d1ba 100644 --- a/sys/src/libc/9sys/time.c +++ b/sys/src/libc/9sys/time.c @@ -1,50 +1,12 @@ #include #include - -/* - * After a fork with fd's copied, both fd's are pointing to - * the same Chan structure. Since the offset is kept in the Chan - * structure, the seek's and read's in the two processes can - * compete at moving the offset around. Hence the unusual loop - * in the middle of this routine. - */ -static long -oldtime(long *tp) -{ - char b[20]; - static int f = -1; - int i, retries; - long t; - - memset(b, 0, sizeof(b)); - for(retries = 0; retries < 100; retries++){ - if(f < 0) - f = open("/dev/time", OREAD|OCEXEC); - if(f < 0) - break; - if(seek(f, 0, 0) < 0 || (i = read(f, b, sizeof(b))) < 0){ - close(f); - f = -1; - } else { - if(i != 0) - break; - } - } - t = atol(b); - if(tp) - *tp = t; - return t; -} - long time(long *tp) { vlong t; t = nsec()/1000000000LL; - if(t == 0) - t = oldtime(0); if(tp != nil) *tp = t; return t; diff --git a/sys/src/libc/9syscall/mkfile b/sys/src/libc/9syscall/mkfile index 181b5853b..4e407adac 100644 --- a/sys/src/libc/9syscall/mkfile +++ b/sys/src/libc/9syscall/mkfile @@ -13,7 +13,7 @@ install:V: echo MOVW R1, '0(FP)' echo MOVW '$'$n, R1 echo SYSCALL - if(~ $i seek) { + if(~ $i seek || ~ $i nsec) { echo 'MOVW $-1,R5 BNE R1,R5,4(PC) MOVW a+0(FP),R5 @@ -36,7 +36,7 @@ install:V: echo ADD '$4',R29 echo SYSCALL echo ADD '$-4',R29 - if(~ $i seek) { # untested so far - geoff + if(~ $i seek || ~ $i nsec) { # untested so far - geoff echo 'MOVW $-1,R5 BNE R1,R5,4(PC) MOVW a+0(FP),R5 @@ -48,7 +48,7 @@ install:V: echo TEXT $i'(SB)', 1, '$0' echo MOVL '$'$n, AX echo INT '$'64 - if(~ $i seek) { + if(~ $i seek || ~ $i nsec) { echo 'CMPL AX,$-1 JNE 4(PC) MOVL a+0(FP),CX @@ -66,7 +66,7 @@ install:V: # in a register, if the system call takes no arguments # there will be no 'a0+0(FP)' reserved on the stack. # - if(! ~ $i asystemcallwithnoarguments) + if(! ~ $i asystemcallwithnoarguments || ! ~ $i nsec) echo MOVQ RARG, 'a0+0(FP)' echo MOVQ '$'$n, RARG echo SYSCALL @@ -76,7 +76,7 @@ install:V: echo MOVW R7, '0(FP)' echo MOVW '$'$n, R7 echo TA R0 - if(~ $i seek) { + if(~ $i seek || ~ $i nsec) { echo 'CMP R7,$-1 BNE 4(PC) MOVW a+0(FP),R8 @@ -89,7 +89,7 @@ install:V: echo MOVW R0, '0(FP)' echo MOVW '$'$n, R0 echo SWI 0 - if(~ $i seek) { + if(~ $i seek || ~ $i nsec) { echo 'CMP $-1,R0 BNE 4(PC) MOVW a+0(FP),R1 @@ -102,7 +102,7 @@ install:V: echo MOVW R3, '0(FP)' echo MOVW '$'$n, R3 echo SYSCALL - if(~ $i seek) { + if(~ $i seek || ~ $i nsec) { echo 'CMP R3,$-1 BNE 4(PC) MOVW a+0(FP),R8 diff --git a/sys/src/libc/9syscall/sys.h b/sys/src/libc/9syscall/sys.h index fcc274799..ff204e812 100644 --- a/sys/src/libc/9syscall/sys.h +++ b/sys/src/libc/9syscall/sys.h @@ -49,3 +49,4 @@ #define PREAD 50 #define PWRITE 51 #define TSEMACQUIRE 52 +#define NSEC 53