fix MmAllocateContiguous, implement polling AHCI driver.
This commit is contained in:
1 parent
84d6265410
commit
5cf7a20ea2
8 files changed
+990
-27
No files matched your search
@@ -39,7 +39,15 @@ static uint64_t QueryTicks(void) { return gTicks; }
|
||||
static void Stall(uint32_t us) {
|
||||
uint64_t start = gTicks;
|
||||
uint64_t ms = (us + 999) / 1000;
|
||||
while ((gTicks - start) < ms) _mm_pause();
|
||||
|
||||
// Spin up to 100ms worth of IO delays waiting for ticks to advance.
|
||||
// If gTicks doesn't move (interrupts off), fall back to pure IO delay.
|
||||
uint32_t io_iters = (uint32_t)(ms * 1000);
|
||||
for (uint32_t i = 0; i < io_iters; i++) {
|
||||
if ((gTicks - start) >= ms) return; // interrupt-driven path
|
||||
__outbyte(0x80, 0);
|
||||
}
|
||||
// If we exhausted the IO delay loop we've waited long enough anyway.
|
||||
}
|
||||
|
||||
// Returns HPET ticks/second, or 0 if HPET is unavailable.
|
||||
|
||||
Reference in new issue
Block a user