diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-12-20 22:34:41 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-12-20 22:34:41 +0100 |
commit | e4ce6aadac9e1de8d5ea625e9680d24cabce0e1a (patch) | |
tree | 63c0b00f6f2c8eac29d4a0354d402206bc61397a /sys/src/9/port/sysproc.c | |
parent | 08c1622b0d8de92c2650d7b0338d9abf20985827 (diff) |
kernel: handle tos and per process pcycle counters in port/
we might as well handle the per process cycle
counter in the portable part instead of duplicating the code
in every arch and have inconsistent implementations.
we now have a portable kenter() and kexit() function,
that is ment to be used in trap/syscall from user,
which updates the counters.
some kernels missed initializing Mach.cyclefreq.
Diffstat (limited to 'sys/src/9/port/sysproc.c')
-rw-r--r-- | sys/src/9/port/sysproc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/src/9/port/sysproc.c b/sys/src/9/port/sysproc.c index a0a2d2441..a6466e40b 100644 --- a/sys/src/9/port/sysproc.c +++ b/sys/src/9/port/sysproc.c @@ -18,7 +18,7 @@ sysr1(va_list) } static void -abortion(void*) +abortion(void) { pexit("fork aborted", 1); } @@ -125,6 +125,8 @@ sysrfork(va_list list) p->insyscall = 0; memset(p->time, 0, sizeof(p->time)); p->time[TReal] = MACHP(0)->ticks; + p->kentry = up->kentry; + p->pcycles = -p->kentry; pid = pidalloc(p); @@ -133,7 +135,7 @@ sysrfork(va_list list) /* Abort the child process on error */ if(waserror()){ p->kp = 1; - kprocchild(p, abortion, 0); + kprocchild(p, abortion); ready(p); nexterror(); } @@ -577,6 +579,7 @@ sysexec(va_list list) up->notified = 0; up->privatemem = 0; up->noswap = 0; + up->pcycles = -up->kentry; procsetup(up); qunlock(&up->debug); |