Merge pull request #4003 from zmeizy/claude/memory-pool-batch-type-protect
fix(libkernel): apply the memory type in sceKernelMemoryPoolBatch typ…
This commit is contained in:
commit
5d7be6bdc8
|
|
@ -70,7 +70,7 @@ int APS5_VABI sceKernelMemoryPoolBatch(const KernelMemoryPoolBatchEntry* entries
|
|||
case 1: return PoolCommit(e.commit.addr, e.commit.len, e.commit.prot);
|
||||
case 2: return PoolDecommit(e.decommit.addr, e.decommit.len);
|
||||
case 3: return DoMprotect(e.protect.addr, static_cast<size_t>(e.protect.len), e.protect.prot);
|
||||
case 4: return DoMprotect(e.type_protect.addr, static_cast<size_t>(e.type_protect.len), e.type_protect.prot);
|
||||
case 4: return DoMtypeprotect(e.type_protect.addr, static_cast<size_t>(e.type_protect.len), e.type_protect.type, e.type_protect.prot);
|
||||
default: return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ int APS5_VABI sceKernelReleaseFlexibleMemory(void*, std::size_t);
|
|||
int APS5_VABI sceKernelMprotect(const void*, std::size_t, int);
|
||||
int APS5_VABI sceKernelMtypeprotect(const void*, std::size_t, int, int);
|
||||
int APS5_VABI sceKernelBatchMap2(KernelBatchMapEntry*, int, int*, int);
|
||||
int APS5_VABI sceKernelMemoryPoolBatch(const KernelMemoryPoolBatchEntry*, int, int*, int);
|
||||
int APS5_VABI sceKernelVirtualQuery(const void*, int, VirtualQueryInfo*, std::uint64_t);
|
||||
int APS5_VABI sceKernelSetVirtualRangeName(const void*, std::uint64_t, const char*);
|
||||
int APS5_VABI sceKernelClearVirtualRangeName(const void*, std::uint64_t);
|
||||
|
|
@ -436,6 +437,16 @@ static void CheckMtypeprotect() {
|
|||
check(0, 0, 3);
|
||||
check(1, 3, 1);
|
||||
check(2, 5, 3);
|
||||
KernelMemoryPoolBatchEntry poolEntry{};
|
||||
poolEntry.op = 4;
|
||||
poolEntry.type_protect.addr = bytes + page * 2;
|
||||
poolEntry.type_protect.len = page;
|
||||
poolEntry.type_protect.prot = 1;
|
||||
poolEntry.type_protect.type = 4;
|
||||
processed = -1;
|
||||
Require(sceKernelMemoryPoolBatch(&poolEntry, 1, &processed, 0) == 0 && processed == 1);
|
||||
check(1, 3, 1);
|
||||
check(2, 4, 1);
|
||||
Require(sceKernelMtypeprotect(bytes, page * 3, 2, 3) == 0);
|
||||
VirtualQueryInfo whole{};
|
||||
Require(sceKernelVirtualQuery(bytes, 0, &whole, sizeof(whole)) == 0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue