Move to std.log

Removed nothing to pass tests


Removed log imports

Plus some spelling
This commit is contained in:
DrDeano 2020-07-23 20:47:56 +01:00
parent 387d02f439
commit fbd135c437
No known key found for this signature in database
GPG key ID: 96188600582B9ED7
23 changed files with 119 additions and 193 deletions

View file

@ -17,7 +17,6 @@ const vga = @import("vga.zig");
const mem = @import("../../mem.zig");
const multiboot = @import("multiboot.zig");
const vmm = @import("../../vmm.zig");
const log = @import("../../log.zig");
const Serial = @import("../../serial.zig").Serial;
const panic = @import("../../panic.zig").panic;
const TTY = @import("../../tty.zig").TTY;
@ -325,16 +324,16 @@ pub fn initTTY(boot_payload: BootPayload) TTY {
/// Allocator.Error.OutOfMemory - There wasn't enough memory in the allocated created to populate the memory profile, consider increasing mem.FIXED_ALLOC_SIZE
///
pub fn initMem(mb_info: BootPayload) Allocator.Error!MemProfile {
log.logInfo("Init mem\n", .{});
defer log.logInfo("Done mem\n", .{});
std.log.info(.arch_x86, "Init\n", .{});
defer std.log.info(.arch_x86, "Done\n", .{});
log.logDebug("KERNEL_ADDR_OFFSET: 0x{X}\n", .{@ptrToInt(&KERNEL_ADDR_OFFSET)});
log.logDebug("KERNEL_STACK_START: 0x{X}\n", .{@ptrToInt(&KERNEL_STACK_START)});
log.logDebug("KERNEL_STACK_END: 0x{X}\n", .{@ptrToInt(&KERNEL_STACK_END)});
log.logDebug("KERNEL_VADDR_START: 0x{X}\n", .{@ptrToInt(&KERNEL_VADDR_START)});
log.logDebug("KERNEL_VADDR_END: 0x{X}\n", .{@ptrToInt(&KERNEL_VADDR_END)});
log.logDebug("KERNEL_PHYSADDR_START: 0x{X}\n", .{@ptrToInt(&KERNEL_PHYSADDR_START)});
log.logDebug("KERNEL_PHYSADDR_END: 0x{X}\n", .{@ptrToInt(&KERNEL_PHYSADDR_END)});
std.log.debug(.arch_x86, "KERNEL_ADDR_OFFSET: 0x{X}\n", .{@ptrToInt(&KERNEL_ADDR_OFFSET)});
std.log.debug(.arch_x86, "KERNEL_STACK_START: 0x{X}\n", .{@ptrToInt(&KERNEL_STACK_START)});
std.log.debug(.arch_x86, "KERNEL_STACK_END: 0x{X}\n", .{@ptrToInt(&KERNEL_STACK_END)});
std.log.debug(.arch_x86, "KERNEL_VADDR_START: 0x{X}\n", .{@ptrToInt(&KERNEL_VADDR_START)});
std.log.debug(.arch_x86, "KERNEL_VADDR_END: 0x{X}\n", .{@ptrToInt(&KERNEL_VADDR_END)});
std.log.debug(.arch_x86, "KERNEL_PHYSADDR_START: 0x{X}\n", .{@ptrToInt(&KERNEL_PHYSADDR_START)});
std.log.debug(.arch_x86, "KERNEL_PHYSADDR_END: 0x{X}\n", .{@ptrToInt(&KERNEL_PHYSADDR_END)});
const mods_count = mb_info.mods_count;
mem.ADDR_OFFSET = @ptrToInt(&KERNEL_ADDR_OFFSET);

View file

@ -7,7 +7,6 @@ const panic = @import("../../panic.zig").panic;
const build_options = @import("build_options");
const mock_path = build_options.arch_mock_path;
const arch = if (is_test) @import(mock_path ++ "arch_mock.zig") else @import("arch.zig");
const log = if (is_test) @import(mock_path ++ "log_mock.zig") else @import("../../log.zig");
/// The access bits for a GDT entry.
const AccessBits = packed struct {
@ -406,8 +405,8 @@ fn makeGdtEntry(base: u32, limit: u20, access: AccessBits, flags: FlagBits) GdtE
/// Initialise the Global Descriptor table.
///
pub fn init() void {
log.logInfo("Init gdt\n", .{});
defer log.logInfo("Done gdt\n", .{});
std.log.info(.gdt, "Init\n", .{});
defer std.log.info(.gdt, "Done\n", .{});
// Initiate TSS
gdt_entries[TSS_INDEX] = makeGdtEntry(@ptrToInt(&main_tss_entry), @sizeOf(Tss) - 1, TSS_SEGMENT, NULL_FLAGS);
@ -568,7 +567,7 @@ fn rt_loadedGDTSuccess() void {
if (gdt_ptr.base != loaded_gdt.base) {
panic(@errorReturnTrace(), "FAILURE: GDT not loaded properly: 0x{X} != {X}\n", .{ gdt_ptr.base, loaded_gdt.base });
}
log.logInfo("GDT: Tested loading GDT\n", .{});
std.log.info(.gdt, "Tested loading GDT\n", .{});
}
///

View file

@ -9,7 +9,6 @@ const build_options = @import("build_options");
const mock_path = build_options.arch_mock_path;
const gdt = if (is_test) @import(mock_path ++ "gdt_mock.zig") else @import("gdt.zig");
const arch = if (is_test) @import(mock_path ++ "arch_mock.zig") else @import("arch.zig");
const log = if (is_test) @import(mock_path ++ "log_mock.zig") else @import("../../log.zig");
/// The structure that contains all the information that each IDT entry needs.
pub const IdtEntry = packed struct {
@ -179,8 +178,8 @@ pub fn openInterruptGate(index: u8, handler: InterruptHandler) IdtError!void {
/// Initialise the Interrupt descriptor table
///
pub fn init() void {
log.logInfo("Init idt\n", .{});
defer log.logInfo("Done idt\n", .{});
std.log.info(.idt, "Init\n", .{});
defer std.log.info(.idt, "Done\n", .{});
idt_ptr.base = @ptrToInt(&idt_entries);
@ -334,7 +333,7 @@ fn rt_loadedIDTSuccess() void {
if (idt_ptr.base != loaded_idt.base) {
panic(@errorReturnTrace(), "FAILURE: IDT not loaded properly: 0x{X} != {X}\n", .{ idt_ptr.base, loaded_idt.base });
}
log.logInfo("IDT: Tested loading IDT\n", .{});
std.log.info(.idt, " Tested loading IDT\n", .{});
}
///

View file

@ -9,7 +9,6 @@ const panic = @import("../../panic.zig").panic;
const mock_path = build_options.arch_mock_path;
const idt = if (is_test) @import(mock_path ++ "idt_mock.zig") else @import("idt.zig");
const arch = if (is_test) @import(mock_path ++ "arch_mock.zig") else @import("arch.zig");
const log = if (is_test) @import(mock_path ++ "log_mock.zig") else @import("../../log.zig");
const pic = if (is_test) @import(mock_path ++ "pic_mock.zig") else @import("pic.zig");
const interrupts = @import("interrupts.zig");
@ -131,8 +130,8 @@ pub fn registerIrq(irq_num: u8, handler: IrqHandler) IrqError!void {
/// the IDT interrupt gates for each IRQ.
///
pub fn init() void {
log.logInfo("Init irq\n", .{});
defer log.logInfo("Done irq\n", .{});
std.log.info(.irq, "Init\n", .{});
defer std.log.info(.irq, "Done\n", .{});
comptime var i = IRQ_OFFSET;
inline while (i < IRQ_OFFSET + 16) : (i += 1) {
@ -247,7 +246,7 @@ fn rt_unregisteredHandlers() void {
}
}
log.logInfo("IRQ: Tested registered handlers\n", .{});
std.log.info(.irq, "Tested registered handlers\n", .{});
}
///
@ -265,7 +264,7 @@ fn rt_openedIdtEntries() void {
}
}
log.logInfo("IRQ: Tested opened IDT entries\n", .{});
std.log.info(.irq, "Tested opened IDT entries\n", .{});
}
///

View file

@ -10,7 +10,6 @@ const syscalls = @import("syscalls.zig");
const panic = if (is_test) @import(mock_path ++ "panic_mock.zig").panic else @import("../../panic.zig").panic;
const idt = if (is_test) @import(mock_path ++ "idt_mock.zig") else @import("idt.zig");
const arch = if (is_test) @import(mock_path ++ "arch_mock.zig") else @import("arch.zig");
const log = if (is_test) @import(mock_path ++ "log_mock.zig") else @import("../../log.zig");
const interrupts = @import("interrupts.zig");
/// The error set for the ISR. This will be from installing a ISR handler.
@ -159,7 +158,7 @@ export fn isrHandler(ctx: *arch.CpuState) usize {
// Regular ISR exception, if there is one registered.
ret_esp = handler(ctx);
} else {
log.logInfo("State: {X}\n", .{ctx});
std.log.info(.isr, "State: {X}\n", .{ctx});
panic(@errorReturnTrace(), "ISR {} ({}) triggered with error code 0x{X} but not registered\n", .{ exception_msg[isr_num], isr_num, ctx.error_code });
}
}
@ -238,8 +237,8 @@ pub fn registerIsr(isr_num: u16, handler: IsrHandler) IsrError!void {
/// Initialise the exception and opening up all the IDT interrupt gates for each exception.
///
pub fn init() void {
log.logInfo("Init isr\n", .{});
defer log.logInfo("Done isr\n", .{});
std.log.info(.isr, "Init\n", .{});
defer std.log.info(.isr, "Done\n", .{});
comptime var i = 0;
inline while (i < 32) : (i += 1) {
@ -385,7 +384,7 @@ fn rt_unregisteredHandlers() void {
panic(@errorReturnTrace(), "FAILURE: Pre-testing failed for syscall: {}\n", .{h});
}
log.logInfo("ISR: Tested registered handlers\n", .{});
std.log.info(.isr, "Tested registered handlers\n", .{});
}
///
@ -403,7 +402,7 @@ fn rt_openedIdtEntries() void {
}
}
log.logInfo("ISR: Tested opened IDT entries\n", .{});
std.log.info(.isr, "Tested opened IDT entries\n", .{});
}
///

View file

@ -11,7 +11,6 @@ const arch = if (is_test) @import(mock_path ++ "arch_mock.zig") else @import("ar
const isr = @import("isr.zig");
const MemProfile = @import("../../mem.zig").MemProfile;
const tty = @import("../../tty.zig");
const log = @import("../../log.zig");
const mem = @import("../../mem.zig");
const vmm = @import("../../vmm.zig");
const multiboot = @import("multiboot.zig");
@ -366,7 +365,7 @@ pub fn unmap(virtual_start: usize, virtual_end: usize, dir: *Directory) (std.mem
/// IN state: *arch.CpuState - The CPU's state when the fault occurred.
///
fn pageFault(state: *arch.CpuState) u32 {
log.logInfo("State: {X}\n", .{state});
std.log.info(.paging, "State: {X}\n", .{state});
var cr0 = asm volatile ("mov %%cr0, %[cr0]"
: [cr0] "=r" (-> u32)
);
@ -379,7 +378,7 @@ fn pageFault(state: *arch.CpuState) u32 {
var cr4 = asm volatile ("mov %%cr4, %[cr4]"
: [cr4] "=r" (-> u32)
);
log.logInfo("CR0: 0x{X}, CR2: 0x{X}, CR3: 0x{X}, CR4: 0x{X}\n", .{ cr0, cr2, cr3, cr4 });
std.log.info(.paging, "CR0: 0x{X}, CR2: 0x{X}, CR3: 0x{X}, CR4: 0x{X}\n", .{ cr0, cr2, cr3, cr4 });
@panic("Page fault");
}
@ -391,8 +390,8 @@ fn pageFault(state: *arch.CpuState) u32 {
/// IN allocator: *std.mem.Allocator - The allocator to use
///
pub fn init(mb_info: *multiboot.multiboot_info_t, mem_profile: *const MemProfile, allocator: *std.mem.Allocator) void {
log.logInfo("Init paging\n", .{});
defer log.logInfo("Done paging\n", .{});
std.log.info(.paging, "Init\n", .{});
defer std.log.info(.paging, "Done\n", .{});
isr.registerIsr(isr.PAGE_FAULT, if (build_options.test_mode == .Initialisation) rt_pageFault else pageFault) catch |e| {
panic(@errorReturnTrace(), "Failed to register page fault ISR: {}\n", .{e});
@ -564,7 +563,7 @@ fn rt_accessUnmappedMem(v_end: u32) void {
var ptr = @intToPtr(*u8, v_end);
var value = ptr.*;
// Need this as in release builds the above is optimised out so it needs to be use
log.logError("FAILURE: Value: {}\n", .{value});
std.log.emerg(.paging, "FAILURE: Value: {}\n", .{value});
// This is the label that we return to after processing the page fault
asm volatile (
\\.global rt_fault_callback
@ -573,7 +572,7 @@ fn rt_accessUnmappedMem(v_end: u32) void {
if (!faulted) {
panic(@errorReturnTrace(), "FAILURE: Paging should have faulted\n", .{});
}
log.logInfo("Paging: Tested accessing unmapped memory\n", .{});
std.log.info(.paging, "Tested accessing unmapped memory\n", .{});
}
fn rt_accessMappedMem(v_end: u32) void {
@ -589,7 +588,7 @@ fn rt_accessMappedMem(v_end: u32) void {
if (faulted) {
panic(@errorReturnTrace(), "FAILURE: Paging shouldn't have faulted\n", .{});
}
log.logInfo("Paging: Tested accessing mapped memory\n", .{});
std.log.info(.paging, "Tested accessing mapped memory\n", .{});
}
pub fn runtimeTests(v_end: u32) void {

View file

@ -6,7 +6,6 @@ const is_test = builtin.is_test;
const build_options = @import("build_options");
const mock_path = build_options.arch_mock_path;
const arch = if (is_test) @import(mock_path ++ "arch_mock.zig") else @import("arch.zig");
const log = if (is_test) @import(mock_path ++ "log_mock.zig") else @import("../../log.zig");
const panic = if (is_test) @import(mock_path ++ "panic_mock.zig").panic else @import("../../panic.zig").panic;
// ----------
@ -432,8 +431,8 @@ pub fn clearMask(irq_num: u8) void {
/// by Intel up to 0x1F. So this will move the IRQs from 0x00-0x0F to 0x20-0x2F.
///
pub fn init() void {
log.logInfo("Init pic\n", .{});
defer log.logInfo("Done pic\n", .{});
std.log.info(.pic, "Init\n", .{});
defer std.log.info(.pic, "Done\n", .{});
// Initiate
sendCommandMaster(ICW1_INITIALISATION | ICW1_EXPECT_ICW4);
@ -824,7 +823,7 @@ fn rt_picAllMasked() void {
panic(@errorReturnTrace(), "FAILURE: Slave masks are not set, found: {}\n", .{readDataSlave()});
}
log.logInfo("PIC: Tested masking\n", .{});
std.log.info(.pic, "Tested masking\n", .{});
}
///

View file

@ -11,7 +11,6 @@ const arch = if (is_test) @import(mock_path ++ "arch_mock.zig") else @import("ar
const panic = if (is_test) @import(mock_path ++ "panic_mock.zig").panic else @import("../../panic.zig").panic;
const irq = @import("irq.zig");
const pic = @import("pic.zig");
const log = @import("../../log.zig");
/// The enum for selecting the counter
const CounterSelect = enum {
@ -363,8 +362,8 @@ pub fn getFrequency() u32 {
/// Initialise the PIT with a handler to IRQ 0.
///
pub fn init() void {
log.logInfo("Init pit\n", .{});
defer log.logInfo("Done pit\n", .{});
std.log.info(.pit, "Init\n", .{});
defer std.log.info(.pit, "Done\n", .{});
// Set up counter 0 at 10000hz in a square wave mode counting in binary
const freq: u32 = 10000;
@ -372,7 +371,7 @@ pub fn init() void {
panic(@errorReturnTrace(), "Invalid frequency: {}\n", .{freq});
};
log.logDebug("Set frequency at: {}Hz, real frequency: {}Hz\n", .{ freq, getFrequency() });
std.log.debug(.pit, "Set frequency at: {}Hz, real frequency: {}Hz\n", .{ freq, getFrequency() });
// Installs 'pitHandler' to IRQ0 (pic.IRQ_PIT)
irq.registerIrq(pic.IRQ_PIT, pitHandler) catch |err| switch (err) {
@ -550,7 +549,7 @@ fn rt_waitTicks() void {
panic(@errorReturnTrace(), "FAILURE: Waiting failed. difference: {}, previous_count: {}. Epsilon: {}\n", .{ difference, previous_count, epsilon });
}
log.logInfo("PIT: Tested wait ticks\n", .{});
std.log.info(.pit, "Tested wait ticks\n", .{});
}
///
@ -577,7 +576,7 @@ fn rt_waitTicks2() void {
// Reset ticks
ticks = 0;
log.logInfo("PIT: Tested wait ticks 2\n", .{});
std.log.info(.pit, "Tested wait ticks 2\n", .{});
}
///
@ -622,7 +621,7 @@ fn rt_initCounter_0() void {
panic(@errorReturnTrace(), "FAILURE: Operating mode don't not set properly. Found: {}, expecting: {}\n", .{ actual_mode, expected_mode });
}
log.logInfo("PIT: Tested init\n", .{});
std.log.info(.pit, "Tested init\n", .{});
}
///

View file

@ -7,7 +7,6 @@ const expectError = std.testing.expectError;
const build_options = @import("build_options");
const mock_path = build_options.arch_mock_path;
const arch = if (is_test) @import(mock_path ++ "arch_mock.zig") else @import("arch.zig");
const log = @import("../../log.zig");
const pic = @import("pic.zig");
const pit = @import("pit.zig");
const irq = @import("irq.zig");
@ -266,8 +265,8 @@ fn enableInterrupts() void {
/// Initialise the RTC.
///
pub fn init() void {
log.logInfo("Init rtc\n", .{});
defer log.logInfo("Done rtc\n", .{});
std.log.info(.rtc, "Init\n", .{});
defer std.log.info(.rtc, "Done\n", .{});
// Register the interrupt handler
irq.registerIrq(pic.IRQ_REAL_TIME_CLOCK, rtcHandler) catch |err| switch (err) {
@ -727,7 +726,7 @@ fn rt_init() void {
panic(@errorReturnTrace(), "FAILURE: Interrupts not enabled\n", .{});
}
log.logInfo("RTC: Tested init\n", .{});
std.log.info(.rtc, "Tested init\n", .{});
}
///
@ -742,7 +741,7 @@ fn rt_interrupts() void {
panic(@errorReturnTrace(), "FAILURE: No interrupt happened\n", .{});
}
log.logInfo("RTC: Tested interrupts\n", .{});
std.log.info(.rtc, "Tested interrupts\n", .{});
}
///

View file

@ -7,7 +7,6 @@ const arch = if (is_test) @import(mock_path ++ "arch_mock.zig") else @import("ar
const testing = std.testing;
const expect = std.testing.expect;
const isr = @import("isr.zig");
const log = @import("../../log.zig");
const panic = @import("../../panic.zig").panic;
/// The isr number associated with syscalls
@ -58,10 +57,10 @@ fn handle(ctx: *arch.CpuState) u32 {
if (handlers[syscall]) |handler| {
ctx.eax = handler(ctx, syscallArg(ctx, 0), syscallArg(ctx, 1), syscallArg(ctx, 2), syscallArg(ctx, 3), syscallArg(ctx, 4));
} else {
log.logWarning("Syscall {} triggered but not registered\n", .{syscall});
std.log.warn(.syscall, "Syscall {} triggered but not registered\n", .{syscall});
}
} else {
log.logWarning("Syscall {} is invalid\n", .{syscall});
std.log.warn(.syscall, "Syscall {} is invalid\n", .{syscall});
}
return @ptrToInt(ctx);
}
@ -243,8 +242,8 @@ inline fn syscallArg(ctx: *arch.CpuState, comptime arg_idx: u32) u32 {
/// Initialise syscalls. Registers the isr associated with INTERRUPT.
///
pub fn init() void {
log.logInfo("Init syscalls\n", .{});
defer log.logInfo("Done syscalls\n", .{});
std.log.info(.syscall, "Init\n", .{});
defer std.log.info(.syscall, "Done\n", .{});
isr.registerIsr(INTERRUPT, handle) catch unreachable;
@ -331,5 +330,5 @@ fn runtimeTests() void {
panic(@errorReturnTrace(), "FAILURE syscall5\n", .{});
}
log.logInfo("Syscall: Tested all args\n", .{});
std.log.info(.syscall, "Tested all args\n", .{});
}

View file

@ -8,7 +8,6 @@ const expectError = std.testing.expectError;
const build_options = @import("build_options");
const mock_path = build_options.mock_path;
const vga = if (is_test) @import("../../" ++ mock_path ++ "vga_mock.zig") else @import("vga.zig");
const log = if (is_test) @import("../../" ++ mock_path ++ "log_mock.zig") else @import("../../log.zig");
const panic = if (is_test) @import("../../" ++ mock_path ++ "panic_mock.zig").panic else @import("../../panic.zig").panic;
/// The error set for if there is an error whiles printing.
@ -381,7 +380,7 @@ pub fn pageUp() void {
page_index += 1;
// Bounds have been checked, so shouldn't error
videoCopy(START_OF_DISPLAYABLE_REGION, pages[page_index][0..TOTAL_CHAR_ON_PAGE], TOTAL_CHAR_ON_PAGE) catch |e| {
log.logError("TTY: Error moving page up. Error: {}\n", .{e});
std.log.crit(.tty, "Error moving page up. Error: {}\n", .{e});
};
vga.disableCursor();
}
@ -397,7 +396,7 @@ pub fn pageDown() void {
page_index -= 1;
// Bounds have been checked, so shouldn't error
videoCopy(START_OF_DISPLAYABLE_REGION, pages[page_index][0..TOTAL_CHAR_ON_PAGE], TOTAL_CHAR_ON_PAGE) catch |e| {
log.logError("TTY: Error moving page down. Error: {}\n", .{e});
std.log.crit(.tty, "Error moving page down. Error: {}\n", .{e});
};
if (page_index == 0) {
@ -417,7 +416,7 @@ pub fn clearScreen() void {
// Move all the rows up
// This is within bounds, so shouldn't error
pagesMoveRowsUp(ROW_TOTAL) catch |e| {
log.logError("TTY: Error moving all pages up. Error: {}\n", .{e});
std.log.crit(.tty, "Error moving all pages up. Error: {}\n", .{e});
};
// Clear the screen
@ -536,13 +535,13 @@ pub fn init() void {
// Set the top 7 rows blank
setVideoBuffer(blank, START_OF_DISPLAYABLE_REGION) catch |e| {
log.logError("TTY: Error clearing the top 7 rows. Error: {}\n", .{e});
std.log.crit(.tty, "Error clearing the top 7 rows. Error: {}\n", .{e});
};
row += @truncate(u8, row_offset + ROW_MIN);
} else {
// Clear the screen
setVideoBuffer(blank, VIDEO_BUFFER_SIZE) catch |e| {
log.logError("TTY: Error clearing the screen. Error: {}\n", .{e});
std.log.crit(.tty, "Error clearing the screen. Error: {}\n", .{e});
};
// Set the row to below the logo
row = ROW_MIN;
@ -901,7 +900,7 @@ test "putEntryAt in displayable region page_index is not 0" {
column = @truncate(u8, vga.WIDTH) - @truncate(u8, text.len);
row = ROW_MIN - 1;
writeString(text) catch |e| {
log.logError("TTY: Unable to print page number, printing out of bounds. Error: {}\n", .{e});
std.log.crit(.tty, "Unable to print page number, printing out of bounds. Error: {}\n", .{e});
};
column = column_temp;
row = row_temp;
@ -1559,7 +1558,7 @@ test "pageUp bottom page" {
column = @truncate(u8, vga.WIDTH) - @truncate(u8, text.len);
row = ROW_MIN - 1;
writeString(text) catch |e| {
log.logError("TTY: Unable to print page number, printing out of bounds. Error: {}\n", .{e});
std.log.crit(.tty, "Unable to print page number, printing out of bounds. Error: {}\n", .{e});
};
column = column_temp;
row = row_temp;
@ -1639,7 +1638,7 @@ test "pageDown top page" {
column = @truncate(u8, vga.WIDTH) - @truncate(u8, text.len);
row = ROW_MIN - 1;
writeString(text) catch |e| {
log.logError("TTY: Unable to print page number, printing out of bounds. Error: {}\n", .{e});
std.log.crit(.tty, "Unable to print page number, printing out of bounds. Error: {}\n", .{e});
};
column = column_temp;
row = row_temp;
@ -2045,7 +2044,7 @@ fn rt_initialisedGlobals() void {
panic(@errorReturnTrace(), "Screen all blank, should have logo and page number\n", .{});
}
log.logInfo("TTY: Tested globals\n", .{});
std.log.info(.tty, "Tested globals\n", .{});
}
///
@ -2097,7 +2096,7 @@ fn rt_printString() void {
// Clear the text
writeString(clear_text) catch |e| panic(@errorReturnTrace(), "Failed to print string to tty: {}\n", .{e});
log.logInfo("TTY: Tested printing\n", .{});
std.log.info(.tty, "Tested printing\n", .{});
}
///

View file

@ -4,7 +4,6 @@ const is_test = builtin.is_test;
const expectEqual = std.testing.expectEqual;
const build_options = @import("build_options");
const arch = if (is_test) @import(build_options.arch_mock_path ++ "arch_mock.zig") else @import("arch.zig");
const log = if (is_test) @import(build_options.arch_mock_path ++ "log_mock.zig") else @import("../../log.zig");
const panic = @import("../../panic.zig").panic;
/// The port address for the VGA register selection.
@ -284,8 +283,8 @@ pub fn setCursorShape(shape: CursorShape) void {
/// Initialise the VGA text mode. This sets the cursor and underline shape.
///
pub fn init() void {
log.logInfo("Init vga\n", .{});
defer log.logInfo("Done vga\n", .{});
std.log.info(.vga, "Init\n", .{});
defer std.log.info(.vga, "Done\n", .{});
// Set the maximum scan line to 0x0F
sendPortData(REG_MAXIMUM_SCAN_LINE, CURSOR_SCANLINE_END);
@ -537,7 +536,7 @@ fn rt_correctMaxScanLine() void {
panic(@errorReturnTrace(), "FAILURE: Max scan line not {}, found {}\n", .{ CURSOR_SCANLINE_END, max_scan_line });
}
log.logInfo("VGA: Tested max scan line\n", .{});
std.log.info(.vga, "Tested max scan line\n", .{});
}
///
@ -556,7 +555,7 @@ fn rt_correctCursorShape() void {
panic(@errorReturnTrace(), "FAILURE: Cursor scanline are incorrect. Start: {}, end: {}\n", .{ cursor_start, cursor_end });
}
log.logInfo("VGA: Tested cursor shape\n", .{});
std.log.info(.vga, "Tested cursor shape\n", .{});
}
///
@ -588,7 +587,7 @@ fn rt_setCursorGetCursor() void {
// Restore the previous x and y
updateCursor(prev_x_loc, prev_y_loc);
log.logInfo("VGA: Tested updating cursor\n", .{});
std.log.info(.vga, "Tested updating cursor\n", .{});
}
///