core.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2
  3. // Refer to the license.txt file included.
  4. #include "common/common_types.h"
  5. #include "common/log.h"
  6. #include "common/symbols.h"
  7. #include "video_core/video_core.h"
  8. #include "core/core.h"
  9. #include "core/mem_map.h"
  10. #include "core/hw/hw.h"
  11. #include "core/hw/gpu.h"
  12. #include "core/arm/disassembler/arm_disasm.h"
  13. #include "core/arm/interpreter/arm_interpreter.h"
  14. #include "core/hle/hle.h"
  15. #include "core/hle/kernel/thread.h"
  16. namespace Core {
  17. u64 g_last_ticks = 0; ///< Last CPU ticks
  18. ARM_Disasm* g_disasm = nullptr; ///< ARM disassembler
  19. ARM_Interface* g_app_core = nullptr; ///< ARM11 application core
  20. ARM_Interface* g_sys_core = nullptr; ///< ARM11 system (OS) core
  21. /// Run the core CPU loop
  22. void RunLoop(int tight_loop) {
  23. g_app_core->Run(tight_loop);
  24. HW::Update();
  25. if (HLE::g_reschedule) {
  26. Kernel::Reschedule();
  27. }
  28. }
  29. /// Step the CPU one instruction
  30. void SingleStep() {
  31. RunLoop(1);
  32. }
  33. /// Halt the core
  34. void Halt(const char *msg) {
  35. // TODO(ShizZy): ImplementMe
  36. }
  37. /// Kill the core
  38. void Stop() {
  39. // TODO(ShizZy): ImplementMe
  40. }
  41. /// Initialize the core
  42. int Init() {
  43. NOTICE_LOG(MASTER_LOG, "initialized OK");
  44. g_disasm = new ARM_Disasm();
  45. g_app_core = new ARM_Interpreter();
  46. g_sys_core = new ARM_Interpreter();
  47. g_last_ticks = Core::g_app_core->GetTicks();
  48. return 0;
  49. }
  50. void Shutdown() {
  51. delete g_disasm;
  52. delete g_app_core;
  53. delete g_sys_core;
  54. NOTICE_LOG(MASTER_LOG, "shutdown OK");
  55. }
  56. } // namespace