E
This commit is contained in:
FantasyPvP
2023-10-31 18:40:30 +00:00
parent 3d889c4730
commit d4b7ee243f
7 changed files with 73 additions and 12 deletions
+13
View File
@@ -24,6 +24,19 @@ pub fn _print(args: core::fmt::Arguments) {
})
}
pub fn serial_reply(chr: char) -> char {
use core::fmt::Write;
use x86_64::instructions::interrupts;
let mut chr_return: char = 'X';
interrupts::without_interrupts(|| {
SERIAL1.lock().send(chr as u8);
chr_return = SERIAL1.lock().receive() as char ;
});
chr_return
}
#[macro_export]
macro_rules! serial_print {
+9
View File
@@ -8,6 +8,7 @@ use alloc::vec::Vec;
pub use crate::{print, println, serial_print, serial_println};
pub use crate::kernel::render::Color;
use crate::kernel::serial::serial_reply;
use lazy_static::lazy_static;
use spin::Mutex;
@@ -30,6 +31,14 @@ impl Stdin {
}
}
pub struct Serial {}
impl Serial {
pub fn reply_char(c: char) -> char {
serial_reply(c)
}
}
pub struct Screen {}
impl Screen {
pub fn terminal_mode() {