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:
bushing 2008-12-25 02:53:56 +00:00
parent 84711122ee
commit 34b92fe7c5
5 changed files with 18 additions and 12 deletions

View File

@ -31,7 +31,6 @@ compileFlags = [
'-fno-strict-aliasing',
'-msse2',
'-fvisibility=hidden',
# '-mstackrealign',
#'-fomit-frame-pointer'
]

View File

@ -50,6 +50,14 @@
#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
#ifdef _WIN32
#define strcasecmp _stricmp

View File

@ -564,7 +564,7 @@ void Write32(const u32 _Data, const u32 _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 (!fifo.bFF_GPLinkEnable)

View File

@ -64,7 +64,7 @@ void ResetGatherPipe()
m_gatherPipeCount = 0;
}
void CheckGatherPipe()
void STACKALIGN CheckGatherPipe()
{
while (m_gatherPipeCount >= GATHER_PIPE_SIZE)
{
@ -75,16 +75,15 @@ void CheckGatherPipe()
// move back the spill bytes
m_gatherPipeCount -= GATHER_PIPE_SIZE;
// This could be dangerous, memmove or ?
// Assuming that memcpy does its thing in the ordinary direction, there should be no problem.
// 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);
for (u32 i=0; i < m_gatherPipeCount; i++)
m_gatherPipe[i] = m_gatherPipe[i + GATHER_PIPE_SIZE];
// increase the CPUWritePointer
CPeripheralInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
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)
CPeripheralInterface::Fifo_CPUWritePointer = CPeripheralInterface::Fifo_CPUBase;

View File

@ -340,7 +340,7 @@ namespace CPUCompare
JMP(asm_routines.testExceptions, true);
}
void Jit64::Run()
void STACKALIGN Jit64::Run()
{
CompiledCode pExecAddr = (CompiledCode)asm_routines.enterCode;
pExecAddr();
@ -359,7 +359,7 @@ namespace CPUCompare
pExecAddr();*/
}
void Jit64::Jit(u32 em_address)
void STACKALIGN Jit64::Jit(u32 em_address)
{
if (GetSpaceLeft() < 0x10000 || blocks.IsFull())
{