diff options
Diffstat (limited to 'src/core/cpu_manager.h')
-rw-r--r-- | src/core/cpu_manager.h | 30 |
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: CpuManager& operator=(const CpuManager&) = delete; CpuManager& operator=(CpuManager&&) = delete; + /// Sets if emulation is multicore or single core, must be set before Initialize + void SetMulticore(bool is_multicore) { + this->is_multicore = is_multicore; + } void Initialize(); void Shutdown(); @@ -40,21 +44,34 @@ public: std::function<void(void*)> GetSuspendThreadStartFunc(); void* GetStartFuncParamater(); + std::size_t CurrentCore() const { + return current_core; + } + private: static void GuestThreadFunction(void* cpu_manager); static void GuestRewindFunction(void* cpu_manager); static void IdleThreadFunction(void* cpu_manager); static void SuspendThreadFunction(void* cpu_manager); - void RunGuestThread(); - void RunGuestLoop(); - void RunIdleThread(); - void RunSuspendThread(); + void MultiCoreRunGuestThread(); + void MultiCoreRunGuestLoop(); + void MultiCoreRunIdleThread(); + void MultiCoreRunSuspendThread(); + void MultiCorePause(bool paused); + + void SingleCoreRunGuestThread(); + void SingleCoreRunGuestLoop(); + void SingleCoreRunIdleThread(); + void SingleCoreRunSuspendThread(); + void SingleCorePause(bool paused); static void ThreadStart(CpuManager& cpu_manager, std::size_t core); void RunThread(std::size_t core); + void PreemptSingleCore(); + struct CoreData { std::shared_ptr<Common::Fiber> host_context; std::unique_ptr<Common::Event> enter_barrier; @@ -70,6 +87,11 @@ private: std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{}; + bool is_multicore{}; + std::size_t current_core{}; + std::size_t preemption_count{}; + static constexpr std::size_t max_cycle_runs = 5; + System& system; }; |