abstract-machine/am/include/arch/riscv.h

31 lines
527 B
C

#ifndef ARCH_H__
#define ARCH_H__
#include <stdint.h>
#ifdef __riscv_e
#define NR_REGS 16
#else
#define NR_REGS 32
#endif
struct Context {
//The order of these members should match trap.S, pay attention to pdir.
uintptr_t gpr[NR_REGS];
uintptr_t mcause;
uintptr_t mstatus;
uintptr_t mepc;
void *pdir;
};
#ifdef __riscv_e
#define GPR1 gpr[15] // a5
#else
#define GPR1 gpr[17] // a7
#endif
#define GPR2 gpr[10] //a0
#define GPR3 gpr[11] //a1
#define GPR4 gpr[12] //a2
#define GPRx gpr[10] //a0, return value
#endif