ref: 8348a233ae56a2f51dc2e3f93f681cc7aebdae14
parent: c8008e1ffd0bdcf8aa1152aa9a81157ef1688926
author: mischief <mischief@offblast.org>
date: Sat Sep 13 02:07:57 EDT 2014
vi: implement _nsec syscall
--- a/sys/src/cmd/vi/syscall.c
+++ b/sys/src/cmd/vi/syscall.c
@@ -65,6 +65,7 @@
[AWAIT] "Await",
[PREAD] "Pread",
[PWRITE] "Pwrite",
+ [_NSEC] "_nsec",
};
void sys1(void) { Bprint(bioout, "No system call %s\n", sysctab[reg.r[REGRET]]); exits(0); }
@@ -638,6 +639,22 @@
reg.r[REGRET] = 0;
}
+void
+sys_nsec(void)
+{
+ ulong ta;
+ vlong t;
+
+ ta = getmem_w(reg.r[REGSP]+4);
+ if(sysdbg)
+ itrace("_nsec(%lux)", ta);
+
+ t = nsec();
+
+ putmem_w(ta, t >> 32);
+ putmem_w(ta+4, t);
+}
+
void sysfversion(void) { Bprint(bioout, "No system call %s\n", sysctab[reg.r[REGRET]]); exits(0); }
void sysfsession(void) { Bprint(bioout, "No system call %s\n", sysctab[reg.r[REGRET]]); exits(0); }
void sysfauth(void) { Bprint(bioout, "No system call %s\n", sysctab[reg.r[REGRET]]); exits(0); }
@@ -710,6 +727,7 @@
[AWAIT] sysawait,
[PREAD] syspread,
[PWRITE] syspwrite,
+ [_NSEC] sys_nsec,
};
void
@@ -719,7 +737,7 @@
USED(inst);
call = reg.r[REGRET];
- if(call < 0 || call > PWRITE || systab[call] == nil) {
+ if(call < 0 || call > _NSEC || systab[call] == nil) {
Bprint(bioout, "Bad system call\n");
dumpreg();
}