summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-02-24 22:04:12 -0400
committerGravatar Fernando Sahmkow2020-06-27 11:35:06 -0400
commite31425df3877636c098ec7426ebd2067920715cb (patch)
tree5c0fc518a4ebb8413c491b43a9fdd99450c7bd80 /src/core/hle/kernel/svc.cpp
parentMerge pull request #3396 from FernandoS27/prometheus-1 (diff)
downloadyuzu-e31425df3877636c098ec7426ebd2067920715cb.tar.gz
yuzu-e31425df3877636c098ec7426ebd2067920715cb.tar.xz
yuzu-e31425df3877636c098ec7426ebd2067920715cb.zip
General: Recover Prometheus project from harddrive failure
This commit: Implements CPU Interrupts, Replaces Cycle Timing for Host Timing, Reworks the Kernel's Scheduler, Introduce Idle State and Suspended State, Recreates the bootmanager, Initializes Multicore system.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 4ae4529f5..d7f0dcabd 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -863,9 +863,9 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha
863 if (same_thread && info_sub_id == 0xFFFFFFFFFFFFFFFF) { 863 if (same_thread && info_sub_id == 0xFFFFFFFFFFFFFFFF) {
864 const u64 thread_ticks = current_thread->GetTotalCPUTimeTicks(); 864 const u64 thread_ticks = current_thread->GetTotalCPUTimeTicks();
865 865
866 out_ticks = thread_ticks + (core_timing.GetTicks() - prev_ctx_ticks); 866 out_ticks = thread_ticks + (core_timing.GetCPUTicks() - prev_ctx_ticks);
867 } else if (same_thread && info_sub_id == system.CurrentCoreIndex()) { 867 } else if (same_thread && info_sub_id == system.CurrentCoreIndex()) {
868 out_ticks = core_timing.GetTicks() - prev_ctx_ticks; 868 out_ticks = core_timing.GetCPUTicks() - prev_ctx_ticks;
869 } 869 }
870 870
871 *result = out_ticks; 871 *result = out_ticks;
@@ -1428,9 +1428,10 @@ static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr e
1428 1428
1429 ASSERT(kernel.CurrentProcess()->GetResourceLimit()->Reserve(ResourceType::Threads, 1)); 1429 ASSERT(kernel.CurrentProcess()->GetResourceLimit()->Reserve(ResourceType::Threads, 1));
1430 1430
1431 ThreadType type = THREADTYPE_USER;
1431 CASCADE_RESULT(std::shared_ptr<Thread> thread, 1432 CASCADE_RESULT(std::shared_ptr<Thread> thread,
1432 Thread::Create(kernel, "", entry_point, priority, arg, processor_id, stack_top, 1433 Thread::Create(system, type, "", entry_point, priority, arg, processor_id, stack_top,
1433 *current_process)); 1434 current_process));
1434 1435
1435 const auto new_thread_handle = current_process->GetHandleTable().Create(thread); 1436 const auto new_thread_handle = current_process->GetHandleTable().Create(thread);
1436 if (new_thread_handle.Failed()) { 1437 if (new_thread_handle.Failed()) {
@@ -1513,13 +1514,6 @@ static void SleepThread(Core::System& system, s64 nanoseconds) {
1513 } else { 1514 } else {
1514 current_thread->Sleep(nanoseconds); 1515 current_thread->Sleep(nanoseconds);
1515 } 1516 }
1516
1517 if (is_redundant) {
1518 // If it's redundant, the core is pretty much idle. Some games keep idling
1519 // a core while it's doing nothing, we advance timing to avoid costly continuous
1520 // calls.
1521 system.CoreTiming().AddTicks(2000);
1522 }
1523 system.PrepareReschedule(current_thread->GetProcessorID()); 1517 system.PrepareReschedule(current_thread->GetProcessorID());
1524} 1518}
1525 1519
@@ -1725,10 +1719,7 @@ static u64 GetSystemTick(Core::System& system) {
1725 auto& core_timing = system.CoreTiming(); 1719 auto& core_timing = system.CoreTiming();
1726 1720
1727 // Returns the value of cntpct_el0 (https://switchbrew.org/wiki/SVC#svcGetSystemTick) 1721 // Returns the value of cntpct_el0 (https://switchbrew.org/wiki/SVC#svcGetSystemTick)
1728 const u64 result{Core::Timing::CpuCyclesToClockCycles(system.CoreTiming().GetTicks())}; 1722 const u64 result{system.CoreTiming().GetClockTicks()};
1729
1730 // Advance time to defeat dumb games that busy-wait for the frame to end.
1731 core_timing.AddTicks(400);
1732 1723
1733 return result; 1724 return result;
1734} 1725}