Skip to content

Commit

Permalink
lib: riscv64: use RISC-V SBI 2.0 ratified DBCN write instead of depre…
Browse files Browse the repository at this point in the history
…cated legacy console write

Legacy extensions are deprecated in SBI 0.2 dated back to 2021;
some of the SBI implementations have already dropped support for legacy console, resulting in no console output for hermit OS loader.
To solve this problem, we use its replacement in the SBI 2.0 DBCN extension, which is supported by modern SBI firmwares. We do this by modify our code to use console_write_byte function from sbi-rt.

Signed-off-by: Zhouqi Jiang <[email protected]>
  • Loading branch information
luojia65 committed Feb 29, 2024
1 parent c27b41e commit af78a1c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
17 changes: 13 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ qemu-exit = "3"
fdt = "0.1"
naked-function = "0.1"
riscv = "0.11"
sbi = "0.2"
sbi-rt = "0.0.3"
sptr = "0.3"

[profile.release]
Expand Down
2 changes: 1 addition & 1 deletion src/arch/riscv64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use sptr::Strict;

pub fn message_output_init() {}

pub use sbi::legacy::console_putchar as output_message_byte;
pub use sbi_rt::console_write_byte as output_message_byte;

fn find_kernel_linux(chosen: &FdtNode<'_, '_>) -> Option<&'static [u8]> {
let initrd_start = chosen.property("linux,initrd-start")?.as_usize()?;
Expand Down

0 comments on commit af78a1c

Please sign in to comment.