From da5dd55ce62b1bc0e9530c453b3ccd2f572ff454 Mon Sep 17 00:00:00 2001 From: Julien CLEMENT Date: Fri, 3 Dec 2021 22:36:40 +0100 Subject: [PATCH] fix(serial): now wait instead of kernel panick on serial !EMPTY_TRANSMITTER Signed-off-by: Julien CLEMENT --- src/lib.rs | 6 +----- src/serial.rs | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2bdba0d..3bff3d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,11 +29,7 @@ pub fn init() { pub extern "C" fn julios_main() -> ! { init(); println!("***JuliOS V0.1.0***"); - fn stack_overflow() { - stack_overflow(); // for each recursion, the return address is pushed - } - - stack_overflow(); + serial_println!("Hello serial"); panic!("Kernel end of flow"); } diff --git a/src/serial.rs b/src/serial.rs index 43cea73..3a0e2fa 100644 --- a/src/serial.rs +++ b/src/serial.rs @@ -93,9 +93,9 @@ impl SerialPort { fn write_string(&mut self, s: &str) -> usize { let mut len: usize = 0; for byte in s.bytes() { - let written: bool = self.write_byte(byte); - if !written { - return len; + let mut written: bool = self.write_byte(byte); + while !written { + written = self.write_byte(byte); } len += 1; }