summaryrefslogtreecommitdiff
path: root/src/core/cpu_manager.h
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-03-08 22:39:41 -0400
committerGravatar Fernando Sahmkow2020-06-27 11:35:42 -0400
commitab9aae28bf5daa5fa7105bb4ef41b6d0b3c9cdc1 (patch)
treeec11dc90eb2cad49237eecc98766f61b04724254 /src/core/cpu_manager.h
parentScheduler: Set last running time on thread. (diff)
downloadyuzu-ab9aae28bf5daa5fa7105bb4ef41b6d0b3c9cdc1.tar.gz
yuzu-ab9aae28bf5daa5fa7105bb4ef41b6d0b3c9cdc1.tar.xz
yuzu-ab9aae28bf5daa5fa7105bb4ef41b6d0b3c9cdc1.zip
General: Initial Setup for Single Core.
Diffstat (limited to 'src/core/cpu_manager.h')
-rw-r--r--src/core/cpu_manager.h30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/core/cpu_manager.h b/src/core/cpu_manager.h
index e83ab20f9..1e81481ec 100644
--- a/src/core/cpu_manager.h
+++ b/src/core/cpu_manager.h
@@ -30,6 +30,10 @@ public:
30 CpuManager& operator=(const CpuManager&) = delete; 30 CpuManager& operator=(const CpuManager&) = delete;
31 CpuManager& operator=(CpuManager&&) = delete; 31 CpuManager& operator=(CpuManager&&) = delete;
32 32
33 /// Sets if emulation is multicore or single core, must be set before Initialize
34 void SetMulticore(bool is_multicore) {
35 this->is_multicore = is_multicore;
36 }
33 void Initialize(); 37 void Initialize();
34 void Shutdown(); 38 void Shutdown();
35 39
@@ -40,21 +44,34 @@ public:
40 std::function<void(void*)> GetSuspendThreadStartFunc(); 44 std::function<void(void*)> GetSuspendThreadStartFunc();
41 void* GetStartFuncParamater(); 45 void* GetStartFuncParamater();
42 46
47 std::size_t CurrentCore() const {
48 return current_core;
49 }
50
43private: 51private:
44 static void GuestThreadFunction(void* cpu_manager); 52 static void GuestThreadFunction(void* cpu_manager);
45 static void GuestRewindFunction(void* cpu_manager); 53 static void GuestRewindFunction(void* cpu_manager);
46 static void IdleThreadFunction(void* cpu_manager); 54 static void IdleThreadFunction(void* cpu_manager);
47 static void SuspendThreadFunction(void* cpu_manager); 55 static void SuspendThreadFunction(void* cpu_manager);
48 56
49 void RunGuestThread(); 57 void MultiCoreRunGuestThread();
50 void RunGuestLoop(); 58 void MultiCoreRunGuestLoop();
51 void RunIdleThread(); 59 void MultiCoreRunIdleThread();
52 void RunSuspendThread(); 60 void MultiCoreRunSuspendThread();
61 void MultiCorePause(bool paused);
62
63 void SingleCoreRunGuestThread();
64 void SingleCoreRunGuestLoop();
65 void SingleCoreRunIdleThread();
66 void SingleCoreRunSuspendThread();
67 void SingleCorePause(bool paused);
53 68
54 static void ThreadStart(CpuManager& cpu_manager, std::size_t core); 69 static void ThreadStart(CpuManager& cpu_manager, std::size_t core);
55 70
56 void RunThread(std::size_t core); 71 void RunThread(std::size_t core);
57 72
73 void PreemptSingleCore();
74
58 struct CoreData { 75 struct CoreData {
59 std::shared_ptr<Common::Fiber> host_context; 76 std::shared_ptr<Common::Fiber> host_context;
60 std::unique_ptr<Common::Event> enter_barrier; 77 std::unique_ptr<Common::Event> enter_barrier;
@@ -70,6 +87,11 @@ private:
70 87
71 std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{}; 88 std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{};
72 89
90 bool is_multicore{};
91 std::size_t current_core{};
92 std::size_t preemption_count{};
93 static constexpr std::size_t max_cycle_runs = 5;
94
73 System& system; 95 System& system;
74}; 96};
75 97