Add a message when user heap is not mapped, do not panic

This commit is contained in:
Jeremy Soller
2020-08-02 17:07:57 -06:00
parent ec1809e7c0
commit 1a8f47330e

View File

@@ -455,11 +455,15 @@ pub fn clone(flags: CloneFlags, stack_base: usize) -> Result<ContextId> {
// Copy user heap mapping, if found
if let Some(heap_shared) = heap_opt {
let frame = active_table.p4()[crate::USER_HEAP_PML4].pointed_frame().expect("user heap not mapped");
let flags = active_table.p4()[crate::USER_HEAP_PML4].flags();
active_table.with(&mut new_table, &mut temporary_page, |mapper| {
mapper.p4_mut()[crate::USER_HEAP_PML4].set(frame, flags);
});
//TODO: find out why this gets unmapped (perhaps it is never mapped)
if let Some(frame) = active_table.p4()[crate::USER_HEAP_PML4].pointed_frame() {
let flags = active_table.p4()[crate::USER_HEAP_PML4].flags();
active_table.with(&mut new_table, &mut temporary_page, |mapper| {
mapper.p4_mut()[crate::USER_HEAP_PML4].set(frame, flags);
});
} else {
println!("clone: user heap not mapped for {:X?}", heap_shared);
}
context.heap = Some(heap_shared);
}