hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/boot/boot.zig
diff options
context:
space:
mode:
Diffstat (limited to 'boot/boot.zig')
-rw-r--r--boot/boot.zig19
1 files changed, 18 insertions, 1 deletions
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;