mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
clarify a bit of rounding code in the create-image routine
This commit is contained in:
parent
778fa8d271
commit
c87acaeddc
1 changed files with 8 additions and 1 deletions
|
|
@ -188,11 +188,18 @@ fn main() {
|
||||||
// region is largely empty and we want to avoid allocating too much space.
|
// region is largely empty and we want to avoid allocating too much space.
|
||||||
if region.name == "CSR" {
|
if region.name == "CSR" {
|
||||||
const PAGE_SIZE: usize = 4096;
|
const PAGE_SIZE: usize = 4096;
|
||||||
|
// round to the nearest page, then add one page as the last entry in the csr_top
|
||||||
|
// is an alloatable page, and not an end-stop.
|
||||||
|
let length = if csr_top - region.base & (PAGE_SIZE - 1) == 0 {
|
||||||
|
csr_top - region.base
|
||||||
|
} else {
|
||||||
|
((csr_top - region.base) & !(PAGE_SIZE - 1)) + PAGE_SIZE
|
||||||
|
} + PAGE_SIZE;
|
||||||
map.insert(
|
map.insert(
|
||||||
region.name.to_lowercase(),
|
region.name.to_lowercase(),
|
||||||
tools::utils::CsrMemoryRegion {
|
tools::utils::CsrMemoryRegion {
|
||||||
start: region.base.try_into().unwrap(),
|
start: region.base.try_into().unwrap(),
|
||||||
length: (((csr_top - region.base) + PAGE_SIZE) & !(PAGE_SIZE - 1))
|
length: length
|
||||||
.try_into()
|
.try_into()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue