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

Method alloc_user_res

os/src/task/id.rs:144–163  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

142 }
143
144 pub fn alloc_user_res(&self) {
145 let process = self.process.upgrade().unwrap();
146 let mut process_inner = process.inner_exclusive_access();
147 // alloc user stack
148 let ustack_bottom = ustack_bottom_from_tid(self.ustack_base, self.tid);
149 let ustack_top = ustack_bottom + USER_STACK_SIZE;
150 process_inner.memory_set.insert_framed_area(
151 ustack_bottom.into(),
152 ustack_top.into(),
153 MapPermission::R | MapPermission::W | MapPermission::U,
154 );
155 // alloc trap_cx
156 let trap_cx_bottom = trap_cx_bottom_from_tid(self.tid);
157 let trap_cx_top = trap_cx_bottom + PAGE_SIZE;
158 process_inner.memory_set.insert_framed_area(
159 trap_cx_bottom.into(),
160 trap_cx_top.into(),
161 MapPermission::R | MapPermission::W,
162 );
163 }
164
165 fn dealloc_user_res(&self) {
166 // dealloc tid

Callers 2

execMethod · 0.80
newMethod · 0.80

Calls 4

ustack_bottom_from_tidFunction · 0.85
trap_cx_bottom_from_tidFunction · 0.85
insert_framed_areaMethod · 0.80

Tested by

no test coverage detected