get SequentialThreadSupport to compile on the Mac
This commit is contained in:
@@ -4,26 +4,31 @@
|
||||
//Disabling memcpy sometimes helps debugging DMA
|
||||
|
||||
#define USE_MEMCPY 1
|
||||
#ifdef USE_MEMCPY
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void* cellDmaLargeGetReadOnly(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid)
|
||||
{
|
||||
#if defined (WIN32) || defined (__PPU__)
|
||||
return (void*)(uint32_t)ea;
|
||||
#else
|
||||
|
||||
#if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
|
||||
cellDmaLargeGet(ls,ea,size,tag,tid,rid);
|
||||
return ls;
|
||||
#endif //WIN32
|
||||
#else
|
||||
return (void*)(uint32_t)ea;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void* cellDmaGetReadOnly(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid)
|
||||
{
|
||||
#if defined (WIN32) || defined (__PPU__)
|
||||
return (void*)(uint32_t)ea;
|
||||
#else
|
||||
#if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
|
||||
cellDmaGet(ls,ea,size,tag,tid,rid);
|
||||
return ls;
|
||||
#endif //WIN32
|
||||
#else
|
||||
return (void*)(uint32_t)ea;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +48,10 @@ int stallingUnalignedDmaSmallGet(void *ls, uint64_t ea, uint32_t size)
|
||||
///make sure last 4 bits are the same, for cellDmaSmallGet
|
||||
uint32_t last4BitsOffset = ea & 0x0f;
|
||||
char* tmpTarget = tmpBuffer + last4BitsOffset;
|
||||
#ifdef WIN32
|
||||
|
||||
#if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
|
||||
mfc_get(tmpTarget,ea,size,DMA_TAG(1),0,0);
|
||||
#else
|
||||
//copy into final destination
|
||||
#ifdef USE_MEMCPY
|
||||
memcpy(tmpTarget,mainMem,size);
|
||||
#else
|
||||
@@ -53,10 +60,8 @@ int stallingUnalignedDmaSmallGet(void *ls, uint64_t ea, uint32_t size)
|
||||
tmpTarget[i] = mainMem[i];
|
||||
}
|
||||
#endif //USE_MEMCPY
|
||||
#else
|
||||
mfc_get(tmpTarget,ea,size,DMA_TAG(1),0,0);
|
||||
//copy into final destination
|
||||
#endif //WIN32
|
||||
|
||||
#endif
|
||||
|
||||
cellDmaWaitTagStatusAll(DMA_MASK(1));
|
||||
|
||||
@@ -69,8 +74,8 @@ int stallingUnalignedDmaSmallGet(void *ls, uint64_t ea, uint32_t size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
|
||||
#else
|
||||
|
||||
int cellDmaLargeGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid)
|
||||
{
|
||||
@@ -126,4 +131,4 @@ void cellDmaWaitTagStatusAll(int ignore)
|
||||
|
||||
}
|
||||
|
||||
#endif //WIN32
|
||||
#endif
|
||||
|
||||
@@ -15,23 +15,6 @@
|
||||
#define DMA_TAG(xfer) (xfer + 1)
|
||||
#define DMA_MASK(xfer) (1 << DMA_TAG(xfer))
|
||||
|
||||
|
||||
#else
|
||||
#ifdef WIN32
|
||||
|
||||
#define DMA_TAG(a) (a)
|
||||
#define DMA_MASK(a) (a)
|
||||
|
||||
|
||||
/// cellDmaLargeGet Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy)
|
||||
int cellDmaLargeGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid);
|
||||
int cellDmaGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid);
|
||||
/// cellDmaLargePut Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy)
|
||||
int cellDmaLargePut(const void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid);
|
||||
/// cellDmaWaitTagStatusAll Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy)
|
||||
void cellDmaWaitTagStatusAll(int ignore);
|
||||
|
||||
|
||||
#elif defined(USE_LIBSPE2)
|
||||
|
||||
#define DMA_TAG(xfer) (xfer + 1)
|
||||
@@ -109,9 +92,21 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // WIN32
|
||||
#else
|
||||
//Simulate DMA using memcpy or direct access on non-CELL platforms that don't have DMAs and SPUs (Win32, Mac, Linux etc)
|
||||
//Potential to add networked simulation using this interface
|
||||
|
||||
#define DMA_TAG(a) (a)
|
||||
#define DMA_MASK(a) (a)
|
||||
|
||||
/// cellDmaLargeGet Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy)
|
||||
int cellDmaLargeGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid);
|
||||
int cellDmaGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid);
|
||||
/// cellDmaLargePut Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy)
|
||||
int cellDmaLargePut(const void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid);
|
||||
/// cellDmaWaitTagStatusAll Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy)
|
||||
void cellDmaWaitTagStatusAll(int ignore);
|
||||
|
||||
|
||||
#endif //__CELLOS_LV2__
|
||||
|
||||
|
||||
@@ -85,7 +85,8 @@ int g_CacheHits=0;
|
||||
#include <LibSN_SPU.h>
|
||||
#endif //USE_SN_TUNER
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
|
||||
#else
|
||||
#define IGNORE_ALIGNMENT 1
|
||||
#define spu_printf printf
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -106,6 +106,34 @@ private:
|
||||
ATTRIBUTE_ALIGNED128(uint32_t atomic_buf[32]);
|
||||
};
|
||||
|
||||
#else
|
||||
//create a dummy implementation (without any locking) useful for serial processing
|
||||
class btSpinlock
|
||||
{
|
||||
public:
|
||||
typedef int SpinVariable;
|
||||
|
||||
btSpinlock (SpinVariable* var)
|
||||
: spinVariable (var)
|
||||
{}
|
||||
|
||||
void Init ()
|
||||
{
|
||||
}
|
||||
|
||||
void Lock ()
|
||||
{
|
||||
}
|
||||
|
||||
void Unlock ()
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
SpinVariable* spinVariable;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user