C bootstrap (phases 0-9):
cmd/wwc, cmd/6c, cmd/6a, cmd/6l, cmd/ww, rt, lib/*.
ww-side self-host (phase 10):
selfhost/cmd/wwc — ww-cgen frontend; bootstrap fixed point.
selfhost/cmd/6a — assembler; byte-identical to C 6a (test 991).
selfhost/cmd/6l — linker w/ archive (.a) support; byte-identical
to C 6l (test 992).
selfhost/cmd/ww — driver (build/run/version); byte-identical to
C ww (test 993).
make test: 15/15. make bootstrap: ww2.s == ww3.s, ww2.o == ww3.o,
ww2 == ww3 byte-identical, with the full ww-tooled chain.
16 lines
574 B
Plaintext
16 lines
574 B
Plaintext
// time — clocks. We expose monotonic-ns via a syscall trampoline.
|
|
// Linux clock_gettime is syscall 228; clock id 1 is CLOCK_MONOTONIC.
|
|
// Until we can pass struct-by-value the user supplies a buffer.
|
|
|
|
@symbol("rt_syscall") fn syscall(num: i64, a: i64, b: i64, c: i64) i64;
|
|
|
|
def CLOCK_MONOTONIC: i64 = 1;
|
|
def SYS_CLOCK_GETTIME: i64 = 228;
|
|
|
|
// timespec is {sec, nsec} — 16 bytes. Caller passes a pointer.
|
|
type timespec = struct { sec: i64, nsec: i64 };
|
|
|
|
export fn monotonic(ts: *timespec) i32 = {
|
|
return syscall(SYS_CLOCK_GETTIME, CLOCK_MONOTONIC, ts: i64, 0): i32;
|
|
};
|