From 5945634f5ed6abea70eeec160bbcb03b3c236cb7 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 11 May 2025 12:26:47 +0800 Subject: [PATCH] add a flag for memory that is allocated as swapped this indicates to the OS to reserve the virtual pages for the memory, mark them as swapped, but don't actually put anything in physical memory. --- xous-rs/src/definitions/memoryflags.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xous-rs/src/definitions/memoryflags.rs b/xous-rs/src/definitions/memoryflags.rs index 094864d64..2a535c23a 100644 --- a/xous-rs/src/definitions/memoryflags.rs +++ b/xous-rs/src/definitions/memoryflags.rs @@ -9,15 +9,19 @@ pub struct MemoryFlags { impl MemoryFlags { /// Marks the page as the 'device' page for on-chip peripherals. pub const DEV: Self = Self { bits: 0b0001_0000 }; - const FLAGS_ALL: usize = 0b111111; + const FLAGS_ALL: usize = 0b11_1111; /// Free this memory pub const FREE: Self = Self { bits: 0b0000_0000 }; + /// Page is swapped + pub const P: Self = Self { bits: 0b10_0000_0000 }; /// Allow the CPU to read from this page. pub const R: Self = Self { bits: 0b0000_0010 }; /// Immediately allocate this memory. Otherwise it will /// be demand-paged. This is implicitly set when `phys` /// is not 0. pub const RESERVE: Self = Self { bits: 0b0000_0001 }; + /// Marks the page as pure virtual; i.e., memory mapped SPI FLASH + pub const VIRT: Self = Self { bits: 0b0010_0000 }; /// Allow the CPU to write to this page. pub const W: Self = Self { bits: 0b0000_0100 }; /// Allow the CPU to execute from this page.