|
@@ -129,9 +129,26 @@ fn main() -> ! {
|
|
|
|
|
|
use rustsbi::init_reset;
|
|
|
init_reset(hal::Reset);
|
|
|
+ }
|
|
|
|
|
|
- println!("[rustsbi] Version 0.1.0");
|
|
|
+ // 把S的中断全部委托给S层
|
|
|
+ unsafe {
|
|
|
+ mideleg::set_sext();
|
|
|
+ mideleg::set_stimer();
|
|
|
+ mideleg::set_ssoft();
|
|
|
+ medeleg::set_instruction_misaligned();
|
|
|
+ medeleg::set_breakpoint();
|
|
|
+ medeleg::set_user_env_call();
|
|
|
+ medeleg::set_instruction_page_fault();
|
|
|
+ medeleg::set_load_page_fault();
|
|
|
+ medeleg::set_store_page_fault();
|
|
|
+ mie::set_mext();
|
|
|
+ // 不打开mie::set_mtimer
|
|
|
+ mie::set_msoft();
|
|
|
+ }
|
|
|
|
|
|
+ if mhartid::read() == 0 {
|
|
|
+ println!("[rustsbi] Version 0.1.0");
|
|
|
println!("{}", rustsbi::LOGO);
|
|
|
println!("[rustsbi] Platform: QEMU");
|
|
|
let isa = misa::read();
|
|
@@ -141,7 +158,7 @@ fn main() -> ! {
|
|
|
MXL::XLEN64 => "RV64",
|
|
|
MXL::XLEN128 => "RV128",
|
|
|
};
|
|
|
- print!("[rustsbi] ISA: {}", mxl_str);
|
|
|
+ print!("[rustsbi] misa: {}", mxl_str);
|
|
|
for ext in 'A'..='Z' {
|
|
|
if isa.has_extension(ext) {
|
|
|
print!("{}", ext);
|
|
@@ -149,26 +166,11 @@ fn main() -> ! {
|
|
|
}
|
|
|
println!("");
|
|
|
}
|
|
|
-
|
|
|
+ println!("[rustsbi] mideleg: {:016x}", mideleg::read().bits());
|
|
|
+ println!("[rustsbi] medeleg: {:016x}", medeleg::read().bits());
|
|
|
println!("[rustsbi] Kernel entry: 0x80200000");
|
|
|
}
|
|
|
|
|
|
- // 把S的中断全部委托给S层
|
|
|
- unsafe {
|
|
|
- mideleg::set_sext();
|
|
|
- mideleg::set_stimer();
|
|
|
- mideleg::set_ssoft();
|
|
|
- medeleg::set_instruction_misaligned();
|
|
|
- medeleg::set_breakpoint();
|
|
|
- medeleg::set_user_env_call();
|
|
|
- medeleg::set_instruction_page_fault();
|
|
|
- medeleg::set_load_page_fault();
|
|
|
- medeleg::set_store_page_fault();
|
|
|
- mie::set_mext();
|
|
|
- // 不打开mie::set_mtimer
|
|
|
- mie::set_msoft();
|
|
|
- }
|
|
|
-
|
|
|
extern "C" {
|
|
|
fn _s_mode_start();
|
|
|
}
|