Just save XMM0-XMM15 on x64.

Not really sure why but seems like VS2010 expects XMM4 to be preserved.

Fixes headless on x64.
This commit is contained in:
Unknown W. Brackets committed 2013-09-16 23:17:34 -07:00
1 parent 0c6fbb461d
commit 3e6df2d7aa
2 files changed
+11 -9

No files matched your search

+8 -6
View File
@@ -478,7 +478,9 @@ unsigned int XEmitter::ABI_GetAlignedFrameSize(unsigned int frameSize) {
#ifdef _WIN32
// The Windows x64 ABI requires XMM6 - XMM15 to be callee saved. 10 regs.
const int XMM_STACK_SPACE = 10 * 16;
// But, not saving XMM4 and XMM5 breaks things in VS 2010, even though they are volatile regs.
// Let's just save all 16.
const int XMM_STACK_SPACE = 16 * 16;
// Win64 Specific Code
void XEmitter::ABI_PushAllCalleeSavedRegsAndAdjustStack() {
@@ -495,13 +497,13 @@ void XEmitter::ABI_PushAllCalleeSavedRegsAndAdjustStack() {
// Do this after aligning, beacuse before it's offset by 8.
SUB(64, R(RSP), Imm32(XMM_STACK_SPACE));
for (int i = 0; i < 10; ++i)
MOVAPS(MDisp(RSP, i * 16), (X64Reg)(XMM6 + i));
for (int i = 0; i < 16; ++i)
MOVAPS(MDisp(RSP, i * 16), (X64Reg)(XMM0 + i));
}
void XEmitter::ABI_PopAllCalleeSavedRegsAndAdjustStack() {
for (int i = 0; i < 10; ++i)
MOVAPS((X64Reg)(XMM6 + i), MDisp(RSP, i * 16));
for (int i = 0; i < 16; ++i)
MOVAPS((X64Reg)(XMM0 + i), MDisp(RSP, i * 16));
ADD(64, R(RSP), Imm32(XMM_STACK_SPACE));
ABI_RestoreStack(0);
@@ -525,7 +527,7 @@ void XEmitter::ABI_PushAllCallerSavedRegsAndAdjustStack() {
PUSH(R9);
PUSH(R10);
PUSH(R11);
// Callers preserve XMM4-5 (XMM0-3 are args.) But we don't need them usually.
// TODO: Callers preserve XMM4-5 (XMM0-3 are args.)
ABI_AlignStack(0);
}
+3 -3
View File
@@ -138,7 +138,7 @@ int main(int argc, const char* argv[])
const char *mountIso = 0;
const char *screenshotFilename = 0;
bool readMount = false;
double timeout = -1.0;
float timeout = std::numeric_limits<float>::infinity();
for (int i = 1; i < argc; i++)
{
@@ -304,7 +304,7 @@ int main(int argc, const char* argv[])
time_update();
bool doCompare = true;
double deadline = timeout < 0.0 ? std::numeric_limits<float>::infinity() : time_now() + timeout;
double deadline = time_now() + timeout;
coreState = CORE_RUNNING;
while (coreState == CORE_RUNNING)
@@ -318,7 +318,7 @@ int main(int argc, const char* argv[])
headlessHost->SwapBuffers();
}
time_update();
if (time_now() > deadline) {
if (time_now_d() > deadline) {
// Don't compare, print the output at least up to this point, and bail.
printf("%s", output.c_str());
doCompare = false;