diff --git a/core/src/arch/x86_64/platform.zig b/core/src/arch/x86_64/platform.zig index 0aee444..f46d171 100644 --- a/core/src/arch/x86_64/platform.zig +++ b/core/src/arch/x86_64/platform.zig @@ -15,4 +15,5 @@ pub fn platformInit() void { pub fn platformEndInit() void { pic.remapPIC(); interrupts.syncInterrupts(); + interrupts.enableInterrupts(); } diff --git a/core/src/main.zig b/core/src/main.zig index 5fb71db..b1354c6 100644 --- a/core/src/main.zig +++ b/core/src/main.zig @@ -10,6 +10,8 @@ const pmm = @import("pmm.zig"); const MultibootInfo = [*c]u8; export fn _start(magic: u32, info: MultibootInfo) callconv(.C) noreturn { + interrupts.disableInterrupts(); + if (magic != easyboot.MULTIBOOT2_BOOTLOADER_MAGIC) { debug.print("Invalid magic number: {x}\n", .{magic}); while (true) {} @@ -19,14 +21,10 @@ export fn _start(magic: u32, info: MultibootInfo) callconv(.C) noreturn { multiboot.parseMultibootTags(@ptrCast(info)); - interrupts.disableInterrupts(); platform.platformInit(); debug.print("GDT initialized\n", .{}); - platform.platformEndInit(); - interrupts.enableInterrupts(); - if (multiboot.findMultibootTag(easyboot.multiboot_tag_mmap_t, @ptrCast(info))) |tag| { var allocator = pmm.initializeFrameAllocator(tag) catch |err| { debug.print("Error while initializing frame allocator: {}\n", .{err}); @@ -44,6 +42,8 @@ export fn _start(magic: u32, info: MultibootInfo) callconv(.C) noreturn { debug.print("No memory map multiboot tag found!\n", .{}); } + platform.platformEndInit(); + asm volatile ("int3"); while (true) {}