riscv: Implement page-fault exception and on-demand paging

When an application is being loaded `up_addrenv_create ` calls
`create_region` to create the address environment. Only the first
entry is mapped when the region is created. Virtual memory that is
not mapped will trigger an exception when accessed. Other memory
pages are allocated and mapped on-demand. This enables setting
larger heap and stack for the process without compromising the
overall system memory.
This commit is contained in:
Tiago Medicci Serrano
2024-02-23 10:33:24 -03:00
committed by Xiang Xiao
parent ae9ef972c0
commit c67502d9b4
5 changed files with 242 additions and 2 deletions
+10
View File
@@ -903,6 +903,16 @@ config ARCH_PGPOOL_SIZE
endif # ARCH_PGPOOL_MAPPING
endif # ARCH_ADDRENV && ARCH_NEED_ADDRENV_MAPPING
config PAGING
bool "On-demand paging"
default n
depends on BUILD_KERNEL && ARCH_USE_MMU && !ARCH_ROMPGTABLE && !LEGACY_PAGING
---help---
If set =y in your configation file, this setting will enable on-demand
paging, which relies on a MMU to enable larger virtual memory spaces
and map it to physical memory on-demand (usually during a page-fault
exception).
menuconfig LEGACY_PAGING
bool "Legacy On-demand paging"
default n