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;
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue