Merge pull request #19627 from hrydgard/consider-kernel-vram-invalid

Memory::IsValidAddress: Consider VRAM with a kernel flag invalid.
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2024-11-13 10:03:31 +01:00
commit b56626727e
1 file changed
+7 -4
+7 -4
View File
@@ -286,7 +286,7 @@ inline bool IsValidAddress(const u32 address) {
if ((address & 0x3E000000) == 0x08000000) {
return true;
} else if ((address & 0x3F800000) == 0x04000000) {
return true;
return address < 0x80000000; // Let's disallow kernel-flagged VRAM. We don't have it mapped and I am not sure if it's accessible.
} else if ((address & 0xBFFFC000) == 0x00010000) {
return true;
} else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) {
@@ -300,7 +300,7 @@ inline bool IsValid4AlignedAddress(const u32 address) {
if ((address & 0x3E000003) == 0x08000000) {
return true;
} else if ((address & 0x3F800003) == 0x04000000) {
return true;
return address < 0x80000000; // Let's disallow kernel-flagged VRAM. We don't have it mapped and I am not sure if it's accessible.
} else if ((address & 0xBFFFC003) == 0x00010000) {
return true;
} else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) {
@@ -310,12 +310,15 @@ inline bool IsValid4AlignedAddress(const u32 address) {
}
}
inline u32 MaxSizeAtAddress(const u32 address){
if ((address & 0x3E000000) == 0x08000000) {
return 0x08000000 + g_MemorySize - (address & 0x3FFFFFFF);
} else if ((address & 0x3F800000) == 0x04000000) {
return 0x04800000 - (address & 0x3FFFFFFF);
if (address & 0x80000000) {
return 0;
} else {
return 0x04800000 - (address & 0x3FFFFFFF);
}
} else if ((address & 0xBFFFC000) == 0x00010000) {
return 0x00014000 - (address & 0x3FFFFFFF);
} else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) {