mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
Some bugs fixed
This commit is contained in:
parent
6e77f80d5f
commit
123c4ba1a8
@ -194,7 +194,7 @@ void LogManager::log(LogMessage msg)
|
||||
}
|
||||
if (NamedThreadBase* thr = GetCurrentNamedThread())
|
||||
{
|
||||
prefix += thr->GetThreadName();
|
||||
prefix += "{" + thr->GetThreadName() + "} ";
|
||||
}
|
||||
msg.mText.insert(0, prefix);
|
||||
msg.mText.append(1,'\n');
|
||||
|
@ -161,6 +161,8 @@ u64 DynamicMemoryBlockBase<PT>::AllocAlign(u32 size, u32 align)
|
||||
addr = (addr + (align - 1)) & ~(align - 1);
|
||||
}
|
||||
|
||||
//LOG_NOTICE(MEMORY, "AllocAlign(size=0x%x) -> 0x%llx", size, addr);
|
||||
|
||||
AppendMem(addr, size);
|
||||
|
||||
return addr;
|
||||
@ -202,6 +204,8 @@ bool DynamicMemoryBlockBase<PT>::Free(u64 addr)
|
||||
m_pages[i] = nullptr;
|
||||
}
|
||||
|
||||
//LOG_NOTICE(MEMORY, "Free(0x%llx)", addr);
|
||||
|
||||
m_allocated.erase(m_allocated.begin() + num);
|
||||
return true;
|
||||
}
|
||||
|
@ -78,18 +78,32 @@ public:
|
||||
|
||||
void RegisterPages(u64 addr, u32 size)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
//LOG_NOTICE(MEMORY, "RegisterPages(addr=0x%llx, size=0x%x)", addr, size);
|
||||
for (u32 i = addr / 4096; i < (addr + size) / 4096; i++)
|
||||
{
|
||||
if (i >= sizeof(m_pages) / sizeof(m_pages[0])) break;
|
||||
if (m_pages[i])
|
||||
{
|
||||
LOG_ERROR(MEMORY, "Page already registered (page=0x%x)", i * 4096);
|
||||
}
|
||||
m_pages[i] = 1; // TODO: define page parameters
|
||||
}
|
||||
}
|
||||
|
||||
void UnregisterPages(u64 addr, u32 size)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
//LOG_NOTICE(MEMORY, "UnregisterPages(addr=0x%llx, size=0x%x)", addr, size);
|
||||
for (u32 i = addr / 4096; i < (addr + size) / 4096; i++)
|
||||
{
|
||||
if (i >= sizeof(m_pages) / sizeof(m_pages[0])) break;
|
||||
if (!m_pages[i])
|
||||
{
|
||||
LOG_ERROR(MEMORY, "Page not registered (page=0x%x)", i * 4096);
|
||||
}
|
||||
m_pages[i] = 0; // TODO: define page parameters
|
||||
}
|
||||
}
|
||||
@ -173,8 +187,6 @@ public:
|
||||
|
||||
void Init(MemoryType type)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if(m_inited) return;
|
||||
m_inited = true;
|
||||
|
||||
@ -257,8 +269,6 @@ public:
|
||||
|
||||
void Close()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if(!m_inited) return;
|
||||
m_inited = false;
|
||||
|
||||
|
@ -27,15 +27,21 @@ struct MemBlockInfo : public MemInfo
|
||||
void Free();
|
||||
|
||||
MemBlockInfo(MemBlockInfo &other) = delete;
|
||||
MemBlockInfo(MemBlockInfo &&other) : MemInfo(other.addr,other.size) ,mem(other.mem)
|
||||
|
||||
MemBlockInfo(MemBlockInfo &&other)
|
||||
: MemInfo(other.addr,other.size)
|
||||
, mem(other.mem)
|
||||
{
|
||||
other.mem = nullptr;
|
||||
}
|
||||
|
||||
MemBlockInfo& operator =(MemBlockInfo &other) = delete;
|
||||
MemBlockInfo& operator =(MemBlockInfo &&other){
|
||||
|
||||
MemBlockInfo& operator =(MemBlockInfo &&other)
|
||||
{
|
||||
this->Free();
|
||||
this->addr = other.addr;
|
||||
this->size = other.size;
|
||||
this->Free();
|
||||
this->mem = other.mem;
|
||||
other.mem = nullptr;
|
||||
return *this;
|
||||
|
@ -144,7 +144,11 @@ s32 cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nread)
|
||||
vfsStream* file;
|
||||
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
|
||||
|
||||
if (nread.GetAddr() && !nread.IsGood()) return CELL_EFAULT;
|
||||
if (nread.GetAddr() && !nread.IsGood())
|
||||
{
|
||||
sys_fs->Error("cellFsRead(): bad nread_addr(0x%x)", nread.GetAddr());
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (nbytes != (u32)nbytes) return CELL_ENOMEM;
|
||||
|
||||
|
@ -201,6 +201,10 @@ void Emulator::Load()
|
||||
switch(l.GetMachine())
|
||||
{
|
||||
case MACHINE_SPU:
|
||||
Memory.Init(Memory_PS3);
|
||||
Memory.MainMem.AllocFixed(Memory.MainMem.GetStartAddr(), 0x40000);
|
||||
break;
|
||||
|
||||
case MACHINE_PPC64:
|
||||
Memory.Init(Memory_PS3);
|
||||
break;
|
||||
@ -263,7 +267,6 @@ void Emulator::Load()
|
||||
LOG_NOTICE(LOADER, "offset = 0x%llx", Memory.MainMem.GetStartAddr());
|
||||
LOG_NOTICE(LOADER, "max addr = 0x%x", l.GetMaxAddr());
|
||||
thread.SetOffset(Memory.MainMem.GetStartAddr());
|
||||
Memory.MainMem.AllocFixed(Memory.MainMem.GetStartAddr() + l.GetMaxAddr(), 0xFFFFED - l.GetMaxAddr());
|
||||
thread.SetEntry(l.GetEntry() - Memory.MainMem.GetStartAddr());
|
||||
break;
|
||||
|
||||
|
@ -236,7 +236,7 @@ bool ELF32Loader::LoadPhdrData(u64 _offset)
|
||||
|
||||
switch(machine)
|
||||
{
|
||||
case MACHINE_SPU: Memory.MainMem.AllocFixed(phdr_arr[i].p_vaddr + offset, phdr_arr[i].p_memsz); break;
|
||||
case MACHINE_SPU: break;
|
||||
case MACHINE_MIPS: Memory.PSPMemory.RAM.AllocFixed(phdr_arr[i].p_vaddr + offset, phdr_arr[i].p_memsz); break;
|
||||
case MACHINE_ARM: Memory.PSVMemory.RAM.AllocFixed(phdr_arr[i].p_vaddr + offset, phdr_arr[i].p_memsz); break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user