feat(vga): add vga print macros and increase kernel stack size
All checks were successful
continuous-integration/drone/push Build is passing
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:
parent
77f6a31381
commit
70e7b48bfe
@ -164,7 +164,7 @@ p2_table:
|
||||
resb 4096
|
||||
|
||||
stack_bottom:
|
||||
resb 64
|
||||
resb 4096
|
||||
stack_top:
|
||||
|
||||
|
||||
|
11
src/lib.rs
11
src/lib.rs
@ -1,17 +1,20 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
||||
fn panic_handler(info: &PanicInfo) -> ! {
|
||||
println!("{}", info);
|
||||
loop {}
|
||||
}
|
||||
|
||||
use core::fmt::Write;
|
||||
mod vga;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn julios_main() -> ! {
|
||||
vga::WRITER.lock().write_str("Hello").unwrap();
|
||||
write!(vga::WRITER.lock(), " {}!\n{}", "World", "***JuliOS***").unwrap();
|
||||
println!("Hello World!");
|
||||
println!("{}", "***JuliOS***");
|
||||
panic!("Test panick");
|
||||
loop {}
|
||||
}
|
||||
|
20
src/vga.rs
20
src/vga.rs
@ -1,5 +1,5 @@
|
||||
use volatile::Volatile;
|
||||
use core::fmt::{self, Write};
|
||||
use core::fmt;
|
||||
use lazy_static::lazy_static;
|
||||
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)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u8)]
|
||||
|
Loading…
Reference in New Issue
Block a user