Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace use of internal syscalls #715

Merged
merged 1 commit into from
Apr 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/syscalls/interfaces/uhyve.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::alloc::{alloc, Layout};
use alloc::boxed::Box;
use alloc::vec::Vec;
use core::mem;
Expand Down Expand Up @@ -141,10 +142,12 @@ impl SyscallInterface for Uhyve {
let mut argv = Box::new(Vec::with_capacity(syscmdsize.argc as usize));
let mut argv_phy = Vec::with_capacity(syscmdsize.argc as usize);
for i in 0..syscmdsize.argc as usize {
argv.push(
crate::__sys_malloc(syscmdsize.argsz[i] as usize * mem::size_of::<u8>(), 1)
.cast_const(),
);
let layout =
Layout::from_size_align(syscmdsize.argsz[i] as usize * mem::size_of::<u8>(), 1)
.unwrap();

argv.push(unsafe { alloc(layout).cast_const() });

argv_phy.push(
paging::virtual_to_physical(VirtAddr(argv[i] as u64))
.unwrap()
Expand All @@ -156,10 +159,11 @@ impl SyscallInterface for Uhyve {
let mut env = Box::new(Vec::with_capacity(syscmdsize.envc as usize + 1));
let mut env_phy = Vec::with_capacity(syscmdsize.envc as usize + 1);
for i in 0..syscmdsize.envc as usize {
env.push(
crate::__sys_malloc(syscmdsize.envsz[i] as usize * mem::size_of::<u8>(), 1)
.cast_const(),
);
let layout =
Layout::from_size_align(syscmdsize.envsz[i] as usize * mem::size_of::<u8>(), 1)
.unwrap();
env.push(unsafe { alloc(layout).cast_const() });

env_phy.push(
paging::virtual_to_physical(VirtAddr(env[i] as u64))
.unwrap()
Expand Down