Try batch but kernel panicked.

This commit is contained in:
Yifan Wu 2020-11-19 18:01:16 +08:00
parent 220397e5a5
commit bae5383602
11 changed files with 385 additions and 17 deletions

View file

@ -10,6 +10,7 @@ mod lang_items;
mod sbi;
mod syscall;
mod trap;
mod batch;
global_asm!(include_str!("entry.asm"));
global_asm!(include_str!("link_app.S"));
@ -28,17 +29,7 @@ fn clear_bss() {
pub fn rust_main() -> ! {
clear_bss();
println!("Hello, world!");
extern "C" {
fn _num_app();
}
let num_app_ptr = _num_app as usize as *const usize;
let num_app = unsafe { num_app_ptr.read_volatile() };
println!("num_app = {}", num_app);
let app_start: &[usize] = unsafe {
core::slice::from_raw_parts(num_app_ptr.add(1), num_app + 1)
};
for i in 0..num_app {
println!("app_{} [{:#x}, {:#x})", i, app_start[i], app_start[i + 1]);
}
batch::init();
batch::run_next_app();
panic!("Shutdown machine!");
}