mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 04:25:21 +00:00
arch: provide mechanism to get page size
This is a copy of the same code in vm-allocator, until a better place is found for general use. Signed-off-by: Damjan Georgievski <gdamjan@gmail.com>
This commit is contained in:
parent
4b110d5b73
commit
0ce7de3ef5
@ -79,3 +79,10 @@ pub use x86_64::{
|
|||||||
arch_memory_regions, configure_system, layout, layout::CMDLINE_MAX_SIZE, layout::CMDLINE_START,
|
arch_memory_regions, configure_system, layout, layout::CMDLINE_MAX_SIZE, layout::CMDLINE_START,
|
||||||
BootProtocol, EntryPoint,
|
BootProtocol, EntryPoint,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Safe wrapper for `sysconf(_SC_PAGESIZE)`.
|
||||||
|
#[inline(always)]
|
||||||
|
fn pagesize() -> usize {
|
||||||
|
// Trivially safe
|
||||||
|
unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize }
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user