vmx: nanosec(): fix non-interruptable temporary, assign fasthz only once after xstart
This commit is contained in:
parent
01eb04060b
commit
4ba5cb6c6a
1 changed files with 5 additions and 4 deletions
|
@ -17,14 +17,15 @@ nanosec(void)
|
||||||
return nsec() - xstart;
|
return nsec() - xstart;
|
||||||
|
|
||||||
if(fasthz == 0){
|
if(fasthz == 0){
|
||||||
if((fasthz = _tos->cyclefreq) == 0){
|
if(_tos->cyclefreq){
|
||||||
fasthz = ~0ULL;
|
cycles(&xstart);
|
||||||
|
fasthz = _tos->cyclefreq;
|
||||||
|
} else {
|
||||||
xstart = nsec();
|
xstart = nsec();
|
||||||
|
fasthz = ~0ULL;
|
||||||
fprint(2, "cyclefreq not available, falling back to nsec()\n");
|
fprint(2, "cyclefreq not available, falling back to nsec()\n");
|
||||||
fprint(2, "you might want to disable aux/timesync\n");
|
fprint(2, "you might want to disable aux/timesync\n");
|
||||||
return 0;
|
return 0;
|
||||||
}else{
|
|
||||||
cycles(&xstart);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cycles(&x);
|
cycles(&x);
|
||||||
|
|
Loading…
Reference in a new issue