physical_core.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Copyright 2020 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <cstddef>
  6. #include <memory>
  7. namespace Kernel {
  8. class Scheduler;
  9. } // namespace Kernel
  10. namespace Core {
  11. class ARM_Interface;
  12. class ExclusiveMonitor;
  13. class System;
  14. } // namespace Core
  15. namespace Kernel {
  16. class PhysicalCore {
  17. public:
  18. PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id,
  19. Core::ExclusiveMonitor& exclusive_monitor);
  20. ~PhysicalCore();
  21. /// Execute current jit state
  22. void Run();
  23. /// Execute a single instruction in current jit.
  24. void Step();
  25. /// Stop JIT execution/exit
  26. void Stop();
  27. // Shutdown this physical core.
  28. void Shutdown();
  29. Core::ARM_Interface& ArmInterface() {
  30. return *arm_interface;
  31. }
  32. const Core::ARM_Interface& ArmInterface() const {
  33. return *arm_interface;
  34. }
  35. bool IsMainCore() const {
  36. return core_index == 0;
  37. }
  38. bool IsSystemCore() const {
  39. return core_index == 3;
  40. }
  41. std::size_t CoreIndex() const {
  42. return core_index;
  43. }
  44. Kernel::Scheduler& Scheduler() {
  45. return *scheduler;
  46. }
  47. const Kernel::Scheduler& Scheduler() const {
  48. return *scheduler;
  49. }
  50. private:
  51. std::size_t core_index;
  52. KernelCore& kernel;
  53. std::shared_ptr<Core::ARM_Interface> arm_interface;
  54. std::shared_ptr<Kernel::Scheduler> scheduler;
  55. };
  56. } // namespace Kernel