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

xiaoxiang pushed a commit to branch releases/12.7
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 835aac23b701670e44eccc9aef1f57e978717b0f
Author: chenxiaoyi <[email protected]>
AuthorDate: Tue Jul 9 09:57:24 2024 +0800

    sim: change the type of xcpt_reg_t
    
    Signed-off-by: chenxiaoyi <[email protected]>
---
 arch/sim/include/setjmp.h            | 3 ++-
 arch/sim/src/sim/sim_copyfullstate.c | 2 +-
 arch/sim/src/sim/sim_fork.c          | 8 ++++----
 arch/sim/src/sim/sim_internal.h      | 3 ++-
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/sim/include/setjmp.h b/arch/sim/include/setjmp.h
index 879e31c0f2..ef458e65f1 100644
--- a/arch/sim/include/setjmp.h
+++ b/arch/sim/include/setjmp.h
@@ -27,6 +27,7 @@
 
 #include <nuttx/config.h>
 #include <nuttx/compiler.h>
+#include <sys/types.h>
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -156,7 +157,7 @@
 
 #ifndef __ASSEMBLY__
 
-typedef unsigned long xcpt_reg_t;
+typedef size_t xcpt_reg_t;
 typedef xcpt_reg_t jmp_buf[XCPTCONTEXT_REGS];
 
 #endif
diff --git a/arch/sim/src/sim/sim_copyfullstate.c 
b/arch/sim/src/sim/sim_copyfullstate.c
index fc9fef4c66..09c3e8c24b 100644
--- a/arch/sim/src/sim/sim_copyfullstate.c
+++ b/arch/sim/src/sim/sim_copyfullstate.c
@@ -41,7 +41,7 @@
  *
  ****************************************************************************/
 
-void sim_copyfullstate(unsigned long *dest, unsigned long *src)
+void sim_copyfullstate(xcpt_reg_t *dest, xcpt_reg_t *src)
 {
   int i;
 
diff --git a/arch/sim/src/sim/sim_fork.c b/arch/sim/src/sim/sim_fork.c
index ec14cae37f..0f9cd5d4e8 100644
--- a/arch/sim/src/sim/sim_fork.c
+++ b/arch/sim/src/sim/sim_fork.c
@@ -99,7 +99,7 @@ pid_t sim_fork(const xcpt_reg_t *context)
   xcpt_reg_t stackutil;
 
   sinfo("fork context [%p]:\n", context);
-  sinfo("  frame pointer:%lx sp:%lx pc:%lx\n",
+  sinfo("  frame pointer:%zx sp:%zx pc:%zx\n",
         context[JB_FP], context[JB_SP], context[JB_PC]);
 
   /* Allocate and initialize a TCB for the child task. */
@@ -124,7 +124,7 @@ pid_t sim_fork(const xcpt_reg_t *context)
   DEBUGASSERT(stacktop > context[JB_SP]);
   stackutil = stacktop - context[JB_SP];
 
-  sinfo("Parent: stackutil:%lu\n", stackutil);
+  sinfo("Parent: stackutil:%zu\n", stackutil);
 
   /* Make some feeble effort to preserve the stack contents.  This is
    * feeble because the stack surely contains invalid pointers and other
@@ -152,9 +152,9 @@ pid_t sim_fork(const xcpt_reg_t *context)
       newfp = context[JB_FP];
     }
 
-  sinfo("Old stack top:%lx SP:%lx FP:%lx\n",
+  sinfo("Old stack top:%zx SP:%zx FP:%zx\n",
         stacktop, context[JB_SP], context[JB_FP]);
-  sinfo("New stack top:%lx SP:%lx FP:%lx\n",
+  sinfo("New stack top:%zx SP:%zx FP:%zx\n",
         newtop, newsp, newfp);
 
   /* Update the stack pointer, frame pointer, and volatile registers.  When
diff --git a/arch/sim/src/sim/sim_internal.h b/arch/sim/src/sim/sim_internal.h
index bad8bd8a8c..5660d9d129 100644
--- a/arch/sim/src/sim/sim_internal.h
+++ b/arch/sim/src/sim/sim_internal.h
@@ -180,6 +180,7 @@
  ****************************************************************************/
 
 typedef int pid_t;
+typedef size_t xcpt_reg_t;
 
 /****************************************************************************
  * Public Type Definitions
@@ -203,7 +204,7 @@ extern char **g_argv;
 
 /* Context switching */
 
-void sim_copyfullstate(unsigned long *dest, unsigned long *src);
+void sim_copyfullstate(xcpt_reg_t *dest, xcpt_reg_t *src);
 void *sim_doirq(int irq, void *regs);
 
 /* sim_hostmisc.c ***********************************************************/

Reply via email to