Skip to content

Commit 9490df4

Browse files
committed
[CPU/AARCH64] Fixup MMU
1. Configure the kernel default vaddr by RAM and TEXT offset. 2. Check the p_addr 2M align when set the stride in `rt_hw_mmu_map`. Signed-off-by: GuEe-GUI <[email protected]>
1 parent 1afed1b commit 9490df4

File tree

1 file changed

+4
-2
lines changed
  • libcpu/aarch64/common

1 file changed

+4
-2
lines changed

libcpu/aarch64/common/mmu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
/* restrict virtual address on usage of RT_NULL */
5656
#ifndef KERNEL_VADDR_START
57-
#define KERNEL_VADDR_START 0x1000
57+
#define KERNEL_VADDR_START (ARCH_RAM_OFFSET + ARCH_TEXT_OFFSET)
5858
#endif
5959

6060
volatile unsigned long MMUTable[512] __attribute__((aligned(4 * 1024)));
@@ -283,7 +283,9 @@ void *rt_hw_mmu_map(rt_aspace_t aspace, void *v_addr, void *p_addr, size_t size,
283283

284284
while (remaining_sz)
285285
{
286-
if (((rt_ubase_t)v_addr & ARCH_SECTION_MASK) || (remaining_sz < ARCH_SECTION_SIZE))
286+
if (((rt_ubase_t)v_addr & ARCH_SECTION_MASK) ||
287+
((rt_ubase_t)p_addr & ARCH_SECTION_MASK) ||
288+
(remaining_sz < ARCH_SECTION_SIZE))
287289
{
288290
/* legacy 4k mapping */
289291
stride = ARCH_PAGE_SIZE;

0 commit comments

Comments
 (0)