From 4f540af34d7a88547d60bed7bd28850e6d0e18ab Mon Sep 17 00:00:00 2001 From: hachem Date: Sat, 12 Sep 2026 04:08:33 +0200 Subject: feat: BAREEE METTALLLLLL REVOOOOO --- boot/boot.zig | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'boot/boot.zig') diff --git a/boot/boot.zig b/boot/boot.zig index 933065c..1f50d83 100644 --- a/boot/boot.zig +++ b/boot/boot.zig @@ -6,21 +6,32 @@ const gdt = @import("gdt.zig"); const idt = @import("idt.zig"); const pmm = @import("pmm.zig"); const heap = @import("heap.zig"); +const bridge = @import("bridge"); // We need a panic handler otherwise zig won't be happy, // std usually formats a message through std.Io.Writer which // emits SSE instructions which I haven't enabled. Ours // dumps the message to serial, then halts. pub const panic = std.debug.FullPanic(struct { - fn halt(msg: []const u8, _: ?usize) noreturn { + fn halt(msg: []const u8, ret_addr: ?usize) noreturn { serial.init(); serial.write("\r\n!!! uhhhh engine kaput : "); serial.write(msg); + if (ret_addr) |ra| { + serial.write("\r\n at "); + serial.writeHex(ra); + } serial.write("\r\n"); while (true) asm volatile ("hlt"); } }.halt); +// std.debug.print (revo hits it on a few error paths) defaults to a threaded +// stderr IO that doesn't exist on freestanding and won't even compile. This +// just points it to the custom one we wrote in bridge tthat uses the serial +// console and shit +pub const std_options_debug_io: std.Io = bridge.debug_io; + // Check `linker.ld` export var base_revision: limine.BaseRevision linksection(".limine_requests") = limine.BaseRevision.init(3); export var requests_start: limine.RequestsStartMarker linksection(".limine_requests_start") = .{}; @@ -31,6 +42,9 @@ export var requests_end: limine.RequestsEndMarker linksection(".limine_requests_ export var hhdm_request: limine.HhdmRequest linksection(".limine_requests") = .{}; export var memmap_request: limine.MemoryMapRequest linksection(".limine_requests") = .{}; +// 4 MiB stack +export var stack_size_request: limine.StackSizeRequest linksection(".limine_requests") = .{ .stack_size = 4 * 1024 * 1024 }; + // ENTRY(_start) export fn _start() callconv(.c) noreturn { serial.init(); @@ -70,6 +84,9 @@ export fn _start() callconv(.c) noreturn { pmm.free(b); pmm.free(c); + // hand the kernel heap to revo and we're gucci + bridge.run(heap.allocator(), serial.write); + if (framebuffer.get()) |screen| { // XOR texture var y: usize = 0; -- cgit v1.3