mirror of
https://github.com/wiiu-env/WUMSLoader.git
synced 2024-11-23 16:29:16 +01:00
Use custom wut_get_thread_specific/wut_set_thread_specific implementation.
This commit is contained in:
parent
a46dcf7e84
commit
7997cfc071
@ -1,3 +1,6 @@
|
|||||||
|
#include <coreinit/debug.h>
|
||||||
|
#include <coreinit/thread.h>
|
||||||
|
|
||||||
void __init_wut_malloc();
|
void __init_wut_malloc();
|
||||||
|
|
||||||
void __init_wut_newlib();
|
void __init_wut_newlib();
|
||||||
@ -34,3 +37,51 @@ fini_wut() {
|
|||||||
__fini_wut_newlib();
|
__fini_wut_newlib();
|
||||||
__fini_wut_malloc();
|
__fini_wut_malloc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef enum __wut_thread_specific_id {
|
||||||
|
WUT_THREAD_SPECIFIC_0 = 0,
|
||||||
|
WUT_THREAD_SPECIFIC_1 = 1,
|
||||||
|
} __wut_thread_specific_id;
|
||||||
|
|
||||||
|
extern void __attribute__((weak)) wut_set_thread_specific(__wut_thread_specific_id id, void *value);
|
||||||
|
|
||||||
|
void wut_set_thread_specific(__wut_thread_specific_id id, void *value) {
|
||||||
|
OSThread *thread;
|
||||||
|
asm volatile("lwz %0, -0x20(0)"
|
||||||
|
: "=r"(thread)); // OSGetCurrentThread()
|
||||||
|
if (thread != NULL) {
|
||||||
|
if (id == WUT_THREAD_SPECIFIC_0) {
|
||||||
|
thread->reserved[3] = (uint32_t) value;
|
||||||
|
} else if (id == WUT_THREAD_SPECIFIC_1) {
|
||||||
|
thread->reserved[4] = (uint32_t) value;
|
||||||
|
} else {
|
||||||
|
OSReport("[WUMSLOADER] wut_set_thread_specific: invalid id\n");
|
||||||
|
OSFatal("[WUMSLOADER] wut_set_thread_specific: invalid id");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
OSReport("[WUMSLOADER] wut_set_thread_specific: invalid thread\n");
|
||||||
|
OSFatal("[WUMSLOADER] wut_set_thread_specific: invalid thread");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void *__attribute__((weak)) wut_get_thread_specific(__wut_thread_specific_id id);
|
||||||
|
|
||||||
|
void *wut_get_thread_specific(__wut_thread_specific_id id) {
|
||||||
|
OSThread *thread;
|
||||||
|
asm volatile("lwz %0, -0x20(0)"
|
||||||
|
: "=r"(thread)); // OSGetCurrentThread()
|
||||||
|
if (thread != NULL) {
|
||||||
|
if (id == WUT_THREAD_SPECIFIC_0) {
|
||||||
|
return (void *) thread->reserved[3];
|
||||||
|
} else if (id == WUT_THREAD_SPECIFIC_1) {
|
||||||
|
return (void *) thread->reserved[4];
|
||||||
|
} else {
|
||||||
|
OSReport("[WUMSLOADER] wut_get_thread_specific: invalid id\n");
|
||||||
|
OSFatal("[WUMSLOADER] wut_get_thread_specific: invalid id");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
OSReport("[WUMSLOADER] wut_get_thread_specific: invalid thread\n");
|
||||||
|
OSFatal("[WUMSLOADER] wut_get_thread_specific: invalid thread");
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
@ -117,7 +117,7 @@ bool doRelocation(const std::vector<std::shared_ptr<ModuleData>> &moduleList,
|
|||||||
// They will be released on exit (See: AromaBaseModule)
|
// They will be released on exit (See: AromaBaseModule)
|
||||||
usedRPls[rplName] = rplHandle;
|
usedRPls[rplName] = rplHandle;
|
||||||
} else {
|
} else {
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Use from usedRPLs cache! %s", rplName.c_str());
|
//DEBUG_FUNCTION_LINE_VERBOSE("Use from usedRPLs cache! %s", rplName.c_str());
|
||||||
}
|
}
|
||||||
rplHandle = usedRPls[rplName];
|
rplHandle = usedRPls[rplName];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user