MapMemory now accepts MappingSource
This commit is contained in:
parent
37d2471965
commit
84d2c40a3c
@ -28,7 +28,11 @@ pub mod io {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Type alias for a raw file descriptor
|
pub mod mem {
|
||||||
|
//! Memory-related data structures
|
||||||
|
|
||||||
|
pub use abi::mem::MappingSource;
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
unsafe extern "C" fn bcmp(p0: *const c_void, p1: *const c_void, len: usize) -> i32 {
|
unsafe extern "C" fn bcmp(p0: *const c_void, p1: *const c_void, len: usize) -> i32 {
|
||||||
|
@ -8,6 +8,7 @@ use abi::{
|
|||||||
DeviceRequest, DirectoryEntry, FileAttr, FileMode, MountOptions, OpenOptions, PollControl,
|
DeviceRequest, DirectoryEntry, FileAttr, FileMode, MountOptions, OpenOptions, PollControl,
|
||||||
RawFd, SeekFrom, UnmountOptions,
|
RawFd, SeekFrom, UnmountOptions,
|
||||||
},
|
},
|
||||||
|
mem::MappingSource,
|
||||||
process::{
|
process::{
|
||||||
ExitCode, MutexOperation, Signal, SignalEntryData, SpawnOptions, ThreadSpawnOptions,
|
ExitCode, MutexOperation, Signal, SignalEntryData, SpawnOptions, ThreadSpawnOptions,
|
||||||
},
|
},
|
||||||
@ -70,12 +71,17 @@ pub unsafe fn get_random(buffer: &mut [u8]) {
|
|||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// Unsafe: direct system call.
|
/// Unsafe: direct system call.
|
||||||
pub unsafe fn map_memory(virt: Option<usize>, len: usize) -> Result<usize, Error> {
|
pub unsafe fn map_memory(
|
||||||
|
virt: Option<usize>,
|
||||||
|
len: usize,
|
||||||
|
source: &MappingSource,
|
||||||
|
) -> Result<usize, Error> {
|
||||||
let virt = virt.unwrap_or(0);
|
let virt = virt.unwrap_or(0);
|
||||||
usize::from_syscall_result(syscall!(
|
usize::from_syscall_result(syscall!(
|
||||||
SyscallFunction::MapMemory,
|
SyscallFunction::MapMemory,
|
||||||
argn!(virt),
|
argn!(virt),
|
||||||
argn!(len)
|
argn!(len),
|
||||||
|
argp!(source as *const _)
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user