diff options
| author | 2026-05-29 21:59:53 -0400 | |
|---|---|---|
| committer | 2026-05-29 22:04:38 -0400 | |
| commit | fe456c2014c8d1d88b7fd5b24ebda7f7b4c53460 (patch) | |
| tree | a1ae3682aede1ea7550f4be76a79118bd6502902 /src/main.zig | |
| download | quail-fe456c2014c8d1d88b7fd5b24ebda7f7b4c53460.tar.gz quail-fe456c2014c8d1d88b7fd5b24ebda7f7b4c53460.zip | |
basic physical memory page allocator
Signed-off-by: Matthew Wozniak <me@woz.blue>
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig new file mode 100644 index 0000000..7896a09 --- /dev/null +++ b/src/main.zig @@ -0,0 +1,39 @@ +const uart = @import("uart.zig"); +const mem = @import("mem.zig"); +const std = @import("std"); + +fn logFn( + comptime message_level: std.log.Level, + comptime scope: @EnumLiteral(), + comptime format: []const u8, + args: anytype, +) void { + return std.log.defaultLogFileTerminal( + message_level, + scope, + format, + args, + uart.terminal, + ) catch {}; +} + +pub const std_options: std.Options = .{ + .logFn = logFn, + .page_size_max = 4096, + .page_size_min = 4096, +}; + +pub const panic = std.debug.FullPanic(panicFn); + +fn panicFn(msg: []const u8, first_trace_addr: ?usize) noreturn { + std.log.err("kernel panic at {?}", .{first_trace_addr}); + std.log.err("{s}", .{msg}); + while (true) {} +} + +export fn kmain() callconv(.c) noreturn { + uart.init(0x1000_0000); + std.log.info("hello, world", .{}); + mem.init(); + while (true) {} +} |
