Implement schedsleep() syscall to sleep a process for a given time

This commit is contained in:
2025-11-02 16:46:37 +01:00
parent 179c4b98e2
commit 0f93aa2a81
9 changed files with 29 additions and 6 deletions

View File

@ -29,12 +29,11 @@ void pit_init(void) {
uint32_t hz = 1000;
uint32_t div = PIT_FREQ / hz;
io_out8(PIT_CMD, PIT_CMD_BINARY | PIT_CMD_MODE3 | PIT_CMD_RW_BOTH | PIT_CMD_COUNTER0);
io_out8(PIT_COUNTER0, div);
io_out8(PIT_COUNTER0, div & 0xFF);
io_out8(PIT_COUNTER0, div >> 8);
}
void pit_wait(uint32_t ms) {
uint32_t now = PIT_TICKS;
++ms;
while (PIT_TICKS - now < ms);
}