aboutsummaryrefslogtreecommitdiff
path: root/src/ARMJIT.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ARMJIT.cpp')
-rw-r--r--src/ARMJIT.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/ARMJIT.cpp b/src/ARMJIT.cpp
index 2f9cad9..32f20d5 100644
--- a/src/ARMJIT.cpp
+++ b/src/ARMJIT.cpp
@@ -1,5 +1,5 @@
/*
- Copyright 2016-2021 Arisotura, RSDuck
+ Copyright 2016-2022 melonDS team
This file is part of melonDS.
@@ -1086,11 +1086,34 @@ void InvalidateByAddr(u32 localAddr)
void CheckAndInvalidateITCM()
{
- for (u32 i = 0; i < ITCMPhysicalSize; i+=16)
+ for (u32 i = 0; i < ITCMPhysicalSize; i+=512)
{
- if (CodeIndexITCM[i / 512].Code & (1 << ((i & 0x1FF) / 16)))
+ if (CodeIndexITCM[i / 512].Code)
{
- InvalidateByAddr(i | (ARMJIT_Memory::memregion_ITCM << 27));
+ // maybe using bitscan would be better here?
+ // The thing is that in densely populated sets
+ // The old fashioned way can actually be faster
+ for (u32 j = 0; j < 512; j += 16)
+ {
+ if (CodeIndexITCM[i / 512].Code & (1 << ((j & 0x1FF) / 16)))
+ InvalidateByAddr((i+j) | (ARMJIT_Memory::memregion_ITCM << 27));
+ }
+ }
+ }
+}
+
+void CheckAndInvalidateWVRAM(int bank)
+{
+ u32 start = bank == 1 ? 0x20000 : 0;
+ for (u32 i = start; i < start+0x20000; i+=512)
+ {
+ if (CodeIndexARM7WVRAM[i / 512].Code)
+ {
+ for (u32 j = 0; j < 512; j += 16)
+ {
+ if (CodeIndexARM7WVRAM[i / 512].Code & (1 << ((j & 0x1FF) / 16)))
+ InvalidateByAddr((i+j) | (ARMJIT_Memory::memregion_VWRAM << 27));
+ }
}
}
}