mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-21 02:45:00 +00:00
Fix VirtualQuery struct
Somewhere in our BitField and array use, the size of our VirtualQuery struct became larger than the struct used on real hardware. Fixing this fixes some data corruption visible in the name parameter during my tests.
This commit is contained in:
parent
3ce991f9d2
commit
eb63db8b20
2 changed files with 14 additions and 14 deletions
|
@ -59,14 +59,12 @@ struct OrbisVirtualQueryInfo {
|
|||
size_t offset;
|
||||
s32 protection;
|
||||
s32 memory_type;
|
||||
union {
|
||||
BitField<0, 1, u32> is_flexible;
|
||||
BitField<1, 1, u32> is_direct;
|
||||
BitField<2, 1, u32> is_stack;
|
||||
BitField<3, 1, u32> is_pooled;
|
||||
BitField<4, 1, u32> is_committed;
|
||||
};
|
||||
std::array<char, 32> name;
|
||||
u32 is_flexible : 1;
|
||||
u32 is_direct : 1;
|
||||
u32 is_stack : 1;
|
||||
u32 is_pooled : 1;
|
||||
u32 is_committed : 1;
|
||||
char name[32];
|
||||
};
|
||||
|
||||
struct OrbisKernelBatchMapEntry {
|
||||
|
|
|
@ -593,12 +593,14 @@ int MemoryManager::VirtualQuery(VAddr addr, int flags,
|
|||
info->end = vma.base + vma.size;
|
||||
info->offset = vma.phys_base;
|
||||
info->protection = static_cast<s32>(vma.prot);
|
||||
info->is_flexible.Assign(vma.type == VMAType::Flexible);
|
||||
info->is_direct.Assign(vma.type == VMAType::Direct);
|
||||
info->is_stack.Assign(vma.type == VMAType::Stack);
|
||||
info->is_pooled.Assign(vma.type == VMAType::PoolReserved || vma.type == VMAType::Pooled);
|
||||
info->is_committed.Assign(vma.IsMapped());
|
||||
vma.name.copy(info->name.data(), std::min(info->name.size(), vma.name.size()));
|
||||
info->is_flexible = vma.type == VMAType::Flexible ? 1 : 0;
|
||||
info->is_direct = vma.type == VMAType::Direct ? 1 : 0;
|
||||
info->is_stack = vma.type == VMAType::Stack ? 1 : 0;
|
||||
info->is_pooled = vma.type == VMAType::PoolReserved || vma.type == VMAType::Pooled ? 1 : 0;
|
||||
info->is_committed = vma.IsMapped() ? 1 : 0;
|
||||
|
||||
strcpy(info->name, vma.name.data());
|
||||
|
||||
if (vma.type == VMAType::Direct) {
|
||||
const auto dmem_it = FindDmemArea(vma.phys_base);
|
||||
ASSERT(dmem_it != dmem_map.end());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue