core.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 "core/core.h"
  6. #include "core/hw/hw.h"
  7. #include "core/arm/disassembler/arm_disasm.h"
  8. #include "core/arm/interpreter/arm_interpreter.h"
  9. #include "core/hle/hle.h"
  10. #include "core/hle/kernel/thread.h"
  11. namespace Core {
  12. u64 g_last_ticks = 0; ///< Last CPU ticks
  13. ARM_Disasm* g_disasm = nullptr; ///< ARM disassembler
  14. ARM_Interface* g_app_core = nullptr; ///< ARM11 application core
  15. ARM_Interface* g_sys_core = nullptr; ///< ARM11 system (OS) core
  16. /// Run the core CPU loop
  17. void RunLoop(int tight_loop) {
  18. g_app_core->Run(tight_loop);
  19. HW::Update();
  20. if (HLE::g_reschedule) {
  21. Kernel::Reschedule();
  22. }
  23. }
  24. /// Step the CPU one instruction
  25. void SingleStep() {
  26. RunLoop(1);
  27. }
  28. /// Halt the core
  29. void Halt(const char *msg) {
  30. // TODO(ShizZy): ImplementMe
  31. }
  32. /// Kill the core
  33. void Stop() {
  34. // TODO(ShizZy): ImplementMe
  35. }
  36. /// Initialize the core
  37. int Init() {
  38. NOTICE_LOG(MASTER_LOG, "initialized OK");
  39. g_disasm = new ARM_Disasm();
  40. g_app_core = new ARM_Interpreter();
  41. g_sys_core = new ARM_Interpreter();
  42. g_last_ticks = Core::g_app_core->GetTicks();
  43. return 0;
  44. }
  45. void Shutdown() {
  46. delete g_disasm;
  47. delete g_app_core;
  48. delete g_sys_core;
  49. NOTICE_LOG(MASTER_LOG, "shutdown OK");
  50. }
  51. } // namespace