feat(vga): add vga print macros and increase kernel stack size
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
Julien CLEMENT 2021-12-02 19:34:27 +01:00
parent 77f6a31381
commit 70e7b48bfe
3 changed files with 27 additions and 6 deletions

@ -164,7 +164,7 @@ p2_table:
resb 4096 resb 4096
stack_bottom: stack_bottom:
resb 64 resb 4096
stack_top: stack_top:

@ -1,17 +1,20 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use core::panic::PanicInfo;
#[panic_handler] #[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! { fn panic_handler(info: &PanicInfo) -> ! {
println!("{}", info);
loop {} loop {}
} }
use core::fmt::Write;
mod vga; mod vga;
#[no_mangle] #[no_mangle]
pub extern "C" fn julios_main() -> ! { pub extern "C" fn julios_main() -> ! {
vga::WRITER.lock().write_str("Hello").unwrap(); println!("Hello World!");
write!(vga::WRITER.lock(), " {}!\n{}", "World", "***JuliOS***").unwrap(); println!("{}", "***JuliOS***");
panic!("Test panick");
loop {} loop {}
} }

@ -1,5 +1,5 @@
use volatile::Volatile; use volatile::Volatile;
use core::fmt::{self, Write}; use core::fmt;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use spin::Mutex; use spin::Mutex;
@ -14,6 +14,24 @@ lazy_static! {
}); });
} }
#[macro_export]
macro_rules! print {
($($arg:tt)*) => ($crate::vga::_print(format_args!($($arg)*)));
}
#[macro_export]
macro_rules! println {
() => ($crate::print!("\n"));
($($arg:tt)*) => ($crate::print!("{}\n", format_args!($($arg)*)));
}
#[doc(hidden)]
pub fn _print(args: fmt::Arguments) {
use core::fmt::Write;
WRITER.lock().write_fmt(args).unwrap();
}
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u8)] #[repr(u8)]