[macOS]: arm64, very early stage of Big Sur M1 native port.

This commit is contained in:
Christian Jullien 2021-02-21 08:38:39 +01:00
parent 97800177c9
commit e8bff295f9
2 changed files with 7 additions and 0 deletions

View File

@ -110,6 +110,7 @@ DEF-arm = $(DEF-arm-eabihf)
DEF-arm-NetBSD = $(DEF-arm-eabihf) -DTARGETOS_NetBSD
DEF-arm-wince = $(DEF-arm-eabihf) -DTCC_TARGET_PE
DEF-arm64 = -DTCC_TARGET_ARM64
DEF-arm64-osx = $(DEF-arm64) -DTCC_TARGET_MACHO
DEF-arm64-FreeBSD = $(DEF-arm64) -DTARGETOS_FreeBSD
DEF-arm64-NetBSD = $(DEF-arm64) -DTARGETOS_NetBSD
DEF-arm64-OpenBSD = $(DEF-arm64) -DTARGETOS_OpenBSD
@ -198,6 +199,7 @@ arm-vfp_FILES = $(arm_FILES)
arm-eabi_FILES = $(arm_FILES)
arm-eabihf_FILES = $(arm_FILES)
arm64_FILES = $(CORE_FILES) arm64-gen.c arm64-link.c arm64-asm.c
arm64-osx_FILES = $(arm64_FILES) tccmacho.c
c67_FILES = $(CORE_FILES) c67-gen.c c67-link.c tcccoff.c
riscv64_FILES = $(CORE_FILES) riscv64-gen.c riscv64-link.c riscv64-asm.c

View File

@ -716,6 +716,11 @@ static void rt_getcontext(ucontext_t *uc, rt_context *rc)
#elif defined(__arm__)
rc->ip = uc->uc_mcontext.arm_pc;
rc->fp = uc->uc_mcontext.arm_fp;
#elif defined(__aarch64__) && defined(__APPLE__)
// see:
// /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include/mach/arm/_structs.h
rc->ip = uc->uc_mcontext->__ss.__pc;
rc->fp = uc->uc_mcontext->__ss.__fp;
#elif defined(__aarch64__) && defined(__FreeBSD__)
rc->ip = uc->uc_mcontext.mc_gpregs.gp_elr; /* aka REG_PC */
rc->fp = uc->uc_mcontext.mc_gpregs.gp_x[29];