xinyangli
8e4feb4010
NJU-ProjectN/abstract-machine 3348db971fd860be5cb28e21c18f9d0e65d0c96a Merge pull request #8 from Jasonyanyusong/master
27 lines
419 B
C
27 lines
419 B
C
#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[NR_REGS], mstatus;
|
|
void *pdir;
|
|
};
|
|
|
|
#ifdef __riscv_e
|
|
#define GPR1 gpr[15] // a5
|
|
#else
|
|
#define GPR1 gpr[17] // a7
|
|
#endif
|
|
|
|
#define GPR2 gpr[0]
|
|
#define GPR3 gpr[0]
|
|
#define GPR4 gpr[0]
|
|
#define GPRx gpr[0]
|
|
|
|
#endif
|