From e4ce6aadac9e1de8d5ea625e9680d24cabce0e1a Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 20 Dec 2020 22:34:41 +0100 Subject: 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. --- sys/src/9/mtx/trap.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'sys/src/9/mtx') diff --git a/sys/src/9/mtx/trap.c b/sys/src/9/mtx/trap.c index 5408a6fe2..d82b802c4 100644 --- a/sys/src/9/mtx/trap.c +++ b/sys/src/9/mtx/trap.c @@ -215,11 +215,8 @@ trap(Ureg *ureg) int ecode, user; char buf[ERRMAX], *s; + user = kenter(ureg); ecode = (ureg->cause >> 8) & 0xff; - user = (ureg->srr1 & MSR_PR) != 0; - if(user) - up->dbgreg = ureg; - if((ureg->status & MSR_RI) == 0) print("double fault?: ecode = %d\n", ecode); @@ -503,22 +500,11 @@ dumpregs(Ureg *ur) print("%s\t%.8lux\t%s\t%.8lux\n", regname[i], l[0], regname[i+1], l[1]); } -static void -linkproc(void) -{ - spllo(); - (*up->kpfun)(up->kparg); - pexit("", 0); -} - void -kprocchild(Proc *p, void (*func)(void*), void *arg) +kprocchild(Proc *p, void (*entry)(void)) { - p->sched.pc = (ulong)linkproc; + p->sched.pc = (ulong)entry; p->sched.sp = (ulong)p->kstack+KSTACK; - - p->kpfun = func; - p->kparg = arg; } /* @@ -625,7 +611,6 @@ syscall(Ureg* ureg) m->syscall++; up->insyscall = 1; up->pc = ureg->pc; - up->dbgreg = ureg; scallnr = ureg->r3; up->scallnr = ureg->r3; -- cgit v1.2.3