arch: risc-v: Assign dedicated virtual addresses for text and heap

Summary:
- Current RISC-V/NuttX implementation assumes that text/data/heap
  areas are continuous. In fact, CONFIG_ARCH_TEXT_VBASE and
  CONFIG_ARCH_HEAP_VBASE are not used for memory allocation.
- This commit assigns dedicated virtual addresses for text and heap
  which are the same approach to ARM-v7A/NuttX implementation.

Impact:
- None

Testing:
- Tested with rv-virt:knsh64 (will be updated later)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa
2022-08-30 20:54:16 +09:00
committed by Xiang Xiao
parent bf6cbbca5d
commit e2f0f431d9
+8
View File
@@ -377,11 +377,19 @@ int up_addrenv_create(size_t textsize, size_t datasize, size_t heapsize,
/* Calculate the base addresses for convenience */
#if (CONFIG_ARCH_TEXT_VBASE != 0x0) && (CONFIG_ARCH_HEAP_VBASE != 0x0)
resvbase = CONFIG_ARCH_DATA_VBASE;
resvsize = ARCH_DATA_RESERVE_SIZE;
textbase = CONFIG_ARCH_TEXT_VBASE;
database = resvbase + MM_PGALIGNUP(resvsize);
heapbase = CONFIG_ARCH_HEAP_VBASE;
#else
resvbase = ADDRENV_VBASE;
resvsize = ARCH_DATA_RESERVE_SIZE;
textbase = resvbase + MM_PGALIGNUP(resvsize);
database = textbase + MM_PGALIGNUP(textsize);
heapbase = database + MM_PGALIGNUP(datasize);
#endif
/* Allocate 1 extra page for heap, temporary fix for #5811 */