diff options
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.h | 2 | ||||
| -rw-r--r-- | src/core/hle/svc.cpp | 13 |
3 files changed, 9 insertions, 12 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 5f1d5c400..189f7d5f5 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -147,7 +147,7 @@ void CallThread(Thread* t) { | |||
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | /// Switches CPU context to that of the specified thread | 149 | /// Switches CPU context to that of the specified thread |
| 150 | void SwitchContext(Thread* t, const char* reason) { | 150 | void SwitchContext(Thread* t) { |
| 151 | Thread* cur = GetCurrentThread(); | 151 | Thread* cur = GetCurrentThread(); |
| 152 | 152 | ||
| 153 | // Save context for current thread | 153 | // Save context for current thread |
| @@ -299,11 +299,11 @@ Handle SetupMainThread(s32 priority, int stack_size) { | |||
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | /// Reschedules to the next available thread (call after current thread is suspended) | 301 | /// Reschedules to the next available thread (call after current thread is suspended) |
| 302 | void Reschedule(const char* reason) { | 302 | void Reschedule() { |
| 303 | Thread* prev = GetCurrentThread(); | 303 | Thread* prev = GetCurrentThread(); |
| 304 | Thread* next = NextThread(); | 304 | Thread* next = NextThread(); |
| 305 | if (next > 0) { | 305 | if (next > 0) { |
| 306 | SwitchContext(next, reason); | 306 | SwitchContext(next); |
| 307 | 307 | ||
| 308 | // Hack - automatically change previous thread (which would have been in "wait" state) to | 308 | // Hack - automatically change previous thread (which would have been in "wait" state) to |
| 309 | // "ready" state, so that we can immediately resume to it when new thread yields. FixMe to | 309 | // "ready" state, so that we can immediately resume to it when new thread yields. FixMe to |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index a9e9eb95f..d54f47aaf 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -51,7 +51,7 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3 | |||
| 51 | Handle SetupMainThread(s32 priority, int stack_size=Kernel::DEFAULT_STACK_SIZE); | 51 | Handle SetupMainThread(s32 priority, int stack_size=Kernel::DEFAULT_STACK_SIZE); |
| 52 | 52 | ||
| 53 | /// Reschedules to the next available thread (call after current thread is suspended) | 53 | /// Reschedules to the next available thread (call after current thread is suspended) |
| 54 | void Reschedule(const char* reason); | 54 | void Reschedule(); |
| 55 | 55 | ||
| 56 | /// Puts a thread in the wait state for the given type/reason | 56 | /// Puts a thread in the wait state for the given type/reason |
| 57 | void WaitCurThread(WaitType wait_type, const char* reason); | 57 | void WaitCurThread(WaitType wait_type, const char* reason); |
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 14d512b99..b1854a36e 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -106,10 +106,9 @@ Result CloseHandle(Handle handle) { | |||
| 106 | 106 | ||
| 107 | /// Wait for a handle to synchronize, timeout after the specified nanoseconds | 107 | /// Wait for a handle to synchronize, timeout after the specified nanoseconds |
| 108 | Result WaitSynchronization1(Handle handle, s64 nano_seconds) { | 108 | Result WaitSynchronization1(Handle handle, s64 nano_seconds) { |
| 109 | // ImplementMe | ||
| 110 | DEBUG_LOG(SVC, "(UNIMPLEMENTED) WaitSynchronization1 called handle=0x%08X, nanoseconds=%d", | 109 | DEBUG_LOG(SVC, "(UNIMPLEMENTED) WaitSynchronization1 called handle=0x%08X, nanoseconds=%d", |
| 111 | handle, nano_seconds); | 110 | handle, nano_seconds); |
| 112 | Kernel::Reschedule("WaitSynchronization1"); | 111 | Kernel::WaitCurThread(WAITTYPE_SYNCH, "WaitSynchronization1"); // TODO(bunnei): Is this correct? |
| 113 | return 0; | 112 | return 0; |
| 114 | } | 113 | } |
| 115 | 114 | ||
| @@ -117,16 +116,14 @@ Result WaitSynchronization1(Handle handle, s64 nano_seconds) { | |||
| 117 | Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wait_all, s64 nano_seconds) { | 116 | Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wait_all, s64 nano_seconds) { |
| 118 | s32* out = (s32*)_out; | 117 | s32* out = (s32*)_out; |
| 119 | Handle* handles = (Handle*)_handles; | 118 | Handle* handles = (Handle*)_handles; |
| 120 | // ImplementMe | 119 | |
| 121 | |||
| 122 | DEBUG_LOG(SVC, "(UNIMPLEMENTED) WaitSynchronizationN called handle_count=%d, wait_all=%s, nanoseconds=%d %s", | 120 | DEBUG_LOG(SVC, "(UNIMPLEMENTED) WaitSynchronizationN called handle_count=%d, wait_all=%s, nanoseconds=%d %s", |
| 123 | handle_count, (wait_all ? "true" : "false"), nano_seconds); | 121 | handle_count, (wait_all ? "true" : "false"), nano_seconds); |
| 124 | 122 | ||
| 125 | for (u32 i = 0; i < handle_count; i++) { | 123 | for (u32 i = 0; i < handle_count; i++) { |
| 126 | DEBUG_LOG(SVC, "\thandle[%d]=0x%08X", i, handles[i]); | 124 | DEBUG_LOG(SVC, "\thandle[%d]=0x%08X", i, handles[i]); |
| 127 | } | 125 | } |
| 128 | Kernel::Reschedule("WaitSynchronizationN"); | 126 | Kernel::WaitCurThread(WAITTYPE_SYNCH, "WaitSynchronizationN"); // TODO(bunnei): Is this correct? |
| 129 | |||
| 130 | return 0; | 127 | return 0; |
| 131 | } | 128 | } |
| 132 | 129 | ||
| @@ -174,7 +171,7 @@ Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 p | |||
| 174 | name = buff; | 171 | name = buff; |
| 175 | } | 172 | } |
| 176 | 173 | ||
| 177 | Handle thread = Kernel::CreateThread(name.c_str(), entry_point, priority, processor_id, | 174 | Handle thread = Kernel::CreateThread(name.c_str(), entry_point, priority, arg, processor_id, |
| 178 | stack_top); | 175 | stack_top); |
| 179 | 176 | ||
| 180 | Core::g_app_core->SetReg(1, thread); | 177 | Core::g_app_core->SetReg(1, thread); |