ysyx-workbench/abstract-machine/am/include/arch/native.h
xinyangli 8e4feb4010 NJU-ProjectN/abstract-machine ics2023 initialized
NJU-ProjectN/abstract-machine 3348db971fd860be5cb28e21c18f9d0e65d0c96a Merge pull request #8 from Jasonyanyusong/master
2023-12-21 00:20:42 +08:00

26 lines
520 B
C

#ifndef ARCH_H__
#define ARCH_H__
#ifndef __USE_GNU
# define __USE_GNU
#endif
#include <ucontext.h>
struct Context {
uintptr_t ksp;
void *vm_head;
ucontext_t uc;
// skip the red zone of the stack frame, see the amd64 ABI manual for details
uint8_t redzone[128];
};
#define GPR1 uc.uc_mcontext.gregs[REG_RDI]
#define GPR2 uc.uc_mcontext.gregs[REG_RSI]
#define GPR3 uc.uc_mcontext.gregs[REG_RDX]
#define GPR4 uc.uc_mcontext.gregs[REG_RCX]
#define GPRx uc.uc_mcontext.gregs[REG_RAX]
#undef __USE_GNU
#endif