diff --git a/SheepShaver/src/Unix/Linux/asm_linux.S b/SheepShaver/src/Unix/Linux/asm_linux.S index 79d698e5..d5362cf1 100644 --- a/SheepShaver/src/Unix/Linux/asm_linux.S +++ b/SheepShaver/src/Unix/Linux/asm_linux.S @@ -566,19 +566,19 @@ C_SYMBOL_NAME(execute_68k): * uint32 call_macos1(uint32 tvect{r3}, uint32 arg1{r4}) ... - Call MacOS routines */ -.macro prolog +ASM_MACRO_START prolog mflr r0 stw r0,4(r1) stwu r1,-64(r1) -.endm +ASM_MACRO_END -.macro epilog +ASM_MACRO_START epilog lwz r13,XLM_TOC(0) lwz r0,64+4(r1) mtlr r0 addi r1,r1,64 blr -.endm +ASM_MACRO_END ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(call_macos) C_SYMBOL_NAME(call_macos): diff --git a/SheepShaver/src/Unix/main_unix.cpp b/SheepShaver/src/Unix/main_unix.cpp index 8e69e3b4..4f15d6c4 100644 --- a/SheepShaver/src/Unix/main_unix.cpp +++ b/SheepShaver/src/Unix/main_unix.cpp @@ -165,6 +165,9 @@ struct sigregs { }; #if defined(__linux__) +#include +#define MACHINE_REGISTERS(scp) ((machine_regs *)(((ucontext_t *)scp)->uc_mcontext.regs)) + struct machine_regs : public pt_regs { u_long & cr() { return pt_regs::ccr; } @@ -179,12 +182,15 @@ struct machine_regs : public pt_regs u_long & gpr(int i) { return pt_regs::gpr[i]; } uint32 gpr(int i) const { return pt_regs::gpr[i]; } }; - -#include -#define MACHINE_REGISTERS(scp) ((machine_regs *)(((ucontext_t *)scp)->uc_mcontext.regs)) #endif #if defined(__APPLE__) && defined(__MACH__) +#include +extern "C" int sigaltstack(const struct sigaltstack *ss, struct sigaltstack *oss); + +#include +#define MACHINE_REGISTERS(scp) ((machine_regs *)(((ucontext_t *)scp)->uc_mcontext)) + struct machine_regs : public mcontext { uint32 & cr() { return ss.cr; } @@ -199,12 +205,6 @@ struct machine_regs : public mcontext uint32 & gpr(int i) { return (&ss.r0)[i]; } uint32 gpr(int i) const { return (&ss.r0)[i]; } }; - -#include -#define MACHINE_REGISTERS(scp) ((machine_regs *)(((ucontext_t *)scp)->uc_mcontext)) - -#include -extern "C" int sigaltstack(const struct sigaltstack *ss, struct sigaltstack *oss); #endif static void build_sigregs(sigregs *srp, machine_regs *mrp) diff --git a/SheepShaver/src/Unix/ppc_asm.tmpl b/SheepShaver/src/Unix/ppc_asm.tmpl index 59653a0c..08473ccb 100644 --- a/SheepShaver/src/Unix/ppc_asm.tmpl +++ b/SheepShaver/src/Unix/ppc_asm.tmpl @@ -1,11 +1,20 @@ #if (defined(__APPLE__) && defined(__MACH__)) -#define C_SYMBOL_NAME(X) _ ## X +#define C_SYMBOL_NAME(NAME) _ ## NAME +#define ASM_MACRO_END .endmacro +#endif + +/* Defaults for GNU assembler */ +#ifndef ASM_MACRO_START +#define ASM_MACRO_START .macro +#endif +#ifndef ASM_MACRO_END +#define ASM_MACRO_END .endm #endif #ifndef C_SYMBOL_NAME -#define C_SYMBOL_NAME(X) X +#define C_SYMBOL_NAME(NAME) NAME #endif #ifndef ASM_GLOBAL_DIRECTIVE -#define ASM_GLOBAL_DIRECTIVE .globl +#define ASM_GLOBAL_DIRECTIVE .globl #endif /* Register names */