Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/kernel/arch/x86/arch.zig
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,13 @@ fn writeSerialCom1(byte: u8) void {
///
/// Initialise serial communication using port COM1 and construct a Serial instance
///
/// Arguments:
/// IN boot_payload: arch.BootPayload - The payload passed at boot. Not currently used by x86
///
/// Return: serial.Serial
/// The Serial instance constructed with the function used to write bytes
///
pub fn initSerial() Serial {
pub fn initSerial(boot_payload: BootPayload) Serial {
serial.init(serial.DEFAULT_BAUDRATE, serial.Port.COM1) catch |e| {
panic(@errorReturnTrace(), "Failed to initialise serial: {}", .{e});
};
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/kmain.zig
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn
}

export fn kmain(boot_payload: arch.BootPayload) void {
const serial_stream = serial.init();
const serial_stream = serial.init(boot_payload);

log.init(serial_stream);

Expand Down
7 changes: 5 additions & 2 deletions src/kernel/serial.zig
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ pub const Serial = struct {
///
/// Initialise the serial interface. The details of how this is done depends on the architecture.
///
/// Arguments:
/// IN boot_payload: arch.BootPayload - The payload passed to the kernel at boot. How this is used depends on the architecture
///
/// Return: Serial
/// The serial interface constructed by the architecture
///
pub fn init() Serial {
const serial = arch.initSerial();
pub fn init(boot_payload: arch.BootPayload) Serial {
const serial = arch.initSerial(boot_payload);
if (build_options.rt_test) runtimeTests(serial);
return serial;
}
Expand Down
2 changes: 1 addition & 1 deletion test/mock/kernel/arch_mock.zig
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub fn haltNoInterrupts() noreturn {
while (true) {}
}

pub fn initSerial() Serial {
pub fn initSerial(boot_payload: BootPayload) Serial {
return .{ .write = undefined };
}

Expand Down