MCPcopy Create free account
hub / github.com/chyyuu/os_kernel_lab / new_kernel

Method new_kernel

os/src/mm/memory_set.rs:93–168  ·  view source on GitHub ↗

Without kernel stacks.

()

Source from the content-addressed store, hash-verified

91 }
92 /// Without kernel stacks.
93 pub fn new_kernel() -> Self {
94 let mut memory_set = Self::new_bare();
95 // map trampoline
96 memory_set.map_trampoline();
97 // map kernel sections
98 // println!(".text [{:#x}, {:#x})", stext as usize, etext as usize);
99 // println!(".rodata [{:#x}, {:#x})", srodata as usize, erodata as usize);
100 // println!(".data [{:#x}, {:#x})", sdata as usize, edata as usize);
101 // println!(
102 // ".bss [{:#x}, {:#x})",
103 // sbss_with_stack as usize, ebss as usize
104 // );
105 // println!("mapping .text section");
106 memory_set.push(
107 MapArea::new(
108 (stext as usize).into(),
109 (etext as usize).into(),
110 MapType::Identical,
111 MapPermission::R | MapPermission::X,
112 ),
113 None,
114 );
115 // println!("mapping .rodata section");
116 memory_set.push(
117 MapArea::new(
118 (srodata as usize).into(),
119 (erodata as usize).into(),
120 MapType::Identical,
121 MapPermission::R,
122 ),
123 None,
124 );
125 // println!("mapping .data section");
126 memory_set.push(
127 MapArea::new(
128 (sdata as usize).into(),
129 (edata as usize).into(),
130 MapType::Identical,
131 MapPermission::R | MapPermission::W,
132 ),
133 None,
134 );
135 // println!("mapping .bss section");
136 memory_set.push(
137 MapArea::new(
138 (sbss_with_stack as usize).into(),
139 (ebss as usize).into(),
140 MapType::Identical,
141 MapPermission::R | MapPermission::W,
142 ),
143 None,
144 );
145 // println!("mapping physical memory");
146 memory_set.push(
147 MapArea::new(
148 (ekernel as usize).into(),
149 MEMORY_END.into(),
150 MapType::Identical,

Callers

nothing calls this directly

Calls 2

map_trampolineMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected