fix(coding style)

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
Julien CLEMENT 2021-12-03 01:11:28 +01:00
parent b9557bdc5e
commit eab6ddeb8d
2 changed files with 10 additions and 9 deletions

@ -1,8 +1,8 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
mod vga;
mod serial; mod serial;
mod vga;
use core::panic::PanicInfo; use core::panic::PanicInfo;
use vga::Color; use vga::Color;
@ -15,8 +15,7 @@ fn panic_handler(info: &PanicInfo) -> ! {
#[no_mangle] #[no_mangle]
pub extern "C" fn julios_main() -> ! { pub extern "C" fn julios_main() -> ! {
println!("Hello World!"); println!("***JuliOS***");
println!("{}", "***JuliOS***"); serial_println!("Hello serial");
serial_println!("Test serial");
panic!("Kernel end of flow"); panic!("Kernel end of flow");
} }

@ -1,6 +1,6 @@
use core::fmt; use core::fmt;
use spin::Mutex;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use spin::Mutex;
use x86_64::instructions::port::Port; use x86_64::instructions::port::Port;
const COM1: u16 = 0x3f8; const COM1: u16 = 0x3f8;
@ -22,7 +22,10 @@ lazy_static! {
#[doc(hidden)] #[doc(hidden)]
pub fn _print(args: ::core::fmt::Arguments) { pub fn _print(args: ::core::fmt::Arguments) {
use core::fmt::Write; use core::fmt::Write;
SERIAL1.lock().write_fmt(args).expect("Printing to serial failed"); SERIAL1
.lock()
.write_fmt(args)
.expect("Printing to serial failed");
} }
/// Prints to the host through the serial interface. /// Prints to the host through the serial interface.
@ -49,7 +52,7 @@ pub struct SerialPort {
impl SerialPort { impl SerialPort {
pub fn new(port: u16) -> SerialPort { pub fn new(port: u16) -> SerialPort {
SerialPort { SerialPort {
base: Port::new(port) base: Port::new(port),
} }
} }
@ -65,8 +68,7 @@ impl SerialPort {
} }
} }
fn init(&mut self) { fn init(&mut self) {}
}
} }
impl fmt::Write for SerialPort { impl fmt::Write for SerialPort {