Simplify trampoline reset, flush cache

This commit is contained in:
Maschell 2025-01-03 09:36:19 +01:00
parent f5d4536d42
commit 70ac37040e

View File

@ -28,6 +28,7 @@
#include <coreinit/interrupts.h> #include <coreinit/interrupts.h>
#include <coreinit/scheduler.h> #include <coreinit/scheduler.h>
#include <coreinit/cache.h>
#include <thread> #include <thread>
WUMS_MODULE_EXPORT_NAME("homebrew_wupsbackend"); WUMS_MODULE_EXPORT_NAME("homebrew_wupsbackend");
@ -309,9 +310,12 @@ void CleanupPlugins(std::vector<PluginContainer> &&pluginsToDeinit) {
if (!pluginContainer.isLinkedAndLoaded() || cur.id != pluginContainer.getPluginLinkInformation().getTrampolineId()) { if (!pluginContainer.isLinkedAndLoaded() || cur.id != pluginContainer.getPluginLinkInformation().getTrampolineId()) {
continue; continue;
} }
cur.status = RELOC_TRAMP_FREE; cur = {};
} }
} }
DCFlushRange((void *) gTrampData.data(), gTrampData.size() * sizeof(relocation_trampoline_entry_t));
ICInvalidateRange((void *) gTrampData.data(), gTrampData.size() * sizeof(relocation_trampoline_entry_t));
OSMemoryBarrier();
} }
void CheckCleanupCallbackUsage(const std::vector<PluginContainer> &plugins) { void CheckCleanupCallbackUsage(const std::vector<PluginContainer> &plugins) {
auto *curThread = OSGetCurrentThread(); auto *curThread = OSGetCurrentThread();