diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/arch/x86_64/interrupt/mod.rs | 4 | ||||
| -rw-r--r-- | src/io.rs | 10 | ||||
| -rw-r--r-- | src/lib.rs | 14 | ||||
| -rw-r--r-- | src/machine/interrupt.rs | 4 |
4 files changed, 18 insertions, 14 deletions
diff --git a/src/arch/x86_64/interrupt/mod.rs b/src/arch/x86_64/interrupt/mod.rs index ce87e89..d961480 100644 --- a/src/arch/x86_64/interrupt/mod.rs +++ b/src/arch/x86_64/interrupt/mod.rs @@ -84,9 +84,7 @@ pub fn interrupt_disable() { #[inline(always)] fn _idt_init() { - unsafe { - println!("[init] idt: vectors_start: 0x{:x}", vectors_start as usize); - } + println!("[init] idt: vectors_start: 0x{:x}", vectors_start as usize); let gate_descriptors: &mut [GateDescriptor64] = unsafe { slice::from_raw_parts_mut(idt as *mut GateDescriptor64, 256) }; @@ -27,10 +27,18 @@ pub fn _print(args: fmt::Arguments) { CGASCREEN_GLOBAL.lock().write_fmt(args).unwrap(); } -pub fn clear() { +pub fn clear_screen() { CGASCREEN_GLOBAL.lock().clear(); } pub fn set_attr(attr: u8) { CGASCREEN_GLOBAL.lock().setattr(attr); } + +pub fn print_welcome() { + println!("--RuStuBs--"); + println!(" _._ _,-'\"\"`-._ ~Meow"); + println!(" (,-.`._,'( |\\`-/|"); + println!(" `-.-' \\ )-`( , o o)"); + println!(" `- \\`_`\"'-"); +} @@ -27,27 +27,21 @@ fn panic(info: &PanicInfo) -> ! { pub extern "C" fn _entry() -> ! { // init code io::set_attr(0x1f); - io::clear(); + io::clear_screen(); interrupt::init(); pic_8259::allow(PicDeviceInt::KEYBOARD); interrupt::interrupt_enable(); - println!("--RuStuBs--"); - println!(" _._ _,-'\"\"`-._ ~Meow"); - println!(" (,-.`._,'( |\\`-/|"); - println!(" `-.-' \\ )-`( , o o)"); - println!(" `- \\`_`\"'-"); - // - // busy loop query keyboard + io::print_welcome(); let mut framemap = mm::pma::FMap::new(); framemap.init(); println!("Bitmap starting from : {:p}", framemap.bm.as_ptr()); println!("Skip first {} bytes", framemap.skip_byte); - use crate::machine::device_io::IOPort; + // busy loop query keyboard loop { io::KBCTL_GLOBAL.lock().fetch_key(); if let Some(k) = io::KBCTL_GLOBAL.lock().consume_key() { - println! {"caught key: {:?}", k} + println! {"key: {:?}", k} } } } diff --git a/src/machine/interrupt.rs b/src/machine/interrupt.rs index 1cd3234..c764eb4 100644 --- a/src/machine/interrupt.rs +++ b/src/machine/interrupt.rs @@ -1,2 +1,6 @@ +// a "machine" level interrupt controlling interface: so that the kernel could +// enable and disable the interrupt without differentiate the architectures +// currently not in use because we are not so complicated yet. Perhaps this +// helper will deem unnecessary in the future ... #[cfg(target_arch = "x86_64")] pub use crate::arch::x86_64::interrupt::*; |
