On 3/28/2024 9:21 PM, yfliu2008 wrote:
> I am still trying to understand existing userland address envrionment
in NuttX kernel mode, I saw the following regions defined in
"arch/Kconfig": config ARCH_TEXT_VBASE, config ARCH_DATA_VBASE, config
ARCH_HEAP_VBASE, config ARCH_SHM_VBASE, config ARCH_KMAP_VBASE, config
ARCH_STACK_VBASE, config ARCH_PGPOOL_VBASE. I can understand most of
above, except the "ARCH_KMAP_VBASE" thing. But it doesn't look like
relating to UIO though.
I added most of those definitions back in 2014. They are used in the
addrenv logic for addrenv creation. ARCH_KMAP_VBASE was added later and
is used in arch/risc-v/src/common/riscv_addrenv_pgmap.c
There is inconsistent logic. For the older SAMA5, for example, all
fixed virtual address are listed in header files under
arch/arm/src/sama5/*_memorymap.h
I think that the use of Kconfig variables is fine for major landmarks in
the virtual address space, but a finer grained virtual memory map
probably should go in a header file as offsets from the configurable
VBASE addresses. Anything not dynamically allocated from the user heap
or via mmap probably should be a constant offset. The user head
allocations are already virtual, but not physically contiguous and
hence, not useful for UIO.