Skip to content

Commit 65c9947

Browse files
authored
[libcpu] rv64: support for ARCH_REMAP_KERNEL (#9067)
* [libcpu] support for ARCH_REMAP_KERNEL These changes introduce support for the ARCH_REMAP_KERNEL configuration, which isolates kernel space in high virtual address regions. This feature is necessary to enhance memory protection and management by segregating user and kernel spaces more effectively. Changes: - Updated conditional macros to check for ARCH_REMAP_KERNEL instead of ARCH_KERNEL_IN_HIGH_VA in board initialization files to reflect the new configuration option. - Modified qemu-virt64-riscv Kconfig and SConstruct files to include and utilize ARCH_REMAP_KERNEL. - Created a new linker script `link_smart.lds` for smart linking in qemu-virt64-riscv. - Updated rtconfig.py to use a more flexible execution path setup. - Enhanced user address space definitions in `lwp_arch.h` to support the new virtual address mappings. - Adjusted kernel memory initialization and mapping logic in `c906/mmu.c` and `virt64/mmu.c` to account for high virtual address regions. - Added Kconfig option to enable ARCH_REMAP_KERNEL for RISCV64 architectures. - Enhanced memory setup functions to support new mapping scheme, including updates to early page table setup and address relocation logic. These modifications ensure that the system can utilize high memory addresses for the kernel, improving memory isolation and system stability. Signed-off-by: Shell <[email protected]> * fixup: CI run failed * bsp: default config without using smart * fixup: static checks * restore rt_hw_mmu_kernel_map_init for D1 --------- Signed-off-by: Shell <[email protected]>
1 parent 73727fa commit 65c9947

File tree

17 files changed

+700
-323
lines changed

17 files changed

+700
-323
lines changed

.github/workflows/action_utest.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ jobs:
142142
popd
143143
pushd UtestRunner
144144
if [ $TEST_SD_FILE != "None" ]; then
145-
python3 qemu_runner.py --system $TEST_QEMU_ARCH --machine $TEST_QEMU_MACHINE --elf ../$TEST_BSP_ROOT/rtthread.elf --sd ../$TEST_BSP_ROOT/$TEST_SD_FILE
145+
python3 qemu_runner.py --system $TEST_QEMU_ARCH --machine $TEST_QEMU_MACHINE --elf ../$TEST_BSP_ROOT/rtthread.bin --sd ../$TEST_BSP_ROOT/$TEST_SD_FILE
146146
else
147-
python3 qemu_runner.py --system $TEST_QEMU_ARCH --machine $TEST_QEMU_MACHINE --elf ../$TEST_BSP_ROOT/rtthread.elf
147+
python3 qemu_runner.py --system $TEST_QEMU_ARCH --machine $TEST_QEMU_MACHINE --elf ../$TEST_BSP_ROOT/rtthread.bin
148148
fi
149149
cat rtt_console.log
150150
popd

bsp/bouffalo_lab/bl808/d0/board/board.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void init_bss(void)
3838
unsigned int *dst;
3939

4040
dst = &__bss_start;
41-
while (dst < &__bss_end)
41+
while ((rt_ubase_t)dst < (rt_ubase_t)&__bss_end)
4242
{
4343
*dst++ = 0;
4444
}
@@ -62,7 +62,7 @@ void primary_cpu_entry(void)
6262

6363
#define IOREMAP_SIZE (1ul << 30)
6464

65-
#ifndef ARCH_KERNEL_IN_HIGH_VA
65+
#ifndef ARCH_REMAP_KERNEL
6666
#define IOREMAP_VEND USER_VADDR_START
6767
#else
6868
#define IOREMAP_VEND 0ul

bsp/cvitek/cv18xx_risc-v/board/board.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void init_bss(void)
3838
unsigned int *dst;
3939

4040
dst = &__bss_start;
41-
while (dst < &__bss_end)
41+
while ((rt_ubase_t)dst < (rt_ubase_t)&__bss_end)
4242
{
4343
*dst++ = 0;
4444
}
@@ -62,7 +62,7 @@ void primary_cpu_entry(void)
6262

6363
#define IOREMAP_SIZE (1ul << 30)
6464

65-
#ifndef ARCH_KERNEL_IN_HIGH_VA
65+
#ifndef ARCH_REMAP_KERNEL
6666
#define IOREMAP_VEND USER_VADDR_START
6767
#else
6868
#define IOREMAP_VEND 0ul

0 commit comments

Comments
 (0)