diff --git a/src/hulk/hulk.d b/src/hulk/hulk.d index d20a80f..916a2f5 100644 --- a/src/hulk/hulk.d +++ b/src/hulk/hulk.d @@ -24,6 +24,7 @@ import hulk.rtc; import hulk.serial; import hulk.usb; import hulk.pit; +import hulk.time; extern extern(C) __gshared ubyte _hulk_bss_size; @@ -87,6 +88,15 @@ void hulk_start() Usb.initialize(); sti(); + /* Check that PIT millisecond interrupt is firing. */ + size_t uptime = Time.uptime(); + while (Time.uptime() <= uptime) + { + } + Klog.writefln("\a5HULK Initialization Complete!"); + + /* Idle loop. */ + Time.msleep(1); for (;;) { hlt(); diff --git a/src/hulk/time.d b/src/hulk/time.d index 4acf673..1a422cb 100644 --- a/src/hulk/time.d +++ b/src/hulk/time.d @@ -23,7 +23,7 @@ struct Time */ public static @property ulong uptime() { - return s_uptime; + return volatileLoad(&s_uptime); } /** @@ -35,7 +35,7 @@ struct Time public static void msleep(ulong count) { ulong wait_for = s_uptime + count + 1; - while (volatileLoad(&s_uptime) < wait_for) + while (uptime() < wait_for) { } }