diff --git a/src/syscall/process.rs b/src/syscall/process.rs index 307a266..e051197 100644 --- a/src/syscall/process.rs +++ b/src/syscall/process.rs @@ -455,11 +455,15 @@ pub fn clone(flags: CloneFlags, stack_base: usize) -> Result { // 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); }