1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#![no_std]
#![feature(panic_info_message, asm)]
#![feature(global_asm)]
#![feature(format_args_nl)]
#![feature(const_generics)]
#![feature(const_in_array_repeat_expressions)]
#![feature(alloc_error_handler)]
#![feature(box_syntax)]
#![feature(alloc_prelude)]
#![feature(llvm_asm)]
#![allow(dead_code)]
#![allow(unused_imports)]
extern crate alloc;
use alloc::prelude::v1::*;
mod arch;
mod elf;
mod mem;
mod spinlock;
mod page;
mod print;
mod process;
mod symbols;
mod trap;
mod uart;
mod plic;
mod clint;
mod syscall;
mod start;
mod jump;
mod virtio;
mod intr;
mod test;
mod sleeplock;
mod file;
#[no_mangle]
extern "C" fn eh_personality() {}
#[panic_handler]
fn panic(info: &core::panic::PanicInfo) -> ! {
panic_println!("hart {} aborting: ", arch::hart_id());
if let Some(p) = info.location() {
panic_println!(
"line {}, file {}: {}",
p.line(),
p.file(),
info.message().unwrap()
);
} else {
panic_println!("no information available.");
}
abort();
}
#[no_mangle]
extern "C" fn abort() -> ! {
arch::wait_forever();
}