mirror of
https://github.com/panpaul/tiny_os
synced 2024-09-20 09:45:19 +08:00
feat: drop legacy flags for riscv-sbi
This commit is contained in:
parent
dd5325db2a
commit
daf96a0c64
@ -37,7 +37,7 @@ log = "0.4"
|
|||||||
num-derive = "0.4"
|
num-derive = "0.4"
|
||||||
num-traits = { version = "0.2", default-features = false }
|
num-traits = { version = "0.2", default-features = false }
|
||||||
riscv = { version = "0.11.1", features = ["s-mode"] }
|
riscv = { version = "0.11.1", features = ["s-mode"] }
|
||||||
sbi-rt = { version = "0.0.3", features = ["legacy"] }
|
sbi-rt = { version = "0.0.3" }
|
||||||
spin = "0.9.8"
|
spin = "0.9.8"
|
||||||
static_assertions = "1.1.0"
|
static_assertions = "1.1.0"
|
||||||
uart_16550 = "0.3"
|
uart_16550 = "0.3"
|
||||||
|
@ -1,21 +1,28 @@
|
|||||||
use crate::plat::io::{Printer, RawConsole, Reader};
|
use crate::plat::io::{Printer, RawConsole, Reader};
|
||||||
|
|
||||||
impl Printer for RawConsole {
|
impl Printer for RawConsole {
|
||||||
|
#[inline]
|
||||||
fn put_char(c: char) {
|
fn put_char(c: char) {
|
||||||
#[allow(deprecated)]
|
sbi_rt::console_write_byte(c as u8);
|
||||||
sbi_rt::legacy::console_putchar(c as usize);
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn put_str(s: &str) {
|
||||||
|
sbi_rt::console_write(sbi_rt::Physical::new(s.len(), s.as_ptr() as _, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reader for RawConsole {
|
impl Reader for RawConsole {
|
||||||
|
#[inline]
|
||||||
fn get_char() -> char {
|
fn get_char() -> char {
|
||||||
|
let mut buf = [0u8; 1];
|
||||||
loop {
|
loop {
|
||||||
#[allow(deprecated)]
|
let ret = sbi_rt::console_read(sbi_rt::Physical::new(1, buf.as_mut_ptr() as _, 0));
|
||||||
let ch = sbi_rt::legacy::console_getchar();
|
if let Some(len) = ret.ok()
|
||||||
if ch == usize::MAX {
|
&& len == 1
|
||||||
continue;
|
{
|
||||||
|
return buf[0] as char;
|
||||||
}
|
}
|
||||||
return ch as u8 as char;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#![no_main]
|
#![no_main]
|
||||||
// Features
|
// Features
|
||||||
#![feature(asm_const)]
|
#![feature(asm_const)]
|
||||||
|
#![feature(let_chains)]
|
||||||
#![feature(naked_functions)]
|
#![feature(naked_functions)]
|
||||||
#![feature(panic_info_message)]
|
#![feature(panic_info_message)]
|
||||||
#![feature(stmt_expr_attributes)]
|
#![feature(stmt_expr_attributes)]
|
||||||
|
Loading…
Reference in New Issue
Block a user