Use the counter for stall

This commit is contained in:
Baptiste Wicht 2016-08-10 19:52:35 +02:00
parent 3e168e192d
commit 32c906fde6

View File

@ -166,11 +166,11 @@ void AcpiOsSleep(UINT64 ms){
* \brief Active sleep for the given number of microseconds * \brief Active sleep for the given number of microseconds
*/ */
void AcpiOsStall(UINT32 us){ void AcpiOsStall(UINT32 us){
auto ticks = timer::ticks(); uint64_t c = timer::counter();
auto wait = us * (timer::timer_frequency() / 1000000); uint64_t wait = us * (timer::counter_frequency() / double(1000000));
wait = !wait ? 1 : wait; wait = !wait ? 1 : wait;
while(timer::ticks() != ticks + wait){ while(timer::counter() != c + wait){
asm volatile("nop"); asm volatile("nop");
asm volatile("nop"); asm volatile("nop");
asm volatile("nop"); asm volatile("nop");