--- /sys/doc/backup.ms Thu Feb 6 01:27:53 2014 +++ /sys/doc/backup.ms Wed May 14 17:02:55 2014 @@ -32,9 +32,9 @@ 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 --- /sys/doc/backup.ps Fri Feb 27 00:02:47 2009 +++ /sys/doc/backup.ps Wed May 14 17:02:56 2014 @@ -3796,49 +3796,49 @@ (even) 2458 3452 w (that is an exaggeration, with the actual capacity) 2717 3452 w (being) 720 3572 w -(closer) 1033 3572 w -(to) 1363 3572 w -(48.) 1502 3572 w -(44) 1668 3572 w -(\327) 1802 3572 w -(10) 1890 3572 w +(closer) 1038 3572 w +(to) 1373 3572 w +(48.) 1517 3572 w +(44) 1683 3572 w +(\327) 1817 3572 w +(10) 1905 3572 w 7 /LucidaSansUnicode00 f -(9) 2021 3532 w +(9) 2036 3532 w 10 /LucidaSansUnicode00 f -(bytes,) 2114 3572 w -(so) 2446 3572 w -(the) 2599 3572 w -(claimed) 2796 3572 w -(capacity) 3214 3572 w -(should) 3649 3572 w -(be) 4019 3572 w -(read) 4180 3572 w -(as) 4437 3572 w +(bytes,) 2134 3572 w +(so) 2471 3572 w +(the) 2629 3572 w +(claimed) 2830 3572 w +(capacity) 3252 3572 w +(should) 3691 3572 w +(be) 4065 3572 w +(read) 4230 3572 w +(as) 4491 3572 w 10 /LucidaSansUnicode20 f -(\030) 4585 3572 w +(\030) 4644 3572 w 10 /LucidaSansUnicode00 f -(50) 4617 3572 w -(VAX-) 4785 3572 w +(50) 4676 3572 w +(BD-) 4849 3572 w (gigabytes) 720 3692 w 10 /LucidaSansUnicode20 f (\031) 1187 3692 w 10 /LucidaSansUnicode00 f (,) 1219 3692 w -(where) 1287 3692 w -(a) 1615 3692 w +(where) 1293 3692 w +(a) 1627 3692 w 10 /LucidaSans-Italic f -(VAX-gigabyte) 1706 3692 w +(BD-gigabyte) 1724 3692 w 10 /LucidaSansUnicode00 f -(is) 2424 3692 w -(968,800,338) 2540 3692 w -(bytes.) 3207 3692 w -(The) 3566 3692 w -(default) 3783 3692 w +(is) 2380 3692 w +(968,800,338) 2501 3692 w +(bytes.) 3173 3692 w +(The) 3537 3692 w +(default) 3759 3692 w 10 /LucidaSans-Italic f -(venti) 4157 3692 w +(venti) 4139 3692 w 10 /LucidaSansUnicode00 f -(arena) 4428 3692 w -(size) 4732 3692 w +(arena) 4416 3692 w +(size) 4726 3692 w (is) 4960 3692 w (512MB, but for some reason our server is configured with 1GB arenas, so we could fit 46) 720 3812 w (of) 720 3932 w --- /sys/man/2/time Mon Feb 11 23:10:36 2013 +++ /sys/man/2/time Wed May 14 16:45:01 2014 @@ -33,18 +33,27 @@ .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. --- /sys/src/9/bcm/fns.h Thu Feb 21 22:22:37 2013 +++ /sys/src/9/bcm/fns.h Thu May 15 05:01:41 2014 @@ -95,11 +95,11 @@ 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*); --- /sys/src/9/kw/arch.c Mon Mar 22 20:34:36 2010 +++ /sys/src/9/kw/arch.c Wed May 14 16:45:00 2014 @@ -28,15 +28,32 @@ } /* - * 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 */ --- /sys/src/9/kw/fns.h Fri Dec 6 00:59:13 2013 +++ /sys/src/9/kw/fns.h Wed May 14 16:45:00 2014 @@ -128,13 +128,13 @@ 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 --- /sys/src/9/mtx/fns.h Mon Jan 22 19:52:06 2007 +++ /sys/src/9/mtx/fns.h Wed May 14 16:45:00 2014 @@ -15,7 +15,6 @@ 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 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])) --- /sys/src/9/mtx/trap.c Fri Jan 25 04:46:12 2013 +++ /sys/src/9/mtx/trap.c Wed May 14 16:45:00 2014 @@ -522,15 +522,32 @@ } /* - * 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 --- /sys/src/9/omap/arch.c Fri Apr 23 06:24:23 2010 +++ /sys/src/9/omap/arch.c Wed May 14 16:45:00 2014 @@ -28,15 +28,32 @@ } /* - * 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 */ --- /sys/src/9/omap/fns.h Fri Jan 25 01:01:17 2013 +++ /sys/src/9/omap/fns.h Wed May 14 16:45:00 2014 @@ -138,11 +138,11 @@ 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. --- /sys/src/9/pc/fns.h Thu Jun 13 23:01:35 2013 +++ /sys/src/9/pc/fns.h Wed May 14 16:45:00 2014 @@ -26,7 +26,6 @@ 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 @@ 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); @@ -189,6 +189,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) --- /sys/src/9/pc/trap.c Fri Jul 12 01:35:25 2013 +++ /sys/src/9/pc/trap.c Wed May 14 16:45:00 2014 @@ -953,6 +953,32 @@ } } +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) { --- /sys/src/9/port/syscallfmt.c Thu Aug 23 20:58:04 2012 +++ /sys/src/9/port/syscallfmt.c Wed May 14 16:45:01 2014 @@ -113,7 +113,7 @@ 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 @@ fmtprint(&fmt, " %lld", vl); } break; + case NSEC: + v = va_arg(list, vlong*); + fmtprint(&fmt, "%#p", v); + break; } up->syscalltrace = fmtstrflush(&fmt); @@ -399,6 +403,9 @@ fmtprint(&fmt, " %lld", vl); } fmtprint(&fmt, " = %ld", ret); + break; + case NSEC: + fmtprint(&fmt, " = %ld", ret); /* FoV */ break; } fmtprint(&fmt, " %s %#llud %#llud\n", errstr, start, stop); --- /sys/src/9/port/sysfile.c Thu Jun 9 22:53:28 2011 +++ /sys/src/9/port/sysfile.c Wed May 14 16:45:01 2014 @@ -190,8 +190,8 @@ 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 @@ 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 @@ long sysseek(ulong *arg) { - validaddr(arg[0], BY2V, 1); + validaddr(arg[0], sizeof(vlong), 1); + validalign(arg[0], sizeof(vlong)); sseek(arg); return 0; } --- /sys/src/9/port/sysproc.c Thu Jul 18 00:23:14 2013 +++ /sys/src/9/port/sysproc.c Wed May 14 16:45:01 2014 @@ -315,7 +315,7 @@ nargs++; } } - evenaddr(arg[1]); + validalign(arg[1], sizeof(char**)); argp = (char**)arg[1]; validaddr((ulong)argp, BY2WD, 0); while(*argp){ @@ -591,7 +591,7 @@ 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 @@ 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 @@ 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 @@ Segment *s; validaddr(arg[0], sizeof(long), 1); - evenaddr(arg[0]); + validalign(arg[0], sizeof(long)); addr = (long*)arg[0]; delta = arg[1]; @@ -1130,4 +1130,15 @@ if(delta < 0 || *addr < 0) 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; } --- /sys/src/9/port/systab.h Fri Jun 29 20:23:00 2012 +++ /sys/src/9/port/systab.h Wed May 14 16:45:00 2014 @@ -53,6 +53,7 @@ Syscall syspread; Syscall syspwrite; Syscall systsemacquire; +Syscall sysnsec; Syscall sysdeath; Syscall *systab[]={ @@ -107,6 +108,7 @@ [PREAD] syspread, [PWRITE] syspwrite, [TSEMACQUIRE] systsemacquire, + [NSEC] sysnsec, }; char *sysctab[]={ @@ -161,6 +163,7 @@ [PREAD] "Pread", [PWRITE] "Pwrite", [TSEMACQUIRE] "Tsemacquire", + [NSEC] "Nsec", }; int nsyscall = (sizeof systab/sizeof systab[0]); --- /sys/src/9/ppc/fns.h Sat Jan 26 02:34:15 2013 +++ /sys/src/9/ppc/fns.h Wed May 14 16:45:00 2014 @@ -17,7 +17,6 @@ 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 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)) --- /sys/src/9/ppc/trap.c Sat Jan 26 02:34:15 2013 +++ /sys/src/9/ppc/trap.c Wed May 14 16:44:59 2014 @@ -583,15 +583,32 @@ } /* - * 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 --- /sys/src/9/rb/faultmips.c Wed Jul 17 00:35:46 2013 +++ /sys/src/9/rb/faultmips.c Wed May 14 16:44:59 2014 @@ -226,13 +226,30 @@ } /* - * 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*/ } --- /sys/src/9/rb/fns.h Tue Jul 16 22:23:09 2013 +++ /sys/src/9/rb/fns.h Wed May 14 16:45:00 2014 @@ -12,7 +12,6 @@ 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 @@ 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); --- /sys/src/9/teg2/arch.c Thu Apr 26 06:32:34 2012 +++ /sys/src/9/teg2/arch.c Wed May 14 16:45:00 2014 @@ -28,15 +28,32 @@ } /* - * 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 */ --- /sys/src/9/teg2/fns.h Tue May 1 22:50:49 2012 +++ /sys/src/9/teg2/fns.h Wed May 14 16:45:00 2014 @@ -197,13 +197,13 @@ 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); --- /sys/src/libc/9sys/mkfile Wed Oct 23 18:16:45 2002 +++ /sys/src/libc/9sys/mkfile Wed May 14 16:45:01 2014 @@ -26,7 +26,6 @@ getppid.$O\ getwd.$O\ iounit.$O\ - nsec.$O\ nulldir.$O\ postnote.$O\ privalloc.$O\ --- /sys/src/libc/9sys/time.c Thu Feb 28 21:15:40 2002 +++ /sys/src/libc/9sys/time.c Wed May 14 16:45:01 2014 @@ -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; --- /sys/src/libc/9syscall/mkfile Tue Apr 9 16:21:15 2013 +++ /sys/src/libc/9syscall/mkfile Wed May 14 16:45:01 2014 @@ -13,7 +13,7 @@ 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 @@ 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 @@ 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 @@ # 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 @@ 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 @@ 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 @@ 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 --- /sys/src/libc/9syscall/sys.h Fri Jun 29 20:22:50 2012 +++ /sys/src/libc/9syscall/sys.h Wed May 14 16:45:01 2014 @@ -49,3 +49,4 @@ #define PREAD 50 #define PWRITE 51 #define TSEMACQUIRE 52 +#define NSEC 53