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
1 changed files with 7 additions and 0 deletions
|
|
@ -79,3 +79,10 @@ pub use x86_64::{
|
|||
arch_memory_regions, configure_system, layout, layout::CMDLINE_MAX_SIZE, layout::CMDLINE_START,
|
||||
BootProtocol, EntryPoint,
|
||||
};
|
||||
|
||||
/// Safe wrapper for `sysconf(_SC_PAGESIZE)`.
|
||||
#[inline(always)]
|
||||
fn pagesize() -> usize {
|
||||
// Trivially safe
|
||||
unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue