summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authornitsuja <nitsuja-@hotmail.com>2012-01-07 20:46:41 -0800
committernitsuja <nitsuja-@hotmail.com>2012-01-07 20:46:41 -0800
commit9ab69febe546ed498f3a6831c2c8ff363a373352 (patch)
tree111f0e518a09c7aa354f0f0931765bdf965b888e /Source/Core/Common
parentb33be736cd41292c964611385c1dc792364a1119 (diff)
fix for stack corruption caused by certain DSP LLE JIT ABI calls.
if you were getting crashes or freezes as a result of using the "DSP LLE on Thread" option, this might fix that.
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Src/ABI.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/Source/Core/Common/Src/ABI.cpp b/Source/Core/Common/Src/ABI.cpp
index 08e021f083..63a8e76934 100644
--- a/Source/Core/Common/Src/ABI.cpp
+++ b/Source/Core/Common/Src/ABI.cpp
@@ -189,7 +189,7 @@ unsigned int XEmitter::ABI_GetAlignedFrameSize(unsigned int frameSize) {
#ifdef __GNUC__
(frameSize + 15) & -16;
#else
- frameSize;
+ (frameSize + 3) & -4;
#endif
return alignedSize;
}
@@ -200,16 +200,15 @@ void XEmitter::ABI_AlignStack(unsigned int frameSize) {
// Linux requires the stack to be 16-byte aligned before calls that put SSE
// vectors on the stack, but since we do not keep track of which calls do that,
// it is effectively every call as well.
-// Windows binaries compiled with MSVC do not have such a restriction, but I
+// Windows binaries compiled with MSVC do not have such a restriction*, but I
// expect that GCC on Windows acts the same as GCC on Linux in this respect.
// It would be nice if someone could verify this.
-#ifdef __GNUC__
+// *However, the MSVC optimizing compiler assumes a 4-byte-aligned stack at times.
unsigned int fillSize =
ABI_GetAlignedFrameSize(frameSize) - (frameSize + 4);
if (fillSize != 0) {
SUB(32, R(ESP), Imm8(fillSize));
}
-#endif
}
void XEmitter::ABI_RestoreStack(unsigned int frameSize) {