We need to be more careful about stack alignment on Darwin. These patches
fix the alignment of gcc-generated code (as opposed to JIT code). There are probably more places this is needed :( git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1651 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
84711122ee
commit
34b92fe7c5
|
@ -31,7 +31,6 @@ compileFlags = [
|
||||||
'-fno-strict-aliasing',
|
'-fno-strict-aliasing',
|
||||||
'-msse2',
|
'-msse2',
|
||||||
'-fvisibility=hidden',
|
'-fvisibility=hidden',
|
||||||
# '-mstackrealign',
|
|
||||||
#'-fomit-frame-pointer'
|
#'-fomit-frame-pointer'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,14 @@
|
||||||
|
|
||||||
#include "Paths.h"
|
#include "Paths.h"
|
||||||
|
|
||||||
|
// Darwin ABI requires that stack frames be aligned to 16-byte boundaries.
|
||||||
|
// This probably wouldn't break anyone either, but hey
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#define STACKALIGN __attribute__((__force_align_arg_pointer__))
|
||||||
|
#else
|
||||||
|
#define STACKALIGN
|
||||||
|
#endif
|
||||||
|
|
||||||
// Function Cross-Compatibility
|
// Function Cross-Compatibility
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define strcasecmp _stricmp
|
#define strcasecmp _stricmp
|
||||||
|
|
|
@ -564,7 +564,7 @@ void Write32(const u32 _Data, const u32 _Address)
|
||||||
_dbg_assert_msg_(COMMANDPROCESSOR, 0, "Write32 at CommandProccessor at 0x%08x", _Address);
|
_dbg_assert_msg_(COMMANDPROCESSOR, 0, "Write32 at CommandProccessor at 0x%08x", _Address);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GatherPipeBursted()
|
void STACKALIGN GatherPipeBursted()
|
||||||
{
|
{
|
||||||
// if we aren't linked, we don't care about gather pipe data
|
// if we aren't linked, we don't care about gather pipe data
|
||||||
if (!fifo.bFF_GPLinkEnable)
|
if (!fifo.bFF_GPLinkEnable)
|
||||||
|
|
|
@ -64,7 +64,7 @@ void ResetGatherPipe()
|
||||||
m_gatherPipeCount = 0;
|
m_gatherPipeCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckGatherPipe()
|
void STACKALIGN CheckGatherPipe()
|
||||||
{
|
{
|
||||||
while (m_gatherPipeCount >= GATHER_PIPE_SIZE)
|
while (m_gatherPipeCount >= GATHER_PIPE_SIZE)
|
||||||
{
|
{
|
||||||
|
@ -75,16 +75,15 @@ void CheckGatherPipe()
|
||||||
|
|
||||||
// move back the spill bytes
|
// move back the spill bytes
|
||||||
m_gatherPipeCount -= GATHER_PIPE_SIZE;
|
m_gatherPipeCount -= GATHER_PIPE_SIZE;
|
||||||
// This could be dangerous, memmove or ?
|
for (u32 i=0; i < m_gatherPipeCount; i++)
|
||||||
// Assuming that memcpy does its thing in the ordinary direction, there should be no problem.
|
m_gatherPipe[i] = m_gatherPipe[i + GATHER_PIPE_SIZE];
|
||||||
// Actually, this shouldn't ever be necessary. If we're above 2 "blocks" of data,
|
|
||||||
// the above memcpy could take care of that easily. TODO
|
|
||||||
memmove(m_gatherPipe, m_gatherPipe + GATHER_PIPE_SIZE, m_gatherPipeCount);
|
|
||||||
|
|
||||||
// increase the CPUWritePointer
|
// increase the CPUWritePointer
|
||||||
CPeripheralInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
|
CPeripheralInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
|
||||||
|
|
||||||
if (CPeripheralInterface::Fifo_CPUWritePointer > CPeripheralInterface::Fifo_CPUEnd)
|
if (CPeripheralInterface::Fifo_CPUWritePointer > CPeripheralInterface::Fifo_CPUEnd)
|
||||||
_assert_msg_(DYNA_REC, 0, "Fifo_CPUWritePointer out of bounds: %08x (end = %08x)", CPeripheralInterface::Fifo_CPUWritePointer, CPeripheralInterface::Fifo_CPUEnd);
|
_assert_msg_(DYNA_REC, 0, "Fifo_CPUWritePointer out of bounds: %08x (end = %08x)",
|
||||||
|
CPeripheralInterface::Fifo_CPUWritePointer, CPeripheralInterface::Fifo_CPUEnd);
|
||||||
|
|
||||||
if (CPeripheralInterface::Fifo_CPUWritePointer >= CPeripheralInterface::Fifo_CPUEnd)
|
if (CPeripheralInterface::Fifo_CPUWritePointer >= CPeripheralInterface::Fifo_CPUEnd)
|
||||||
CPeripheralInterface::Fifo_CPUWritePointer = CPeripheralInterface::Fifo_CPUBase;
|
CPeripheralInterface::Fifo_CPUWritePointer = CPeripheralInterface::Fifo_CPUBase;
|
||||||
|
|
|
@ -340,7 +340,7 @@ namespace CPUCompare
|
||||||
JMP(asm_routines.testExceptions, true);
|
JMP(asm_routines.testExceptions, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Jit64::Run()
|
void STACKALIGN Jit64::Run()
|
||||||
{
|
{
|
||||||
CompiledCode pExecAddr = (CompiledCode)asm_routines.enterCode;
|
CompiledCode pExecAddr = (CompiledCode)asm_routines.enterCode;
|
||||||
pExecAddr();
|
pExecAddr();
|
||||||
|
@ -359,7 +359,7 @@ namespace CPUCompare
|
||||||
pExecAddr();*/
|
pExecAddr();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void Jit64::Jit(u32 em_address)
|
void STACKALIGN Jit64::Jit(u32 em_address)
|
||||||
{
|
{
|
||||||
if (GetSpaceLeft() < 0x10000 || blocks.IsFull())
|
if (GetSpaceLeft() < 0x10000 || blocks.IsFull())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue