diff --git a/Source/Core/Common/Src/ABI.cpp b/Source/Core/Common/Src/ABI.cpp index c182f5e0cb..ee2ddb65da 100644 --- a/Source/Core/Common/Src/ABI.cpp +++ b/Source/Core/Common/Src/ABI.cpp @@ -29,6 +29,14 @@ void ABI_CallFunctionR(void *func, X64Reg reg1) { ADD(32, R(ESP), Imm8(4)); } +void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2) +{ + PUSH(32, arg1); + PUSH(32, Imm32(param2)); + CALL(func); + ADD(32, R(ESP), Imm8(8)); +} + void ABI_PushAllCalleeSavedRegsAndAdjustStack() { PUSH(EBP); PUSH(EBX); @@ -66,6 +74,14 @@ void ABI_CallFunctionR(void *func, X64Reg reg1) { CALL(func); } +void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2) +{ + if (arg1.IsSimpleReg(ABI_PARAM1)) + MOV(32, R(ABI_PARAM1), arg1); + MOV(32, R(ABI_PARAM2), Imm32(param2)); + CALL(func); +} + #ifdef _WIN32 // Win64 Specific Code // ==================================== @@ -74,7 +90,7 @@ void ABI_PushAllCalleeSavedRegsAndAdjustStack() { PUSH(RBX); PUSH(RSI); PUSH(RDI); - PUSH(RBP); + //PUSH(RBP); PUSH(R12); PUSH(R13); PUSH(R14); @@ -89,7 +105,7 @@ void ABI_PopAllCalleeSavedRegsAndAdjustStack() { POP(R14); POP(R13); POP(R12); - POP(RBP); + //POP(RBP); POP(RDI); POP(RSI); POP(RBX); @@ -99,11 +115,21 @@ void ABI_PopAllCalleeSavedRegsAndAdjustStack() { // Unix64 Specific Code // ==================================== void ABI_PushAllCalleeSavedRegsAndAdjustStack() { - + PUSH(RBX); + PUSH(RBP); + PUSH(R12); + PUSH(R13); + PUSH(R14); + PUSH(R15); } void ABI_PopAllCalleeSavedRegsAndAdjustStack() { - + POP(R15); + POP(R14); + POP(R13); + POP(R12); + POP(RBP); + POP(RBX); } #endif diff --git a/Source/Core/Common/Src/ABI.h b/Source/Core/Common/Src/ABI.h index 1f610b6db1..5bfcae59e1 100644 --- a/Source/Core/Common/Src/ABI.h +++ b/Source/Core/Common/Src/ABI.h @@ -83,6 +83,7 @@ // These will destroy the 1 or 2 first "parameter regs". void ABI_CallFunctionC(void *func, u32 param1); void ABI_CallFunctionCC(void *func, u32 param1, u32 param2); +void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2); // Pass a register as a paremeter. void ABI_CallFunctionR(void *func, Gen::X64Reg reg1); diff --git a/Source/Core/Common/Src/x64Emitter.h b/Source/Core/Common/Src/x64Emitter.h index a408b36adf..472079e8d8 100644 --- a/Source/Core/Common/Src/x64Emitter.h +++ b/Source/Core/Common/Src/x64Emitter.h @@ -132,7 +132,11 @@ namespace Gen void WriteNormalOp(bool toRM, NormalOp op, const OpArg &operand, int bits) const; bool IsImm() const {return scale == SCALE_IMM8 || scale == SCALE_IMM16 || scale == SCALE_IMM32 || scale == SCALE_IMM64;} bool IsSimpleReg() const {return scale == SCALE_NONE;} - + bool IsSimpleReg(X64Reg reg) const { + if (!IsSimpleReg()) + return false; + return GetSimpleReg() == reg; + } bool CanDoOpWith(OpArg &other) const { if (IsSimpleReg()) return true; diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp index 043b08e29e..429d40bcd8 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp @@ -356,7 +356,7 @@ namespace Jit64 case 36: accessSize = 32; break; //stw case 44: accessSize = 16; break; //sth case 38: accessSize = 8; break; //stb - default: _assert_msg_(DYNA_REC,0,"AWETKLJASDLKF"); return; + default: _assert_msg_(DYNA_REC, 0, "AWETKLJASDLKF"); return; } if (gpr.R(a).IsImm() && !update)