You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#![no_std]
|
|
|
|
#![no_main]
|
|
|
|
#![feature(global_asm)]
|
|
|
|
#![feature(llvm_asm)]
|
|
|
|
#![feature(panic_info_message)]
|
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
mod console;
|
|
|
|
mod lang_items;
|
|
|
|
mod sbi;
|
|
|
|
mod syscall;
|
|
|
|
mod trap;
|
|
|
|
mod batch;
|
|
|
|
|
|
|
|
global_asm!(include_str!("entry.asm"));
|
|
|
|
global_asm!(include_str!("link_app.S"));
|
|
|
|
|
|
|
|
fn clear_bss() {
|
|
|
|
extern "C" {
|
|
|
|
fn sbss();
|
|
|
|
fn ebss();
|
|
|
|
}
|
|
|
|
(sbss as usize..ebss as usize).for_each(|a| {
|
|
|
|
unsafe { (a as *mut u8).write_volatile(0) }
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn rust_main() -> ! {
|
|
|
|
clear_bss();
|
|
|
|
println!("Hello, world!");
|
|
|
|
batch::init();
|
|
|
|
batch::run_next_app();
|
|
|
|
panic!("Shutdown machine!");
|
|
|
|
}
|