Skip to content

Commit 083d2f7

Browse files
authored
fix(riscv64): phys ram range (#19)
1 parent 638efd8 commit 083d2f7

File tree

1 file changed

+7
-2
lines changed
  • platforms/axplat-riscv64-qemu-virt/src

1 file changed

+7
-2
lines changed

platforms/axplat-riscv64-qemu-virt/src/mem.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use axplat::mem::{MemIf, PhysAddr, RawRange, VirtAddr, pa, va};
22

33
use crate::config::devices::MMIO_RANGES;
4-
use crate::config::plat::{KERNEL_BASE_PADDR, PHYS_MEMORY_SIZE, PHYS_VIRT_OFFSET};
4+
use crate::config::plat::{
5+
KERNEL_BASE_PADDR, PHYS_MEMORY_BASE, PHYS_MEMORY_SIZE, PHYS_VIRT_OFFSET,
6+
};
57

68
struct MemIfImpl;
79

@@ -14,7 +16,10 @@ impl MemIf for MemIfImpl {
1416
fn phys_ram_ranges() -> &'static [RawRange] {
1517
// TODO: paser dtb to get the available memory ranges
1618
// We can't directly use `PHYS_MEMORY_BASE` here, because it may has been used by sbi.
17-
&[(KERNEL_BASE_PADDR, PHYS_MEMORY_SIZE)]
19+
&[(
20+
KERNEL_BASE_PADDR,
21+
PHYS_MEMORY_BASE + PHYS_MEMORY_SIZE - KERNEL_BASE_PADDR,
22+
)]
1823
}
1924

2025
/// Returns all reserved physical memory ranges on the platform.

0 commit comments

Comments
 (0)