diff options
| author | Tianhao Wang <wth@riseup.net> | 2024-02-01 05:18:20 +0100 |
|---|---|---|
| committer | Tianhao Wang <wth@riseup.net> | 2024-02-01 05:18:25 +0100 |
| commit | f8c1ef0109a8177cf4747a891e6c462c4ef59c92 (patch) | |
| tree | 1d608c0b41b98304973e1d53bc82be848d83d022 /src/lib.rs | |
| parent | 2bdafab229439dcd9968114ab232ed0a3a218bfb (diff) | |
add println! and panic! macro
The rust lazy_static requires interior mutability. I have to include a
Mutex impl (spin::Mutex). But I'd like to implement my own primitives.
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 26 |
1 files changed, 12 insertions, 14 deletions
@@ -1,31 +1,29 @@ #![allow(dead_code)] #![allow(unused_imports)] - #![no_std] #![no_main] mod arch; +mod io; mod machine; use core::panic::PanicInfo; use machine::cgascr::CGAScreen; +#[cfg(not(test))] #[panic_handler] -fn panic(_info: &PanicInfo) -> ! { +fn panic(info: &PanicInfo) -> ! { + println!("{}", info); loop {} } #[no_mangle] pub extern "C" fn _entry() -> ! { - let mut scr = CGAScreen::new(); - scr.show_coners(); - scr.setattr(0x1f); - scr.clear(); - scr.show_coners(); - - scr.print("--RuStuBs--\n"); - scr.print(" _._ _,-'\"\"`-._ ~Meow\n"); - scr.print(" (,-.`._,'( |\\`-/|\n"); - scr.print(" `-.-' \\ )-`( , o o)\n"); - scr.print(" `- \\`_`\"'-\n"); - scr.print("it works!\n"); + io::set_attr(0x1f); + io::clear(); + println!("--RuStuBs--"); + println!(" _._ _,-'\"\"`-._ ~Meow"); + println!(" (,-.`._,'( |\\`-/|"); + println!(" `-.-' \\ )-`( , o o)"); + println!(" `- \\`_`\"'-"); + println!("it works!"); loop {} } |
