sim: change the type of xcpt_reg_t

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
This commit is contained in:
chenxiaoyi 2024-07-09 09:57:24 +08:00 committed by Xiang Xiao
parent 2f512f78bf
commit 835aac23b7
4 changed files with 9 additions and 7 deletions

View File

@ -27,6 +27,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/compiler.h> #include <nuttx/compiler.h>
#include <sys/types.h>
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -156,7 +157,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
typedef unsigned long xcpt_reg_t; typedef size_t xcpt_reg_t;
typedef xcpt_reg_t jmp_buf[XCPTCONTEXT_REGS]; typedef xcpt_reg_t jmp_buf[XCPTCONTEXT_REGS];
#endif #endif

View File

@ -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; int i;

View File

@ -99,7 +99,7 @@ pid_t sim_fork(const xcpt_reg_t *context)
xcpt_reg_t stackutil; xcpt_reg_t stackutil;
sinfo("fork context [%p]:\n", context); 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]); context[JB_FP], context[JB_SP], context[JB_PC]);
/* Allocate and initialize a TCB for the child task. */ /* 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]); DEBUGASSERT(stacktop > context[JB_SP]);
stackutil = 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 /* Make some feeble effort to preserve the stack contents. This is
* feeble because the stack surely contains invalid pointers and other * 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]; 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]); 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); newtop, newsp, newfp);
/* Update the stack pointer, frame pointer, and volatile registers. When /* Update the stack pointer, frame pointer, and volatile registers. When

View File

@ -180,6 +180,7 @@
****************************************************************************/ ****************************************************************************/
typedef int pid_t; typedef int pid_t;
typedef size_t xcpt_reg_t;
/**************************************************************************** /****************************************************************************
* Public Type Definitions * Public Type Definitions
@ -203,7 +204,7 @@ extern char **g_argv;
/* Context switching */ /* 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); void *sim_doirq(int irq, void *regs);
/* sim_hostmisc.c ***********************************************************/ /* sim_hostmisc.c ***********************************************************/