This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e8575c39e riscv-v/pgalloc.h: Return kernel vaddr for kernel RAM paddr
3e8575c39e is described below

commit 3e8575c39e0078ca710cee36e7e1e4059efbf24b
Author: Ville Juven <ville.ju...@unikie.com>
AuthorDate: Wed Oct 4 15:57:29 2023 +0300

    riscv-v/pgalloc.h: Return kernel vaddr for kernel RAM paddr
    
    All kernel memory is mapped paddr=vaddr, so it is trivial to give mapping
    for kernel memory. Only interesting region should be kernel RAM, so omit
    kernel ROM and don't allow re-mapping it.
---
 arch/risc-v/src/common/pgalloc.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/risc-v/src/common/pgalloc.h b/arch/risc-v/src/common/pgalloc.h
index 40da298056..be39da0d3a 100644
--- a/arch/risc-v/src/common/pgalloc.h
+++ b/arch/risc-v/src/common/pgalloc.h
@@ -75,6 +75,10 @@ static inline uintptr_t riscv_pgvaddr(uintptr_t paddr)
     {
       return paddr - CONFIG_ARCH_PGPOOL_PBASE + CONFIG_ARCH_PGPOOL_VBASE;
     }
+  else if (paddr >= CONFIG_RAM_START && paddr < CONFIG_RAM_END)
+    {
+      return paddr - CONFIG_RAM_START + CONFIG_RAM_VSTART;
+    }
 
   return 0;
 }

Reply via email to