]> git.lizzy.rs Git - plan9front.git/commitdiff
vmx: nanosec(): fix non-interruptable temporary, assign fasthz only once after xstart
authorcinap_lenrek <cinap_lenrek@felloff.net>
Tue, 8 Dec 2020 12:04:52 +0000 (13:04 +0100)
committercinap_lenrek <cinap_lenrek@felloff.net>
Tue, 8 Dec 2020 12:04:52 +0000 (13:04 +0100)
sys/src/cmd/vmx/nanosec.c

index ac418483da4bf8a23834f1ca3e281f0f69c4cfb8..1301e9faffa9cf09ab4831806fe52201c2c879bb 100644 (file)
@@ -17,14 +17,15 @@ nanosec(void)
                return nsec() - xstart;
 
        if(fasthz == 0){
-               if((fasthz = _tos->cyclefreq) == 0){
-                       fasthz = ~0ULL;
+               if(_tos->cyclefreq){
+                       cycles(&xstart);
+                       fasthz = _tos->cyclefreq;
+               } else {
                        xstart = nsec();
+                       fasthz = ~0ULL;
                        fprint(2, "cyclefreq not available, falling back to nsec()\n");
                        fprint(2, "you might want to disable aux/timesync\n");
                        return 0;
-               }else{
-                       cycles(&xstart);
                }
        }
        cycles(&x);