Add PAGE_SIZE for all archs, make it public.
This commit is contained in:
@@ -3,6 +3,8 @@ use core::ops::{Deref, DerefMut};
|
||||
|
||||
use super::error::{Error, Result};
|
||||
|
||||
pub const PAGE_SIZE: usize = 4096;
|
||||
|
||||
macro_rules! syscall {
|
||||
($($name:ident($a:ident, $($b:ident, $($c:ident, $($d:ident, $($e:ident, $($f:ident, )?)?)?)?)?);)+) => {
|
||||
$(
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
use super::error::{Error, Result, ENOSYS};
|
||||
|
||||
// Doesn't really matter, but since we will most likely run on an x86_64 host, why not 4096?
|
||||
pub const PAGE_SIZE: usize = 4096;
|
||||
|
||||
pub unsafe fn syscall0(_a: usize) -> Result<usize> {
|
||||
Err(Error::new(ENOSYS))
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ use core::ops::{Deref, DerefMut};
|
||||
|
||||
use super::error::{Error, Result};
|
||||
|
||||
pub const PAGE_SIZE: usize = 4096;
|
||||
|
||||
macro_rules! syscall {
|
||||
($($name:ident($a:ident, $($b:ident, $($c:ident, $($d:ident, $($e:ident, $($f:ident, )?)?)?)?)?);)+) => {
|
||||
$(
|
||||
|
||||
@@ -4,6 +4,8 @@ use core::ops::{Deref, DerefMut};
|
||||
|
||||
use super::error::{Error, Result};
|
||||
|
||||
pub const PAGE_SIZE: usize = 4096;
|
||||
|
||||
macro_rules! syscall {
|
||||
($($name:ident($a:ident, $($b:ident, $($c:ident, $($d:ident, $($e:ident, $($f:ident, )?)?)?)?)?);)+) => {
|
||||
$(
|
||||
|
||||
@@ -4,6 +4,7 @@ use core::{ptr, slice};
|
||||
|
||||
use crate::Result;
|
||||
use crate::{PartialAllocStrategy, PhysallocFlags};
|
||||
use crate::arch::PAGE_SIZE;
|
||||
|
||||
/// An RAII guard of a physical memory allocation. Currently all physically allocated memory are
|
||||
/// page-aligned and take up at least 4k of space (on x86_64).
|
||||
@@ -13,9 +14,6 @@ pub struct PhysBox {
|
||||
size: usize
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
const PAGE_SIZE: usize = 4096;
|
||||
|
||||
const fn round_up(x: usize) -> usize {
|
||||
(x + PAGE_SIZE - 1) / PAGE_SIZE * PAGE_SIZE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user