WIP: ps2 bus driver

This commit is contained in:
Daniel Samson
2026-07-11 04:19:03 +01:00
parent e499f500c3
commit b42d572d78
8 changed files with 221 additions and 16 deletions
+10
View File
@@ -162,6 +162,7 @@ fn system_call(state: *architecture.CpuState) void {
.msi_bind => systemMsiBind(state),
.io_read => systemIoRead(state),
.io_write => systemIoWrite(state),
.clock => systemClock(state),
_ => fail(state),
}
}
@@ -316,6 +317,15 @@ fn systemIoWrite(state: *architecture.CpuState) void {
architecture.setSystemCallResult(state, 0);
}
/// clock() -> nanoseconds since boot: a monotonic time source. The kernel already owns
/// the scheduling timer and computes this for preemption, so surfacing it is pure
/// mechanism — no policy (wall-clock time, calendars, timezones are a user-space
/// service layered on top). It lets a driver bound a poll loop by real time instead of
/// a spin count, and time short delays.
fn systemClock(state: *architecture.CpuState) void {
architecture.setSystemCallResult(state, architecture.nanos());
}
/// dma_alloc(len, flags) -> vaddr (rax), paddr (rdx): grant `len` bytes (rounded up to
/// whole pages) of DMA-capable memory — physically contiguous, zeroed, pinned, and
/// strong-uncacheable (coherent) — mapping it into the caller's DMA arena and handing