summaryrefslogtreecommitdiff
path: root/kernel/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/src/main.rs')
-rw-r--r--kernel/src/main.rs32
1 files changed, 4 insertions, 28 deletions
diff --git a/kernel/src/main.rs b/kernel/src/main.rs
index ae78c93..bb1dcec 100644
--- a/kernel/src/main.rs
+++ b/kernel/src/main.rs
@@ -3,8 +3,7 @@
#![feature(custom_test_frameworks)]
#![feature(abi_x86_interrupt)]
#![feature(panic_info_message)]
-#![test_runner(crate::testing::serial_test_runner)]
-#![reexport_test_harness_main = "test_main"]
+#![test_runner(crate::testing::test_runner)]
#![no_std]
pub mod interrupts;
@@ -16,43 +15,20 @@ pub use io::qemu::{exit_qemu, QemuExitCode};
pub use io::vga_text::OStream;
pub use io::{qemu, serial, vga_text};
-#[cfg(not(test))]
#[no_mangle]
extern "C" fn _start() -> ! {
- interrupts::gdt::init();
- interrupts::table::init();
+ kernel::init();
if cfg!(test) {
- #[cfg(test)]
- test_main();
qemu::exit_qemu(qemu::QemuExitCode::Success);
}
-
- x86_64::instructions::interrupts::int3();
-
- /// TODO: write test
- ///fn _loop(i: u64) -> u64 {
- /// if i > 0b1010101001101101 {
- /// return i;
- /// }
- /// let n = i;
- /// let mut stdout = OStream::new();
- /// write!(&mut stdout, "{:x}", &n as *const u64 as u64).unwrap();
- /// _loop(i + 1)
- ///}
- ///_loop(0);
- /// TODO: write test
- ///x86_64::instructions::interrupts::int3();
loop {}
}
#[panic_handler]
#[no_mangle]
extern "C" fn panic_handler(info: &core::panic::PanicInfo) -> ! {
- io::panic_screen::show(info.message());
-
if cfg!(test) {
- write!(serial::SerialStream::new(), "Testing failed\n").unwrap();
- qemu::exit_qemu(qemu::QemuExitCode::Failed);
+ testing::serial_panic(info);
}
- loop {}
+ testing::panic(info);
}