sylveos

Toy Operating System
Log | Files | Refs

commit ed757ead9e1b9eaa01d3bd720a8ba6e075cddc3d
parent 4534a220dca0a4d1c79869e3512bf975195d7250
Author: Sylvia Ivory <git@sivory.net>
Date:   Mon, 16 Mar 2026 00:02:11 -0700

Fix clock_gettime64

Diffstat:
Msylveos/syscall.zig | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sylveos/syscall.zig b/sylveos/syscall.zig @@ -294,13 +294,15 @@ pub fn syscall_handler(registers: interrupts.Registers, _: interrupts.ExceptionV }, // clock_gettime64 403 => { - journal.trace("[syscall] clock_gettime64(0x{X})", .{regs.gp[0]}); + // all clocks are the same (aka incorrect) + const clock = regs.gp[0]; + journal.trace("[syscall] clock_gettime64({d}, 0x{X})", .{ clock, regs.gp[1] }); const time = pi.devices.clock.current_count(); const seconds = time / std.time.us_per_s; const ns = (time % 1000) * 1000; - const addr: ?*Timespec = @ptrFromInt(regs.gp[0]); + const addr: ?*Timespec = @ptrFromInt(regs.gp[1]); if (addr) |ptr| { ptr.* = .{ .tv_nsec = @truncate(ns), .tv_sec = @intCast(seconds) }; }