core.cpp 1.4 KB

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