1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 14:07:45 +00:00

Kernel: Use Processor::wait_check in loops waiting for HW to respond

This gives the processor the hint that it is in a hot loop and allows us
to do other work in between
This commit is contained in:
Hendiadyoin1 2023-09-12 14:58:55 +02:00 committed by Andrew Kaster
parent cbaa3465a8
commit a2810d3cf8
9 changed files with 31 additions and 36 deletions

View file

@ -7,6 +7,7 @@
#include <Kernel/Arch/DebugOutput.h>
#include <Kernel/Arch/x86_64/BochsDebugOutput.h>
#include <Kernel/Arch/x86_64/IO.h>
#include <Kernel/Arch/x86_64/Processor.h>
namespace Kernel {
@ -35,7 +36,7 @@ void debug_output(char ch)
}
while ((IO::in8(serial_com1_io_port + 5) & 0x20) == 0)
;
Processor::wait_check();
if (ch == '\n' && !was_cr)
IO::out8(serial_com1_io_port, '\r');

View file

@ -91,7 +91,7 @@ UNMAP_AFTER_INIT bool APICTimer::calibrate(HardwareTimerBase& calibration_source
sti();
// Loop for about 100 ms
while (state.calibration_ticks.load() <= state.ticks_in_100ms)
;
Processor::wait_check();
cli();
// Restore timer callbacks