feat: riscv64 linux support
This commit is contained in:
parent
0e37b47498
commit
a7b830fedd
5 changed files with 52 additions and 29 deletions
|
@ -11,8 +11,10 @@ struct Context {
|
|||
uintptr_t ksp;
|
||||
void *vm_head;
|
||||
ucontext_t uc;
|
||||
#ifdef __x86_64__
|
||||
// skip the red zone of the stack frame, see the amd64 ABI manual for details
|
||||
uint8_t redzone[128];
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
@ -21,12 +23,21 @@ struct Context {
|
|||
#define GPR3 uc.uc_mcontext.gregs[REG_RDX]
|
||||
#define GPR4 uc.uc_mcontext.gregs[REG_RCX]
|
||||
#define GPRx uc.uc_mcontext.gregs[REG_RAX]
|
||||
#elif __aarch64__
|
||||
#elif defined(__aarch64__)
|
||||
#define GPR1 uc.uc_mcontext.regs[0]
|
||||
#define GPR2 uc.uc_mcontext.regs[1]
|
||||
#define GPR3 uc.uc_mcontext.regs[2]
|
||||
#define GPR4 uc.uc_mcontext.regs[3]
|
||||
#define GPRx uc.uc_mcontext.regs[0]
|
||||
#elif defined(__riscv)
|
||||
// FIXME: may be wrong
|
||||
#define GPR1 uc.uc_mcontext.__gregs[REG_A0]
|
||||
#define GPR2 uc.uc_mcontext.__gregs[REG_A0+1]
|
||||
#define GPR3 uc.uc_mcontext.__gregs[REG_A0+2]
|
||||
#define GPR4 uc.uc_mcontext.__gregs[REG_A0+3]
|
||||
#define GPRx uc.uc_mcontext.__gregs[REG_A0+4]
|
||||
#else
|
||||
#error Unsupported architecture
|
||||
#endif
|
||||
|
||||
#undef __USE_GNU
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue