From 3fce94e7850ab80d14fa15f2f393ae71259376e5 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 25 Oct 2011 20:17:39 +0200 Subject: fix _tos->pcycles, make _tos->kcycles actually count cycles executing kernel code on behalf of the process --- sys/src/9/omap/arch.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'sys/src/9/omap') diff --git a/sys/src/9/omap/arch.c b/sys/src/9/omap/arch.c index 53fb71e85..4714168b0 100644 --- a/sys/src/9/omap/arch.c +++ b/sys/src/9/omap/arch.c @@ -50,7 +50,7 @@ kexit(Ureg*) tos = (Tos*)(USTKTOP-sizeof(Tos)); cycles(&t); tos->kcycles += t - up->kentry; - tos->pcycles = up->pcycles; + tos->pcycles = t + up->pcycles; tos->cyclefreq = m->cpuhz; tos->pid = up->pid; @@ -124,11 +124,16 @@ void procsetup(Proc* p) { fpusysprocsetup(p); + + cycles(&p->kentry); + p->pcycles = -p->kentry; } void -procfork(Proc*) +procfork(Proc* p) { + p->kentry = up->kentry; + p->pcycles = -p->kentry; } /* @@ -141,6 +146,7 @@ procsave(Proc* p) cycles(&t); p->pcycles += t; + p->kentry -= t; // TODO: save and restore VFPv3 FP state once 5[cal] know the new registers. fpuprocsave(p); @@ -155,6 +161,7 @@ procrestore(Proc* p) return; cycles(&t); p->pcycles -= t; + p->kentry += t; fpuprocrestore(p); } -- cgit v1.2.3