Make buildable with GCC in Linux

* replace GetThreadID with std::this_thread.getId()
* name all anonymous structs and unions that contain non-trivially constructable objects
* made default constructor for big endian type noexcept to make it work with std::atomic
* move instantiated specialized template function members ouside of the class definition to comply with the standard
* added default instantiation for template parameter "=nullptr"
* used the C++11 standardized thread_local instead of the __declspec(thread)
* added transitional definitions to bridge the microsoft specific calls (compare and exchange and aligned alloc)
* removed cyclic dependency between Emulator->CPUThreadManager->CPUThread->SMutex->Emulator->...
* fixed some instances of indentation by space instead of tabs
* surrounded some unused code with an #if 0 block to make sure it doesn't compile
This commit is contained in:
Bigpet 2014-02-23 17:52:52 +01:00
parent 07135570f4
commit 9a30ce5f18
48 changed files with 190 additions and 154 deletions

View file

@ -24,14 +24,12 @@ enum
};
#pragma pack(push, 1)
struct CellSyncMutex {
union {
struct {
be_t<u16> m_freed;
be_t<u16> m_order;
};
volatile u32 m_data;
};
union CellSyncMutex {
struct cell_sync_mutex_info{
be_t<u16> m_freed;
be_t<u16> m_order;
}parts;
volatile u32 m_data;
/*
(???) Initialize: set zeros
(???) Lock: increase m_order and wait until m_freed == old m_order
@ -87,9 +85,9 @@ int cellSyncMutexLock(mem_ptr_t<CellSyncMutex> mutex)
{
reservation.clear();
}
old_order = mutex->m_order;
mutex->m_order = mutex->m_order + 1;
if (old_order == mutex->m_freed)
old_order = mutex->parts.m_order;
mutex->parts.m_order = mutex->parts.m_order + 1;
if (old_order == mutex->parts.m_freed)
{
return CELL_OK;
}
@ -127,11 +125,11 @@ int cellSyncMutexTryLock(mem_ptr_t<CellSyncMutex> mutex)
{
reservation.clear();
}
if (mutex->m_order != mutex->m_freed)
if (mutex->parts.m_order != mutex->parts.m_freed)
{
return CELL_SYNC_ERROR_BUSY;
}
mutex->m_order = mutex->m_order + 1;
mutex->parts.m_order = mutex->parts.m_order + 1;
return CELL_OK;
}
}
@ -156,7 +154,7 @@ int cellSyncMutexUnlock(mem_ptr_t<CellSyncMutex> mutex)
{
reservation.clear();
}
mutex->m_freed = mutex->m_freed + 1;
mutex->parts.m_freed = mutex->parts.m_freed + 1;
return CELL_OK;
}
}
@ -167,4 +165,4 @@ void cellSync_init()
cellSync.AddFunc(0x1bb675c2, cellSyncMutexLock);
cellSync.AddFunc(0xd06918c4, cellSyncMutexTryLock);
cellSync.AddFunc(0x91f2b7b0, cellSyncMutexUnlock);
}
}