vmx: nanosec(): fix non-interruptable temporary, assign fasthz only once after xstart

This commit is contained in:
cinap_lenrek 2020-12-08 13:04:52 +01:00
parent 01eb04060b
commit 4ba5cb6c6a

View 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);