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
mod gen;
pub use gen::*;
use core::ops::Range;
use crate::println;
extern "C" {
pub fn uservec();
pub fn userret();
pub fn kernelvec();
pub fn timervec();
}
pub const PAGE_ORDER: usize = 12;
pub const PAGE_SIZE: usize = 1 << PAGE_ORDER;
pub const MAXVA: usize = 1 << (9 + 9 + 9 + 12 - 1);
pub const TRAMPOLINE_START: usize = MAXVA - PAGE_SIZE;
pub const TRAPFRAME_START: usize = TRAMPOLINE_START - PAGE_SIZE;
pub const NCPUS : usize = 8;
pub const NMAXPROCS: usize = 256;
pub const SCHEDULER_INTERVAL: usize = 1_000_000;
pub unsafe fn bss_range() -> Range<*mut usize> {
Range {
start: BSS_START as *mut usize,
end: BSS_END as *mut usize,
}
}
pub fn print_map_symbols() {
println!("TEXT: 0x{:x} -> 0x{:x}", TEXT_START(), TEXT_END());
println!("RODATA: 0x{:x} -> 0x{:x}", RODATA_START(), RODATA_END());
println!("DATA: 0x{:x} -> 0x{:x}", DATA_START(), DATA_END());
println!("BSS: 0x{:x} -> 0x{:x}", BSS_START(), BSS_END());
println!(
"STACK: 0x{:x} -> 0x{:x}",
KERNEL_STACK_START(), KERNEL_STACK_END()
);
println!(
"HEAP: 0x{:x} -> 0x{:x}",
HEAP_START(),
HEAP_START() + HEAP_SIZE()
);
}