mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
revise pagetable entry to be 7 bytes wide -- this will allow
us to have a full 64-bit address space upon expansion of the page number (turns out this is probably important because of the crappy increment-only allocator used for the large blocks)
This commit is contained in:
parent
42e926fcab
commit
66a5b97705
2 changed files with 4 additions and 7 deletions
|
|
@ -43,12 +43,10 @@ impl Default for PtFlags {
|
||||||
#[repr(packed)]
|
#[repr(packed)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub(crate) struct Pte {
|
pub(crate) struct Pte {
|
||||||
/// the virtual address is 48 bits long
|
/// the virtual page number is 52 bits long (52 + 12 = 64). 4 bits are wasted in this representation.
|
||||||
pddb_addr: [u8; 6],
|
pddb_addr: [u8; 7],
|
||||||
/// this maps to a u8
|
/// this maps to a u8
|
||||||
flags: PtFlags,
|
flags: PtFlags,
|
||||||
#[allow(dead_code)]
|
|
||||||
reserved: u8,
|
|
||||||
/// 32-bit strength of a nonce, but can be varied
|
/// 32-bit strength of a nonce, but can be varied
|
||||||
nonce: [u8; 4],
|
nonce: [u8; 4],
|
||||||
/// 32-bit "weak" checksum, used only for quick scans of the PTE to determine a coarse "in" or "out" classifier
|
/// 32-bit "weak" checksum, used only for quick scans of the PTE to determine a coarse "in" or "out" classifier
|
||||||
|
|
@ -59,9 +57,8 @@ impl Pte {
|
||||||
pub fn new(va: VirtAddr, flags: PtFlags, entropy: Rc<RefCell<TrngPool>>) -> Self {
|
pub fn new(va: VirtAddr, flags: PtFlags, entropy: Rc<RefCell<TrngPool>>) -> Self {
|
||||||
let nonce_u32 = entropy.borrow_mut().get_u32();
|
let nonce_u32 = entropy.borrow_mut().get_u32();
|
||||||
let mut pte = Pte {
|
let mut pte = Pte {
|
||||||
pddb_addr: va.get().to_le_bytes()[..6].try_into().unwrap(),
|
pddb_addr: va.get().to_le_bytes()[..7].try_into().unwrap(),
|
||||||
flags,
|
flags,
|
||||||
reserved: 0,
|
|
||||||
nonce: nonce_u32.to_le_bytes(),
|
nonce: nonce_u32.to_le_bytes(),
|
||||||
checksum: [0; 4],
|
checksum: [0; 4],
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -483,7 +483,7 @@ class Pte:
|
||||||
return self.bytes
|
return self.bytes
|
||||||
|
|
||||||
def addr(self):
|
def addr(self):
|
||||||
return int.from_bytes(self.bytes[:6], 'little')
|
return int.from_bytes(self.bytes[:7], 'little')
|
||||||
def flags(self):
|
def flags(self):
|
||||||
if self.bytes[6] == 1:
|
if self.bytes[6] == 1:
|
||||||
return 'CLN'
|
return 'CLN'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue