Skip to content

Commit 5c5f0cf

Browse files
sleeping with interrupts off is a generally bad idea
1 parent 77b0653 commit 5c5f0cf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

modules/e1000/e1000.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ bool e1000_start(pci_dev_t *pci_device) {
373373
e1000_write_command(REG_CTRL, 0x20 | ECTRL_SLU);
374374

375375
if (e1000_device_id == E1000_82541PI) {
376-
sleep(10); // Delay required after CTRL write on 82541PI
376+
// Delay required after CTRL write on 82541PI
377+
for (int j = 0; j < 10000; ++j) io_wait();
377378
}
378379

379380
e1000_check_link();

src/timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void sleep(uint64_t milliseconds)
4343
uint64_t start = ticks;
4444
uint64_t end = start + milliseconds;
4545
while (ticks < end) {
46-
__asm__ volatile("hlt");
46+
__asm__ volatile("pause");
4747
}
4848
}
4949

0 commit comments

Comments
 (0)