You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/06/27 18:31:15 UTC

(nuttx) branch master updated: arch/x86_64: addrenv should add offset only for RAM region

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

xiaoxiang 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 7afee44c22 arch/x86_64: addrenv should add offset only for RAM region
7afee44c22 is described below

commit 7afee44c22318015d401ad04f5a605aa22a0fd9b
Author: p-szafonimateusz <p-...@xiaomi.com>
AuthorDate: Thu Jun 27 11:57:17 2024 +0200

    arch/x86_64: addrenv should add offset only for RAM region
    
    addrenv should add LOAD offset only for RAM region, the rest of memory is maped 1:1
    
    Signed-off-by: p-szafonimateusz <p-...@xiaomi.com>
---
 arch/x86_64/src/common/x86_64_initialize.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/arch/x86_64/src/common/x86_64_initialize.c b/arch/x86_64/src/common/x86_64_initialize.c
index 381c2b0aa4..ca289b46ac 100644
--- a/arch/x86_64/src/common/x86_64_initialize.c
+++ b/arch/x86_64/src/common/x86_64_initialize.c
@@ -39,13 +39,24 @@
  ****************************************************************************/
 
 #ifdef CONFIG_DEV_SIMPLE_ADDRENV
-/* Map 1:1 with 0x100000000 offset */
 
-struct simple_addrenv_s g_addrenv =
+static const struct simple_addrenv_s g_addrenv[] =
 {
-  .va   = X86_64_LOAD_OFFSET,
-  .pa   = 0,
-  .size = 0xffffffffffffffff
+  /* Map 1:1 with 0x100000000 offset for RAM */
+
+  {
+    .va   = X86_64_LOAD_OFFSET,
+    .pa   = 0,
+    .size = CONFIG_RAM_SIZE
+  },
+
+  /* Map the rest of memory as 1:1 */
+
+  {
+    .va   = 0,
+    .pa   = 0,
+    .size = 0
+  }
 };
 #endif
 
@@ -64,7 +75,7 @@ struct simple_addrenv_s g_addrenv =
 static void x86_64_addrenv_init(void)
 {
 #ifdef CONFIG_DEV_SIMPLE_ADDRENV
-  simple_addrenv_initialize(&g_addrenv);
+  simple_addrenv_initialize(g_addrenv);
 #endif
 }