From b1586e033693a3616b988200658342d6ff90569c Mon Sep 17 00:00:00 2001 From: Sin_kider Date: Tue, 8 Aug 2023 16:56:21 +0800 Subject: [PATCH] fix: Modify the register number into a macro definition --- am/include/arch/riscv.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/am/include/arch/riscv.h b/am/include/arch/riscv.h index 9c9de20..9709050 100644 --- a/am/include/arch/riscv.h +++ b/am/include/arch/riscv.h @@ -1,9 +1,15 @@ #ifndef ARCH_H__ #define ARCH_H__ +#ifdef __riscv_e +#define NR_REGS 16 +#else +#define NR_REGS 32 +#endif + struct Context { // TODO: fix the order of these members to match trap.S - uintptr_t mepc, mcause, gpr[32], mstatus; + uintptr_t mepc, mcause, gpr[NR_REGS], mstatus; void *pdir; };