]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/kw/arch.c
pass Ureg* argument to note handler in R0 register on arm
[plan9front.git] / sys / src / 9 / kw / arch.c
index e481d5c58bd597bf8252a2bcb653c35c47192a5a..fc1734b6399861390689726848e82ca79aba8b6f 100644 (file)
@@ -50,7 +50,7 @@ kexit(Ureg*)
        tos = (Tos*)(USTKTOP-sizeof(Tos));
        t = fastticks(nil);
        tos->kcycles += t - up->kentry;
-       tos->pcycles = up->pcycles;
+       tos->pcycles = t + up->pcycles;
        tos->cyclefreq = Frequency;
        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;
 
        fpuprocsave(p);
 }
@@ -152,8 +158,10 @@ procrestore(Proc* p)
 
        if(p->kp)
                return;
-       t = lcycles();
+
+       cycles(&t);
        p->pcycles -= t;
+       p->kentry += t;
 
        fpuprocrestore(p);
 }
@@ -168,28 +176,6 @@ userureg(Ureg* ureg)
  * atomic ops
  * make sure that we don't drag in the C library versions
  */
-
-long
-_xdec(long *p)
-{
-       int s, v;
-
-       s = splhi();
-       v = --*p;
-       splx(s);
-       return v;
-}
-
-void
-_xinc(long *p)
-{
-       int s;
-
-       s = splhi();
-       ++*p;
-       splx(s);
-}
-
 int
 ainc(int *p)
 {