Compilation fix

This commit is contained in:
Nekotekina 2014-08-31 03:06:43 +04:00
parent 367b8e7129
commit ff3df64a26
9 changed files with 27 additions and 34 deletions

View File

@ -2,12 +2,14 @@
namespace vm namespace vm
{ {
//TODO
bool check_addr(u32 addr) bool check_addr(u32 addr)
{ {
// Checking address before using it is unsafe.
// The only safe way to check it is to protect both actions (checking and using) with mutex that is used for mapping/allocation.
return false; return false;
} }
//TODO
bool map(u32 addr, u32 size, u32 flags) bool map(u32 addr, u32 size, u32 flags)
{ {
return false; return false;
@ -32,13 +34,7 @@ namespace vm
return 0; return 0;
} }
bool read32(u32 addr, u32& value) void write32(u32 addr, u32 value)
{ {
return false;
}
bool write32(u32 addr, u32 value)
{
return false;
} }
} }

View File

@ -2,7 +2,6 @@
namespace vm namespace vm
{ {
bool check_addr(u32 addr);
bool map(u32 addr, u32 size, u32 flags); bool map(u32 addr, u32 size, u32 flags);
bool unmap(u32 addr, u32 size = 0, u32 flags = 0); bool unmap(u32 addr, u32 size = 0, u32 flags = 0);
u32 alloc(u32 size); u32 alloc(u32 size);
@ -20,10 +19,8 @@ namespace vm
return (T&)Memory[addr]; return (T&)Memory[addr];
} }
//TODO
u32 read32(u32 addr); u32 read32(u32 addr);
bool read32(u32 addr, u32& value); void write32(u32 addr, u32 value);
bool write32(u32 addr, u32 value);
} }
#include "vm_ptr.h" #include "vm_ptr.h"

View File

@ -28,9 +28,9 @@ namespace vm
return Memory.IsGoodAddr(m_addr, sizeof(T)); return Memory.IsGoodAddr(m_addr, sizeof(T));
} }
static ref make(u32 addr) static _ref_base make(u32 addr)
{ {
return (ref&)addr; return (_ref_base&)addr;
} }
}; };
@ -49,15 +49,15 @@ namespace vm
namespace ps3 namespace ps3
{ {
//default reference for HLE functions (LE reference to BE data) //default reference for HLE functions (LE reference to BE data)
template<typename T, typename AT = u32> class ref : public lrefb {}; template<typename T, typename AT = u32> class ref : public lrefb<T, AT> {};
//default reference for HLE structures (BE reference to BE data) //default reference for HLE structures (BE reference to BE data)
template<typename T, typename AT = u32> class bref : public brefb {}; template<typename T, typename AT = u32> class bref : public brefb<T, AT> {};
} }
namespace psv namespace psv
{ {
//default reference for HLE functions & structures (LE reference to LE data) //default reference for HLE functions & structures (LE reference to LE data)
template<typename T, typename AT = u32> class ref : public lrefl {}; template<typename T, typename AT = u32> class ref : public lrefl<T, AT> {};
} }
} }

View File

@ -34,7 +34,7 @@ namespace vm
void alloc() void alloc()
{ {
m_addr = Memory.Alloc(size(), m_align); m_addr = Memory.Alloc(size(), m_align);
m_ptr = Memory.IsGoodAddr(m_addr, size()) ? get_ptr<T>(m_addr) : nullptr; m_ptr = (T*)Memory.VirtualToRealAddr(m_addr);
} }
void dealloc() void dealloc()
@ -54,7 +54,7 @@ namespace vm
res.m_addr = addr; res.m_addr = addr;
res.m_size = size; res.m_size = size;
res.m_align = align; res.m_align = align;
res.m_ptr = Memory.IsGoodAddr(addr, size) ? get_ptr<T>(addr) : nullptr; res.m_ptr = (T*)Memory.VirtualToRealAddr(addr);
return res; return res;
} }
@ -156,7 +156,7 @@ namespace vm
void alloc() void alloc()
{ {
m_addr = Memory.Alloc(size(), m_align); m_addr = Memory.Alloc(size(), m_align);
m_ptr = Memory.IsGoodAddr(m_addr, size()) ? get_ptr<T>(m_addr) : nullptr; m_ptr = (T*)Memory.VirtualToRealAddr(m_addr);
} }
void dealloc() void dealloc()
@ -177,7 +177,7 @@ namespace vm
res.m_count = count; res.m_count = count;
res.m_size = size; res.m_size = size;
res.m_align = align; res.m_align = align;
res.m_ptr = Memory.IsGoodAddr(addr, size * count) ? get_ptr<T>(addr) : nullptr; res.m_ptr = (T*)Memory.VirtualToRealAddr(addr);
return res; return res;
} }
@ -355,7 +355,7 @@ namespace vm
void alloc() void alloc()
{ {
m_addr = Memory.Alloc(size(), m_align); m_addr = Memory.Alloc(size(), m_align);
m_ptr = Memory.IsGoodAddr(m_addr, size()) ? get_ptr<T>(m_addr) : nullptr; m_ptr = (T*)Memory.VirtualToRealAddr(m_addr);
} }
void dealloc() void dealloc()

View File

@ -129,8 +129,8 @@ u32 cellGcmGetNotifyDataAddress(u32 index)
cellGcmSys->Warning("cellGcmGetNotifyDataAddress(index=%d)", index); cellGcmSys->Warning("cellGcmGetNotifyDataAddress(index=%d)", index);
// Get address of 'IO table' and 'EA table' // Get address of 'IO table' and 'EA table'
MemoryAllocator<CellGcmOffsetTable> table; vm::var<CellGcmOffsetTable> table;
cellGcmGetOffsetTable(table.GetAddr()); cellGcmGetOffsetTable(table.addr());
// If entry not in use, return NULL // If entry not in use, return NULL
u16 entry = mem_ptr_t<u16>(table->eaAddress)[241]; u16 entry = mem_ptr_t<u16>(table->eaAddress)[241];

View File

@ -9,7 +9,7 @@
//Module cellSpurs(0x000a, cellSpurs_init); //Module cellSpurs(0x000a, cellSpurs_init);
Module *cellSpurs = nullptr; Module *cellSpurs = nullptr;
#ifdef PRX_DEBUG #ifdef _WIN32
extern u32 libsre; extern u32 libsre;
extern u32 libsre_rtoc; extern u32 libsre_rtoc;
#endif #endif

View File

@ -8,7 +8,7 @@
Module* cellSpursJq = nullptr; Module* cellSpursJq = nullptr;
#ifdef PRX_DEBUG #ifdef _WIN32
#include "prx_libspurs_jq.h" #include "prx_libspurs_jq.h"
u32 libspurs_jq; u32 libspurs_jq;
u32 libspurs_jq_rtoc; u32 libspurs_jq_rtoc;

View File

@ -11,7 +11,7 @@
//Module cellSync("cellSync", cellSync_init); //Module cellSync("cellSync", cellSync_init);
Module *cellSync = nullptr; Module *cellSync = nullptr;
#ifdef PRX_DEBUG #ifdef _WIN32
#include "prx_libsre.h" #include "prx_libsre.h"
u32 libsre; u32 libsre;
u32 libsre_rtoc; u32 libsre_rtoc;
@ -1514,7 +1514,7 @@ s32 _cellSyncLFQueuePushBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr,
//syncLFQueueDump(queue); //syncLFQueueDump(queue);
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
MemoryAllocator<be_t<s32>> position_v; vm::var<be_t<s32>> position_v;
#endif #endif
while (true) while (true)
{ {
@ -1523,7 +1523,7 @@ s32 _cellSyncLFQueuePushBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr,
if (queue->m_direction.ToBE() != se32(CELL_SYNC_QUEUE_ANY2ANY)) if (queue->m_direction.ToBE() != se32(CELL_SYNC_QUEUE_ANY2ANY))
{ {
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
res = GetCurrentPPUThread().FastCall(libsre + 0x24B0, libsre_rtoc, queue.GetAddr(), position_v.GetAddr(), isBlocking, 0); res = GetCurrentPPUThread().FastCall(libsre + 0x24B0, libsre_rtoc, queue.GetAddr(), position_v.addr(), isBlocking, 0);
position = position_v->ToLE(); position = position_v->ToLE();
#else #else
res = syncLFQueueGetPushPointer(queue, position, isBlocking, 0); res = syncLFQueueGetPushPointer(queue, position, isBlocking, 0);
@ -1532,7 +1532,7 @@ s32 _cellSyncLFQueuePushBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr,
else else
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
res = (s32)GetCurrentPPUThread().FastCall(libsre + 0x3050, libsre_rtoc, queue.GetAddr(), position_v.GetAddr(), isBlocking, 0); res = (s32)GetCurrentPPUThread().FastCall(libsre + 0x3050, libsre_rtoc, queue.GetAddr(), position_v.addr(), isBlocking, 0);
position = position_v->ToLE(); position = position_v->ToLE();
#else #else
res = syncLFQueueGetPushPointer2(queue, position, isBlocking, 0); res = syncLFQueueGetPushPointer2(queue, position, isBlocking, 0);
@ -1906,7 +1906,7 @@ s32 _cellSyncLFQueuePopBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr, u
s32 position; s32 position;
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
MemoryAllocator<be_t<s32>> position_v; vm::var<be_t<s32>> position_v;
#endif #endif
while (true) while (true)
{ {
@ -1914,7 +1914,7 @@ s32 _cellSyncLFQueuePopBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr, u
if (queue->m_direction.ToBE() != se32(CELL_SYNC_QUEUE_ANY2ANY)) if (queue->m_direction.ToBE() != se32(CELL_SYNC_QUEUE_ANY2ANY))
{ {
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
res = GetCurrentPPUThread().FastCall(libsre + 0x2A90, libsre_rtoc, queue.GetAddr(), position_v.GetAddr(), isBlocking, 0, 0); res = GetCurrentPPUThread().FastCall(libsre + 0x2A90, libsre_rtoc, queue.GetAddr(), position_v.addr(), isBlocking, 0, 0);
position = position_v->ToLE(); position = position_v->ToLE();
#else #else
res = syncLFQueueGetPopPointer(queue, position, isBlocking, 0, 0); res = syncLFQueueGetPopPointer(queue, position, isBlocking, 0, 0);
@ -1923,7 +1923,7 @@ s32 _cellSyncLFQueuePopBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr, u
else else
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
res = (s32)GetCurrentPPUThread().FastCall(libsre + 0x39AC, libsre_rtoc, queue.GetAddr(), position_v.GetAddr(), isBlocking, 0); res = (s32)GetCurrentPPUThread().FastCall(libsre + 0x39AC, libsre_rtoc, queue.GetAddr(), position_v.addr(), isBlocking, 0);
position = position_v->ToLE(); position = position_v->ToLE();
#else #else
res = syncLFQueueGetPopPointer2(queue, position, isBlocking, 0); res = syncLFQueueGetPopPointer2(queue, position, isBlocking, 0);

View File

@ -9,7 +9,7 @@
//Module cellSync2(0x0055, cellSync2_init); //Module cellSync2(0x0055, cellSync2_init);
Module* cellSync2 = nullptr; Module* cellSync2 = nullptr;
#ifdef PRX_DEBUG #ifdef _WIN32
#include "prx_libsync2.h" #include "prx_libsync2.h"
u32 libsync2; u32 libsync2;
u32 libsync2_rtoc; u32 libsync2_rtoc;