mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-23 00:16:17 +04:00
fix load program slice error
This commit is contained in:
parent
5ce7d0a9c0
commit
d27ac65df3
@ -83,7 +83,9 @@ impl ContextImpl {
|
||||
let mem_size = ph.mem_size() as usize;
|
||||
|
||||
let target = unsafe { ::core::slice::from_raw_parts_mut(virt_addr as *mut u8, mem_size) };
|
||||
target[..file_size].copy_from_slice(&data[offset..offset + file_size]);
|
||||
if file_size != 0 {
|
||||
target[..file_size].copy_from_slice(&data[offset..offset + file_size]);
|
||||
}
|
||||
target[file_size..].iter_mut().for_each(|x| *x = 0);
|
||||
}
|
||||
ustack_top = push_args_at_stack(args, ustack_top);
|
||||
|
Loading…
Reference in New Issue
Block a user