diff options
| author | zhujiale <[email protected]> | 2024-11-15 18:26:35 +0800 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2024-11-17 21:13:07 -0500 |
| commit | 96da7abd3e1dc30d901220b2c14e89ea9ecd096c (patch) | |
| tree | 4ecf5301d786353f66830c697ff756026a0fca12 /libcpu/aarch64/common/setup.c | |
| parent | 09f47c55a9cfc69f9df80f3c7b83b5e890b40adb (diff) | |
[libcpu] fix No memory higher than 1 GB is mapped
Diffstat (limited to 'libcpu/aarch64/common/setup.c')
| -rw-r--r-- | libcpu/aarch64/common/setup.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libcpu/aarch64/common/setup.c b/libcpu/aarch64/common/setup.c index a18bf744fb..c8de62137c 100644 --- a/libcpu/aarch64/common/setup.c +++ b/libcpu/aarch64/common/setup.c @@ -235,7 +235,17 @@ void rt_hw_common_setup(void) rt_memblock_reserve_memory("init-page", init_page_start, init_page_end, MEMBLOCK_NONE); rt_memblock_reserve_memory("fdt", fdt_start, fdt_end, MEMBLOCK_NONE); - rt_memmove((void *)(fdt_start - pv_off), (void *)(fdt_ptr - pv_off), fdt_size); + /* To virtual address */ + fdt_ptr = (void *)(fdt_ptr - pv_off); + + if ((rt_ubase_t)fdt_ptr + fdt_size - KERNEL_VADDR_START > SIZE_GB) + { + fdt_ptr = rt_ioremap_early(fdt_ptr + pv_off, fdt_size); + + RT_ASSERT(fdt_ptr != RT_NULL); + } + + rt_memmove((void *)(fdt_start - pv_off), fdt_ptr, fdt_size); fdt_ptr = (void *)fdt_start - pv_off; rt_system_heap_init((void *)(heap_start - pv_off), (void *)(heap_end - pv_off)); |
