x64: Fix stack alignment in vertex decoder, just because.

This commit is contained in:
Henrik Rydgård
2020-09-12 16:10:17 +02:00
parent f595f7368f
commit 7f27f569d7
+11 -3
View File
@@ -167,7 +167,7 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int
BeginWrite();
const u8 *start = this->AlignCode16();
#ifdef _M_IX86
#if PPSSPP_ARCH(X86)
// Store register values
PUSH(ESI);
PUSH(EDI);
@@ -179,12 +179,20 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int
MOV(32, R(srcReg), MDisp(ESP, 16 + offset + 0));
MOV(32, R(dstReg), MDisp(ESP, 16 + offset + 4));
MOV(32, R(counterReg), MDisp(ESP, 16 + offset + 8));
const uint8_t STACK_FIXED_ALLOC = 64;
#else
// Parameters automatically fall into place.
// This will align the stack properly to 16 bytes (the call of this function pushed RIP, which is 8 bytes).
const uint8_t STACK_FIXED_ALLOC = 64 + 8;
#endif
// Allocate temporary storage on the stack.
SUB(PTRBITS, R(ESP), Imm8(STACK_FIXED_ALLOC));
// Save XMM4/XMM5 which apparently can be problematic?
// Actually, if they are, it must be a compiler bug because they SHOULD be ok.
// So I won't bother.
SUB(PTRBITS, R(ESP), Imm8(64));
MOVUPS(MDisp(ESP, 0), XMM4);
MOVUPS(MDisp(ESP, 16), XMM5);
MOVUPS(MDisp(ESP, 32), XMM6);
@@ -265,7 +273,7 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int
MOVUPS(XMM5, MDisp(ESP, 16));
MOVUPS(XMM6, MDisp(ESP, 32));
MOVUPS(XMM7, MDisp(ESP, 48));
ADD(PTRBITS, R(ESP), Imm8(64));
ADD(PTRBITS, R(ESP), Imm8(STACK_FIXED_ALLOC));
#ifdef _M_IX86
// Restore register values