mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 05:40:01 -06:00
Fixed the crash in DSP LLE JIT on x64 by aligning the stack.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5357 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -106,7 +106,7 @@ void XEmitter::ABI_CallFunctionCCP(void *func, u32 param1, u32 param2, void *par
|
||||
ABI_RestoreStack(3 * 4);
|
||||
}
|
||||
|
||||
// Pass a register as a paremeter.
|
||||
// Pass a register as a parameter.
|
||||
void XEmitter::ABI_CallFunctionR(void *func, X64Reg reg1) {
|
||||
ABI_AlignStack(1 * 4);
|
||||
PUSH(32, R(reg1));
|
||||
@ -228,14 +228,14 @@ void XEmitter::ABI_CallFunctionCCP(void *func, u32 param1, u32 param2, void *par
|
||||
CALL(func);
|
||||
}
|
||||
|
||||
// Pass a register as a paremeter.
|
||||
// Pass a register as a parameter.
|
||||
void XEmitter::ABI_CallFunctionR(void *func, X64Reg reg1) {
|
||||
if (reg1 != ABI_PARAM1)
|
||||
MOV(32, R(ABI_PARAM1), R(reg1));
|
||||
CALL(func);
|
||||
}
|
||||
|
||||
// Pass two registers as paremeters.
|
||||
// Pass two registers as parameters.
|
||||
void XEmitter::ABI_CallFunctionRR(void *func, X64Reg reg1, X64Reg reg2) {
|
||||
if (reg2 != ABI_PARAM1) {
|
||||
if (reg1 != ABI_PARAM1)
|
||||
@ -263,12 +263,6 @@ unsigned int XEmitter::ABI_GetAlignedFrameSize(unsigned int frameSize) {
|
||||
return frameSize;
|
||||
}
|
||||
|
||||
void XEmitter::ABI_AlignStack(unsigned int /*frameSize*/) {
|
||||
}
|
||||
|
||||
void XEmitter::ABI_RestoreStack(unsigned int /*frameSize*/) {
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
// Win64 Specific Code
|
||||
@ -283,11 +277,11 @@ void XEmitter::ABI_PushAllCalleeSavedRegsAndAdjustStack() {
|
||||
PUSH(R14);
|
||||
PUSH(R15);
|
||||
//TODO: Also preserve XMM0-3?
|
||||
SUB(64, R(RSP), Imm8(0x28));
|
||||
ABI_AlignStack(0);
|
||||
}
|
||||
|
||||
void XEmitter::ABI_PopAllCalleeSavedRegsAndAdjustStack() {
|
||||
ADD(64, R(RSP), Imm8(0x28));
|
||||
ABI_RestoreStack(0);
|
||||
POP(R15);
|
||||
POP(R14);
|
||||
POP(R13);
|
||||
@ -309,11 +303,11 @@ void XEmitter::ABI_PushAllCallerSavedRegsAndAdjustStack() {
|
||||
PUSH(R10);
|
||||
PUSH(R11);
|
||||
//TODO: Also preserve XMM0-15?
|
||||
SUB(64, R(RSP), Imm8(0x28));
|
||||
ABI_AlignStack(0);
|
||||
}
|
||||
|
||||
void XEmitter::ABI_PopAllCallerSavedRegsAndAdjustStack() {
|
||||
ADD(64, R(RSP), Imm8(0x28));
|
||||
ABI_RestoreStack(0);
|
||||
POP(R11);
|
||||
POP(R10);
|
||||
POP(R9);
|
||||
@ -324,6 +318,14 @@ void XEmitter::ABI_PopAllCallerSavedRegsAndAdjustStack() {
|
||||
POP(RCX);
|
||||
}
|
||||
|
||||
void XEmitter::ABI_AlignStack(unsigned int /*frameSize*/) {
|
||||
SUB(64, R(RSP), Imm8(0x28));
|
||||
}
|
||||
|
||||
void XEmitter::ABI_RestoreStack(unsigned int /*frameSize*/) {
|
||||
ADD(64, R(RSP), Imm8(0x28));
|
||||
}
|
||||
|
||||
#else
|
||||
// Unix64 Specific Code
|
||||
void XEmitter::ABI_PushAllCalleeSavedRegsAndAdjustStack() {
|
||||
@ -370,6 +372,14 @@ void XEmitter::ABI_PopAllCallerSavedRegsAndAdjustStack() {
|
||||
POP(RCX);
|
||||
}
|
||||
|
||||
void XEmitter::ABI_AlignStack(unsigned int /*frameSize*/) {
|
||||
SUB(64, R(RSP), Imm8(0x08));
|
||||
}
|
||||
|
||||
void XEmitter::ABI_RestoreStack(unsigned int /*frameSize*/) {
|
||||
ADD(64, R(RSP), Imm8(0x08));
|
||||
}
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
#endif // 32bit
|
||||
|
Reference in New Issue
Block a user