diff options
| author | 2020-02-25 12:40:33 -0400 | |
|---|---|---|
| committer | 2020-06-27 11:35:11 -0400 | |
| commit | 49ba56399563a87f29b4d89eb04b1178a571eb61 (patch) | |
| tree | 3da8def77e63141936483c64f7e13bfe89e614fa /src/core/hle/kernel/svc.cpp | |
| parent | HostTiming: Pause the hardware clock on pause. (diff) | |
| download | yuzu-49ba56399563a87f29b4d89eb04b1178a571eb61.tar.gz yuzu-49ba56399563a87f29b4d89eb04b1178a571eb61.tar.xz yuzu-49ba56399563a87f29b4d89eb04b1178a571eb61.zip | |
SVC: Correct CreateThread, StartThread, ExitThread, SleepThread.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index d7f0dcabd..dfb032b4b 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -1464,13 +1464,7 @@ static ResultCode StartThread(Core::System& system, Handle thread_handle) { | |||
| 1464 | 1464 | ||
| 1465 | ASSERT(thread->GetStatus() == ThreadStatus::Dormant); | 1465 | ASSERT(thread->GetStatus() == ThreadStatus::Dormant); |
| 1466 | 1466 | ||
| 1467 | thread->ResumeFromWait(); | 1467 | return thread->Start(); |
| 1468 | |||
| 1469 | if (thread->GetStatus() == ThreadStatus::Ready) { | ||
| 1470 | system.PrepareReschedule(thread->GetProcessorID()); | ||
| 1471 | } | ||
| 1472 | |||
| 1473 | return RESULT_SUCCESS; | ||
| 1474 | } | 1468 | } |
| 1475 | 1469 | ||
| 1476 | /// Called when a thread exits | 1470 | /// Called when a thread exits |
| @@ -1478,9 +1472,8 @@ static void ExitThread(Core::System& system) { | |||
| 1478 | LOG_DEBUG(Kernel_SVC, "called, pc=0x{:08X}", system.CurrentArmInterface().GetPC()); | 1472 | LOG_DEBUG(Kernel_SVC, "called, pc=0x{:08X}", system.CurrentArmInterface().GetPC()); |
| 1479 | 1473 | ||
| 1480 | auto* const current_thread = system.CurrentScheduler().GetCurrentThread(); | 1474 | auto* const current_thread = system.CurrentScheduler().GetCurrentThread(); |
| 1481 | current_thread->Stop(); | ||
| 1482 | system.GlobalScheduler().RemoveThread(SharedFrom(current_thread)); | 1475 | system.GlobalScheduler().RemoveThread(SharedFrom(current_thread)); |
| 1483 | system.PrepareReschedule(); | 1476 | current_thread->Stop(); |
| 1484 | } | 1477 | } |
| 1485 | 1478 | ||
| 1486 | /// Sleep the current thread | 1479 | /// Sleep the current thread |
| @@ -1500,13 +1493,13 @@ static void SleepThread(Core::System& system, s64 nanoseconds) { | |||
| 1500 | if (nanoseconds <= 0) { | 1493 | if (nanoseconds <= 0) { |
| 1501 | switch (static_cast<SleepType>(nanoseconds)) { | 1494 | switch (static_cast<SleepType>(nanoseconds)) { |
| 1502 | case SleepType::YieldWithoutLoadBalancing: | 1495 | case SleepType::YieldWithoutLoadBalancing: |
| 1503 | is_redundant = current_thread->YieldSimple(); | 1496 | current_thread->YieldSimple(); |
| 1504 | break; | 1497 | break; |
| 1505 | case SleepType::YieldWithLoadBalancing: | 1498 | case SleepType::YieldWithLoadBalancing: |
| 1506 | is_redundant = current_thread->YieldAndBalanceLoad(); | 1499 | current_thread->YieldAndBalanceLoad(); |
| 1507 | break; | 1500 | break; |
| 1508 | case SleepType::YieldAndWaitForLoadBalancing: | 1501 | case SleepType::YieldAndWaitForLoadBalancing: |
| 1509 | is_redundant = current_thread->YieldAndWaitForLoadBalancing(); | 1502 | current_thread->YieldAndWaitForLoadBalancing(); |
| 1510 | break; | 1503 | break; |
| 1511 | default: | 1504 | default: |
| 1512 | UNREACHABLE_MSG("Unimplemented sleep yield type '{:016X}'!", nanoseconds); | 1505 | UNREACHABLE_MSG("Unimplemented sleep yield type '{:016X}'!", nanoseconds); |
| @@ -1514,7 +1507,6 @@ static void SleepThread(Core::System& system, s64 nanoseconds) { | |||
| 1514 | } else { | 1507 | } else { |
| 1515 | current_thread->Sleep(nanoseconds); | 1508 | current_thread->Sleep(nanoseconds); |
| 1516 | } | 1509 | } |
| 1517 | system.PrepareReschedule(current_thread->GetProcessorID()); | ||
| 1518 | } | 1510 | } |
| 1519 | 1511 | ||
| 1520 | /// Wait process wide key atomic | 1512 | /// Wait process wide key atomic |