aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatasha Moongrave <natasha@256phi.eu>2026-03-30 11:14:17 +0200
committerNatasha Moongrave <natasha@256phi.eu>2026-03-30 11:14:17 +0200
commit2f461e24d0f478405b24d2a08b1b1084ebacdff2 (patch)
tree11bfe158e97d0ccb5e085f7dff02ebe6e3dc92d0
parente61ddcf9141132fe4ab0ef6b8600ecde591886b3 (diff)
fixed up lib.rs to use the proper kernel_main and test_kernel_main entry point
-rw-r--r--StrixKernel/src/lib.rs37
1 files changed, 20 insertions, 17 deletions
diff --git a/StrixKernel/src/lib.rs b/StrixKernel/src/lib.rs
index 311c408..445ee70 100644
--- a/StrixKernel/src/lib.rs
+++ b/StrixKernel/src/lib.rs
@@ -7,30 +7,22 @@
use core::panic::PanicInfo;
+pub mod gdt;
+pub mod interrupts;
+pub mod memory;
pub mod serial;
pub mod vga_buffer;
-pub mod interrupts;
-pub mod gdt;
-
-pub trait Testable {
- fn run(&self) -> ();
-}
pub fn init() {
gdt::init();
interrupts::init_idt();
- unsafe { interrupts::PICS.lock().initialize() };
+ unsafe { interrupts::PICS.lock().initialize() };
x86_64::instructions::interrupts::enable();
}
-
-pub fn hlt_loop() -> ! {
- loop {
- x86_64::instructions::hlt();
- }
+pub trait Testable {
+ fn run(&self) -> ();
}
-// TEST HANDLING
-
impl<T> Testable for T
where
T: Fn(),
@@ -73,10 +65,21 @@ pub fn exit_qemu(exit_code: QemuExitCode) {
}
}
+pub fn hlt_loop() -> ! {
+ loop {
+ x86_64::instructions::hlt();
+ }
+}
+
+#[cfg(test)]
+use bootloader::{BootInfo, entry_point};
+
+#[cfg(test)]
+entry_point!(test_kernel_main);
+
/// Entry point for `cargo xtest`
#[cfg(test)]
-#[unsafe(no_mangle)]
-pub extern "C" fn _start() -> ! {
+fn test_kernel_main(_boot_info: &'static BootInfo) -> ! {
init();
test_main();
hlt_loop();
@@ -86,4 +89,4 @@ pub extern "C" fn _start() -> ! {
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
test_panic_handler(info)
-}
+} \ No newline at end of file