Capitalize namespacing structs

This helps to avoid name clashes when breaking up modules into packages.
This commit is contained in:
Josh Holtrop 2023-01-01 17:34:41 -05:00
parent a423cdf1b1
commit 25ee1775f0
16 changed files with 86 additions and 86 deletions

View File

@ -103,7 +103,7 @@ static void generate(const char * d_file_name)
fprintf(fh, " int baseline_offset;\n"); fprintf(fh, " int baseline_offset;\n");
fprintf(fh, " const CharInfo[] chars;\n"); fprintf(fh, " const CharInfo[] chars;\n");
fprintf(fh, "};\n"); fprintf(fh, "};\n");
fprintf(fh, "__gshared const FontInfo kfont = {\n"); fprintf(fh, "__gshared const FontInfo Kfont = {\n");
fprintf(fh, " %du,\n", line_height); fprintf(fh, " %du,\n", line_height);
fprintf(fh, " %du,\n", max_advance); fprintf(fh, " %du,\n", max_advance);
fprintf(fh, " %d,\n", baseline_offset); fprintf(fh, " %d,\n", baseline_offset);

View File

@ -7,7 +7,7 @@ import hulk.hurl;
import hulk.klog; import hulk.klog;
import hulk.memory; import hulk.memory;
struct acpi struct Acpi
{ {
enum uint APIC_SIGNATURE = 0x43495041u; enum uint APIC_SIGNATURE = 0x43495041u;
enum uint XSDT_SIGNATURE = 0x54445358u; enum uint XSDT_SIGNATURE = 0x54445358u;
@ -58,20 +58,20 @@ struct acpi
public static void initialize(ulong acpi_xsdt_phys) public static void initialize(ulong acpi_xsdt_phys)
{ {
/* Map the XSDT header. */ /* Map the XSDT header. */
hurl.identity_map_range(acpi_xsdt_phys, Xsdt.sizeof, 0u); Hurl.identity_map_range(acpi_xsdt_phys, Xsdt.sizeof, 0u);
const(Xsdt) * xsdt = cast(const(Xsdt) *)acpi_xsdt_phys; const(Xsdt) * xsdt = cast(const(Xsdt) *)acpi_xsdt_phys;
if (xsdt.header.signature != XSDT_SIGNATURE) if (xsdt.header.signature != XSDT_SIGNATURE)
{ {
klog.writef("XSDT signature invalid\n"); Klog.writef("XSDT signature invalid\n");
return; return;
} }
/* Map the entire XSDT. */ /* Map the entire XSDT. */
hurl.identity_map_range(acpi_xsdt_phys, xsdt.header.length, 0u); Hurl.identity_map_range(acpi_xsdt_phys, xsdt.header.length, 0u);
size_t n_entries = (xsdt.header.length - xsdt.header.sizeof) / xsdt.tables[0].sizeof; size_t n_entries = (xsdt.header.length - xsdt.header.sizeof) / xsdt.tables[0].sizeof;
for (size_t i = 0u; i < n_entries; i++) for (size_t i = 0u; i < n_entries; i++)
{ {
ulong address = xsdt.tables[i]; ulong address = xsdt.tables[i];
hurl.identity_map_range(address, 4u, 0u); Hurl.identity_map_range(address, 4u, 0u);
uint signature = *cast(const(uint) *)address; uint signature = *cast(const(uint) *)address;
if (signature == APIC_SIGNATURE) if (signature == APIC_SIGNATURE)
{ {
@ -83,9 +83,9 @@ struct acpi
private static parse_apic_table(ulong address) private static parse_apic_table(ulong address)
{ {
const(MadtHeader) * madt_header = cast(const(MadtHeader) *)address; const(MadtHeader) * madt_header = cast(const(MadtHeader) *)address;
hurl.identity_map_range(address, madt_header.length, 0u); Hurl.identity_map_range(address, madt_header.length, 0u);
apic_address = madt_header.local_apic_address; apic_address = madt_header.local_apic_address;
klog.writefln("Found 32-bit APIC address: 0x%x", apic_address); Klog.writefln("Found 32-bit APIC address: 0x%x", apic_address);
const(void) * madt_end = cast(const(void) *)(address + madt_header.length); const(void) * madt_end = cast(const(void) *)(address + madt_header.length);
const(MadtEntry) * madt_entry = cast(const(MadtEntry) *)(address + 0x2Cu); const(MadtEntry) * madt_entry = cast(const(MadtEntry) *)(address + 0x2Cu);
while (madt_entry < madt_end) while (madt_entry < madt_end)
@ -95,7 +95,7 @@ struct acpi
{ {
/* Found a 64-bit Local APIC Address Override entry. */ /* Found a 64-bit Local APIC Address Override entry. */
memcpy(cast(void *)&apic_address, cast(const(void) *)madt_entry + 4u, 8u); memcpy(cast(void *)&apic_address, cast(const(void) *)madt_entry + 4u, 8u);
klog.writefln("Found 64-bit APIC address: 0x%x", apic_address); Klog.writefln("Found 64-bit APIC address: 0x%x", apic_address);
} }
} }
} }

View File

@ -9,7 +9,7 @@ import hulk.acpi;
import hulk.idt; import hulk.idt;
import hulk.rtc; import hulk.rtc;
struct apic struct Apic
{ {
private enum uint PERIODIC_MODE = 0x2_0000u; private enum uint PERIODIC_MODE = 0x2_0000u;
@ -66,22 +66,22 @@ struct apic
public static void initialize() public static void initialize()
{ {
apic_registers = cast(ApicRegisters *)acpi.apic_address; apic_registers = cast(ApicRegisters *)Acpi.apic_address;
io_apic_registers = cast(IoApicRegisters *)0xFEC0_0000u; io_apic_registers = cast(IoApicRegisters *)0xFEC0_0000u;
hurl.map(cast(ulong)apic_registers, cast(ulong)apic_registers, Hurl.map(cast(ulong)apic_registers, cast(ulong)apic_registers,
PT_WRITABLE | PT_WRITE_THROUGH | PT_DISABLE_CACHE | PT_NO_EXECUTE); PT_WRITABLE | PT_WRITE_THROUGH | PT_DISABLE_CACHE | PT_NO_EXECUTE);
hurl.map(cast(ulong)io_apic_registers, cast(ulong)io_apic_registers, Hurl.map(cast(ulong)io_apic_registers, cast(ulong)io_apic_registers,
PT_WRITABLE | PT_WRITE_THROUGH | PT_DISABLE_CACHE | PT_NO_EXECUTE); PT_WRITABLE | PT_WRITE_THROUGH | PT_DISABLE_CACHE | PT_NO_EXECUTE);
klog.writefln("LAPIC ID: 0x%08x", apic_registers.lapic_id.value); Klog.writefln("LAPIC ID: 0x%08x", apic_registers.lapic_id.value);
klog.writefln("LAPIC version: 0x%08x", apic_registers.lapic_version.value); Klog.writefln("LAPIC version: 0x%08x", apic_registers.lapic_version.value);
/* Enable local APIC to receive interrupts and set spurious interrupt /* Enable local APIC to receive interrupts and set spurious interrupt
* vector to 0xFF. */ * vector to 0xFF. */
apic_registers.spurious_interrupt_vector.value = 0x100u | idt.INT_APIC_SPURIOUS; apic_registers.spurious_interrupt_vector.value = 0x100u | Idt.INT_APIC_SPURIOUS;
apic_registers.lvt_timer.value = idt.INT_APIC_TIMER; apic_registers.lvt_timer.value = Idt.INT_APIC_TIMER;
apic_registers.lvt_lint[0].value = idt.INT_APIC_LINT0; apic_registers.lvt_lint[0].value = Idt.INT_APIC_LINT0;
apic_registers.lvt_lint[1].value = idt.INT_APIC_LINT1; apic_registers.lvt_lint[1].value = Idt.INT_APIC_LINT1;
/* Enable RTC interrupt. */ /* Enable RTC interrupt. */
configure_io_apic_irq(IRQ_RTC, idt.INT_APIC_BASE + IRQ_RTC); configure_io_apic_irq(IRQ_RTC, Idt.INT_APIC_BASE + IRQ_RTC);
} }
private static void configure_io_apic_irq(size_t io_apic_irq, size_t interrupt_id) private static void configure_io_apic_irq(size_t io_apic_irq, size_t interrupt_id)
@ -102,8 +102,8 @@ struct apic
{ {
switch (vector) switch (vector)
{ {
case idt.INT_APIC_BASE + IRQ_RTC: case Idt.INT_APIC_BASE + IRQ_RTC:
rtc.isr(); Rtc.isr();
break; break;
default: default:

View File

@ -6,7 +6,7 @@ module hulk.console;
import hulk.fb; import hulk.fb;
import hulk.kfont; import hulk.kfont;
struct console struct Console
{ {
/** Console width in text columns. */ /** Console width in text columns. */
private static __gshared size_t m_width; private static __gshared size_t m_width;
@ -25,8 +25,8 @@ struct console
*/ */
public static void initialize() public static void initialize()
{ {
m_width = fb.width / kfont.advance; m_width = Fb.width / Kfont.advance;
m_height = fb.height / kfont.line_height; m_height = Fb.height / Kfont.line_height;
} }
/** /**
@ -34,7 +34,7 @@ struct console
*/ */
public static void clear() public static void clear()
{ {
fb.clear(); Fb.clear();
m_x = 0u; m_x = 0u;
m_y = 0u; m_y = 0u;
} }
@ -64,10 +64,10 @@ struct console
if (m_y == m_height) if (m_y == m_height)
{ {
m_y--; m_y--;
fb.copy_rows_up(fb_y(m_height - 1u), Fb.copy_rows_up(fb_y(m_height - 1u),
(m_height - 1u) * kfont.line_height, (m_height - 1u) * Kfont.line_height,
kfont.line_height); Kfont.line_height);
fb.rect(0u, fb_y(m_height - 1u), fb_x(m_width), kfont.line_height, 0u); Fb.rect(0u, fb_y(m_height - 1u), fb_x(m_width), Kfont.line_height, 0u);
} }
} }
@ -80,8 +80,8 @@ struct console
*/ */
private static void render_char(size_t x, size_t y, char ch) private static void render_char(size_t x, size_t y, char ch)
{ {
const(CharInfo) * ci = &kfont.chars[ch]; const(CharInfo) * ci = &Kfont.chars[ch];
fb.blit_alpha_bitmap(fb_x(x) + ci.left, fb_y(y) + ci.top - ci.height, ci.bitmap, ci.width, ci.height); Fb.blit_alpha_bitmap(fb_x(x) + ci.left, fb_y(y) + ci.top - ci.height, ci.bitmap, ci.width, ci.height);
} }
/** /**
@ -89,7 +89,7 @@ struct console
*/ */
private static size_t fb_x(size_t x) private static size_t fb_x(size_t x)
{ {
return x * kfont.advance; return x * Kfont.advance;
} }
/** /**
@ -97,6 +97,6 @@ struct console
*/ */
private static size_t fb_y(size_t y) private static size_t fb_y(size_t y)
{ {
return fb.height - ((y + 1u) * kfont.line_height); return Fb.height - ((y + 1u) * Kfont.line_height);
} }
} }

View File

@ -11,7 +11,7 @@ import hulk.kfont;
* *
* TODO: Handle other pixel formats. Currently only BGRx is supported. * TODO: Handle other pixel formats. Currently only BGRx is supported.
*/ */
struct fb struct Fb
{ {
/** Device frame buffer base address. */ /** Device frame buffer base address. */
private __gshared static uint * m_device_buffer; private __gshared static uint * m_device_buffer;
@ -141,8 +141,8 @@ struct fb
*/ */
static void character(int x, int y, char ch, uint color) static void character(int x, int y, char ch, uint color)
{ {
const(CharInfo) * ci = &kfont.chars[ch]; const(CharInfo) * ci = &Kfont.chars[ch];
blend_alpha_bitmap(x + ci.left, y + kfont.baseline_offset + ci.top - ci.height, ci.bitmap, ci.width, ci.height, color); blend_alpha_bitmap(x + ci.left, y + Kfont.baseline_offset + ci.top - ci.height, ci.bitmap, ci.width, ci.height, color);
} }
/** /**

View File

@ -5,7 +5,7 @@ module hulk.gdt;
import ldc.llvmasm; import ldc.llvmasm;
struct gdt struct Gdt
{ {
struct gdtr_t struct gdtr_t
{ {

View File

@ -7,7 +7,7 @@
*/ */
module hulk.hippo; module hulk.hippo;
struct hippo struct Hippo
{ {
/** /**
* Linked list node entry for a physical page. * Linked list node entry for a physical page.

View File

@ -56,25 +56,25 @@ void hulk_start()
{ {
cli(); cli();
initialize_cpu(); initialize_cpu();
gdt.initialize(); Gdt.initialize();
idt.initialize(); Idt.initialize();
fb.initialize(cast(uint *)HULK_VIRTUAL_FRAMEBUFFER_ADDRESS, Fb.initialize(cast(uint *)HULK_VIRTUAL_FRAMEBUFFER_ADDRESS,
cast(uint *)hulk_header.bootinfo.fb_buffer1_phys, cast(uint *)hulk_header.bootinfo.fb_buffer1_phys,
hulk_header.bootinfo.fb.width, hulk_header.bootinfo.fb.width,
hulk_header.bootinfo.fb.height, hulk_header.bootinfo.fb.height,
hulk_header.bootinfo.fb.stride); hulk_header.bootinfo.fb.stride);
console.initialize(); Console.initialize();
console.clear(); Console.clear();
klog.initialize(); Klog.initialize();
klog.writefln("Welcome to HULK, the HOS UltraLight Kernel!"); Klog.writefln("Welcome to HULK, the HOS UltraLight Kernel!");
hurl.initialize(&hulk_header); Hurl.initialize(&hulk_header);
pci.initialize(); Pci.initialize();
pic.initialize(); Pic.initialize();
acpi.initialize(hulk_header.bootinfo.acpi_xsdt_phys); Acpi.initialize(hulk_header.bootinfo.acpi_xsdt_phys);
apic.initialize(); Apic.initialize();
rtc.initialize(); Rtc.initialize();
sti(); sti();
for (;;) for (;;)

View File

@ -23,7 +23,7 @@ enum ulong HULK_VIRTUAL_STACK_TOP_ADDRESS = 0xFFFF_A000_0000_0000u;
/** HULK virtual framebuffer address. */ /** HULK virtual framebuffer address. */
enum ulong HULK_VIRTUAL_FRAMEBUFFER_ADDRESS = 0xFFFF_A000_0000_0000u; enum ulong HULK_VIRTUAL_FRAMEBUFFER_ADDRESS = 0xFFFF_A000_0000_0000u;
struct hurl struct Hurl
{ {
/** /**
* Pointer to the base page table. * Pointer to the base page table.
@ -121,7 +121,7 @@ struct hurl
reclaimed_pages += reclaim_bootloader_page_table_pages(pte.follow(), level + 1u); reclaimed_pages += reclaim_bootloader_page_table_pages(pte.follow(), level + 1u);
} }
} }
hippo.free_page(pt); Hippo.free_page(pt);
reclaimed_pages++; reclaimed_pages++;
return reclaimed_pages; return reclaimed_pages;
} }
@ -186,7 +186,7 @@ struct hurl
} }
if (!is_reserved) if (!is_reserved)
{ {
hippo.free_page(phys); Hippo.free_page(phys);
} }
phys += PAGE_SIZE; phys += PAGE_SIZE;
} }
@ -213,8 +213,8 @@ struct hurl
usable_memory += LinkerAddresses.hulk_bss_size; usable_memory += LinkerAddresses.hulk_bss_size;
usable_memory += header.stack_size; usable_memory += header.stack_size;
usable_memory += fb_size; usable_memory += fb_size;
klog.writefln("Usable memory: %uKB", usable_memory >> 10u); Klog.writefln("Usable memory: %uKB", usable_memory >> 10u);
klog.writefln("Kernel size: %uKB", (LinkerAddresses.hulk_binary_size + LinkerAddresses.hulk_bss_size + header.stack_size) >> 10u); Klog.writefln("Kernel size: %uKB", (LinkerAddresses.hulk_binary_size + LinkerAddresses.hulk_bss_size + header.stack_size) >> 10u);
} }
public static void map(T, U)(T virtual, U physical, ulong flags) public static void map(T, U)(T virtual, U physical, ulong flags)
@ -266,12 +266,12 @@ struct hurl
public static void debug_lookup(void * address) public static void debug_lookup(void * address)
{ {
klog.writefln("Debugging page table lookup of 0x%x", address); Klog.writefln("Debugging page table lookup of 0x%x", address);
PageTable * pt = m_pt_base; PageTable * pt = m_pt_base;
for (size_t level = 0; level < 4u; level++) for (size_t level = 0; level < 4u; level++)
{ {
PageTableEntry pte = *pt.entry(address, level); PageTableEntry pte = *pt.entry(address, level);
klog.writefln("Level %u, index %u, entry = 0x%x", level, pt.index(address, level), pte); Klog.writefln("Level %u, index %u, entry = 0x%x", level, pt.index(address, level), pte);
if (pte.present) if (pte.present)
{ {
pt = pte.follow(); pt = pte.follow();
@ -289,7 +289,7 @@ struct hurl
private static PageTable * allocate_pt() private static PageTable * allocate_pt()
{ {
PageTable * pt = cast(PageTable *)hippo.allocate_page(); PageTable * pt = cast(PageTable *)Hippo.allocate_page();
memset64(pt, 0u, PAGE_SIZE / 8u); memset64(pt, 0u, PAGE_SIZE / 8u);
return pt; return pt;
} }

View File

@ -10,7 +10,7 @@ import hulk.console;
import hulk.klog; import hulk.klog;
import hulk.apic; import hulk.apic;
struct idt struct Idt
{ {
/* The I/O APIC is configured to map IRQ 0 to interrupt 64 (0x40). */ /* The I/O APIC is configured to map IRQ 0 to interrupt 64 (0x40). */
public static enum ulong INT_APIC_BASE = 0x40u; /* IRQ 0 */ public static enum ulong INT_APIC_BASE = 0x40u; /* IRQ 0 */
@ -96,7 +96,7 @@ struct idt
((offset & 0xFFFF_0000u) << 32u) | ((offset & 0xFFFF_0000u) << 32u) |
(dpl << 45u) | (dpl << 45u) |
((trap ? 1uL : 0uL) << 40u) | ((trap ? 1uL : 0uL) << 40u) |
(gdt.SELECTOR_KERNEL_CODE << 16u) | (Gdt.SELECTOR_KERNEL_CODE << 16u) |
(offset & 0xFFFFu); (offset & 0xFFFFu);
idt[index][1] = offset >> 32u; idt[index][1] = offset >> 32u;
} }
@ -104,25 +104,25 @@ struct idt
public extern(C) void isr(ulong vector, ulong arg) public extern(C) void isr(ulong vector, ulong arg)
{ {
if ((vector >= idt.INT_APIC_BASE) && (vector < (idt.INT_APIC_BASE + idt.INT_APIC_COUNT))) if ((vector >= Idt.INT_APIC_BASE) && (vector < (Idt.INT_APIC_BASE + Idt.INT_APIC_COUNT)))
{ {
apic.isr(vector); Apic.isr(vector);
} }
else else
{ {
switch (vector) switch (vector)
{ {
case idt.INT_APIC_TIMER: case Idt.INT_APIC_TIMER:
case idt.INT_APIC_LINT0: case Idt.INT_APIC_LINT0:
case idt.INT_APIC_LINT1: case Idt.INT_APIC_LINT1:
case idt.INT_APIC_SPURIOUS: case Idt.INT_APIC_SPURIOUS:
apic.isr(vector); Apic.isr(vector);
break; break;
default: default:
console.clear(); Console.clear();
fb.clear(0xFF8000u); Fb.clear(0xFF8000u);
klog.writefln("ISR %u, 0x%x", vector, arg); Klog.writefln("ISR %u, 0x%x", vector, arg);
__asm("cli", ""); __asm("cli", "");
for (;;) for (;;)
{ {

View File

@ -7,7 +7,7 @@ import core.stdc.stdarg;
import hulk.console; import hulk.console;
static import hulk.writef; static import hulk.writef;
struct klog struct Klog
{ {
/** /**
* Kernel buffer size log. * Kernel buffer size log.
@ -40,7 +40,7 @@ struct klog
public static void writef(string s, va_list args) public static void writef(string s, va_list args)
{ {
hulk.writef.writef(s, args, function void(ubyte ch) { hulk.writef.writef(s, args, function void(ubyte ch) {
console.write(ch); Console.write(ch);
}); });
} }

View File

@ -31,7 +31,7 @@ enum ulong MTRRPHYSBASE_TYPE_MASK = 0xFFu;
enum ulong MTRRPHYSMASK_PHYSMASK_MASK = 0x000F_FFFF_FFFF_F000u; enum ulong MTRRPHYSMASK_PHYSMASK_MASK = 0x000F_FFFF_FFFF_F000u;
enum ulong MTRRPHYSMASK_VALID = 0x800u; enum ulong MTRRPHYSMASK_VALID = 0x800u;
struct mtrr struct Mtrr
{ {
public static void initialize() public static void initialize()
{ {
@ -41,7 +41,7 @@ struct mtrr
cpuid1(&ebx, &ecx, &edx); cpuid1(&ebx, &ecx, &edx);
if ((edx & CPUID_1_EDX_MTRR) == 0u) if ((edx & CPUID_1_EDX_MTRR) == 0u)
{ {
klog.writefln("CPU does not support MTRR"); Klog.writefln("CPU does not support MTRR");
return; return;
} }
const(ulong) mtrrcap = rdmsr(MSR_MTRRCAP); const(ulong) mtrrcap = rdmsr(MSR_MTRRCAP);

View File

@ -3,7 +3,7 @@ module hulk.pci;
import hulk.cpu; import hulk.cpu;
import hulk.klog; import hulk.klog;
struct pci struct Pci
{ {
/* IO address for PCI configuration address. */ /* IO address for PCI configuration address. */
enum IO_ADDR_CONFIG_ADDRESS = 0xCF8u; enum IO_ADDR_CONFIG_ADDRESS = 0xCF8u;
@ -24,7 +24,7 @@ struct pci
if (reg0 != 0xFFFFFFFFu) if (reg0 != 0xFFFFFFFFu)
{ {
ulong reg2 = read_config_register(bus_id, device_id, 2u); ulong reg2 = read_config_register(bus_id, device_id, 2u);
klog.writefln("Found PCI device %04x:%04x (%02x:%02x:%02x) at %02u:%02u", Klog.writefln("Found PCI device %04x:%04x (%02x:%02x:%02x) at %02u:%02u",
(reg0 & 0xFFFFu), (reg0 >> 16u), (reg0 & 0xFFFFu), (reg0 >> 16u),
(reg2 >> 24u) & 0xFFu, (reg2 >> 24u) & 0xFFu,
(reg2 >> 16u) & 0xFFu, (reg2 >> 16u) & 0xFFu,
@ -35,7 +35,7 @@ struct pci
public static void initialize() public static void initialize()
{ {
klog.writefln("Scanning PCI devices..."); Klog.writefln("Scanning PCI devices...");
for (ulong bus_id = 0u; bus_id < 256u; bus_id++) for (ulong bus_id = 0u; bus_id < 256u; bus_id++)
{ {
for (ulong device_id = 0u; device_id < 32u; device_id++) for (ulong device_id = 0u; device_id < 32u; device_id++)
@ -43,6 +43,6 @@ struct pci
scan(bus_id, device_id); scan(bus_id, device_id);
} }
} }
klog.writefln("PCI scan complete."); Klog.writefln("PCI scan complete.");
} }
} }

View File

@ -5,7 +5,7 @@ module hulk.pic;
import hulk.cpu; import hulk.cpu;
struct pic struct Pic
{ {
public static void initialize() public static void initialize()
{ {

View File

@ -6,7 +6,7 @@ module hulk.pit;
import hulk.cpu; import hulk.cpu;
import hulk.klog; import hulk.klog;
struct pit struct Pit
{ {
/** PIT input frequency in 1/1000 Hz. */ /** PIT input frequency in 1/1000 Hz. */
private enum ulong PIT_FREQUENCY_1000HZ = 1_193_181_667u; private enum ulong PIT_FREQUENCY_1000HZ = 1_193_181_667u;
@ -37,6 +37,6 @@ struct pit
public static void isr() public static void isr()
{ {
klog.writefln("PIT ISR"); Klog.writefln("PIT ISR");
} }
} }

View File

@ -6,7 +6,7 @@ module hulk.rtc;
import hulk.cpu; import hulk.cpu;
import hulk.klog; import hulk.klog;
struct rtc struct Rtc
{ {
private enum ubyte PORT_SELECT = 0x70u; private enum ubyte PORT_SELECT = 0x70u;
private enum ubyte PORT_DATA = 0x71u; private enum ubyte PORT_DATA = 0x71u;
@ -53,7 +53,7 @@ struct rtc
/* Read the current system time. */ /* Read the current system time. */
time t = read_rtc_time(); time t = read_rtc_time();
klog.writefln("System time is 20%02u-%02u-%02u %02u:%02u:%02u", Klog.writefln("System time is 20%02u-%02u-%02u %02u:%02u:%02u",
t.year, t.month, t.day, t.hour, t.minute, t.second); t.year, t.month, t.day, t.hour, t.minute, t.second);
/* Send EOI to enable more RTC interrupts and re-enable NMIs. */ /* Send EOI to enable more RTC interrupts and re-enable NMIs. */
@ -86,7 +86,7 @@ struct rtc
if ((count % 1024) == 0u) if ((count % 1024) == 0u)
{ {
seconds++; seconds++;
klog.writefln("Seconds: %u", seconds); Klog.writefln("Seconds: %u", seconds);
} }
eoi(); eoi();
} }