mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-07 07:21:18 +12:00
coreinit: Split pointer before passing to FiberThreadEntry
This commit is contained in:
parent
72af6e8ae4
commit
011be25597
2 changed files with 16 additions and 1 deletions
|
@ -25,7 +25,11 @@ void nnNfp_update();
|
|||
|
||||
namespace coreinit
|
||||
{
|
||||
#ifdef __arm64__
|
||||
void __OSFiberThreadEntry(uint32, uint32);
|
||||
#else
|
||||
void __OSFiberThreadEntry(void* thread);
|
||||
#endif
|
||||
void __OSAddReadyThreadToRunQueue(OSThread_t* thread);
|
||||
void __OSRemoveThreadFromRunQueues(OSThread_t* thread);
|
||||
};
|
||||
|
@ -49,7 +53,7 @@ namespace coreinit
|
|||
|
||||
struct OSHostThread
|
||||
{
|
||||
OSHostThread(OSThread_t* thread) : m_thread(thread), m_fiber(__OSFiberThreadEntry, this, this)
|
||||
OSHostThread(OSThread_t* thread) : m_thread(thread), m_fiber((void(*)(void*))__OSFiberThreadEntry, this, this)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1304,8 +1308,14 @@ namespace coreinit
|
|||
__OSThreadStartTimeslice(hostThread->m_thread, &hostThread->ppcInstance);
|
||||
}
|
||||
|
||||
#ifdef __arm64__
|
||||
void __OSFiberThreadEntry(uint32 _high, uint32 _low)
|
||||
{
|
||||
uint64 _thread = (uint64) _high << 32 | _low;
|
||||
#else
|
||||
void __OSFiberThreadEntry(void* _thread)
|
||||
{
|
||||
#endif
|
||||
OSHostThread* hostThread = (OSHostThread*)_thread;
|
||||
|
||||
#if defined(ARCH_X86_64)
|
||||
|
|
|
@ -15,7 +15,12 @@ Fiber::Fiber(void(*FiberEntryPoint)(void* userParam), void* userParam, void* pri
|
|||
ctx->uc_stack.ss_sp = m_stackPtr;
|
||||
ctx->uc_stack.ss_size = stackSize;
|
||||
ctx->uc_link = &ctx[0];
|
||||
#ifdef __arm64__
|
||||
// https://www.man7.org/linux/man-pages/man3/makecontext.3.html#NOTES
|
||||
makecontext(ctx, (void(*)())FiberEntryPoint, 2, (uint64) userParam >> 32, userParam);
|
||||
#else
|
||||
makecontext(ctx, (void(*)())FiberEntryPoint, 1, userParam);
|
||||
#endif
|
||||
this->m_implData = (void*)ctx;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue