core.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <memory>
  6. #include "common/common_types.h"
  7. class ARM_Interface;
  8. ////////////////////////////////////////////////////////////////////////////////////////////////////
  9. namespace Core {
  10. struct ThreadContext {
  11. u32 cpu_registers[13];
  12. u32 sp;
  13. u32 lr;
  14. u32 pc;
  15. u32 cpsr;
  16. u32 fpu_registers[64];
  17. u32 fpscr;
  18. u32 fpexc;
  19. };
  20. extern std::unique_ptr<ARM_Interface> g_app_core; ///< ARM11 application core
  21. extern std::unique_ptr<ARM_Interface> g_sys_core; ///< ARM11 system (OS) core
  22. ////////////////////////////////////////////////////////////////////////////////////////////////////
  23. /// Start the core
  24. void Start();
  25. /**
  26. * Run the core CPU loop
  27. * This function runs the core for the specified number of CPU instructions before trying to update
  28. * hardware. This is much faster than SingleStep (and should be equivalent), as the CPU is not
  29. * required to do a full dispatch with each instruction. NOTE: the number of instructions requested
  30. * is not guaranteed to run, as this will be interrupted preemptively if a hardware update is
  31. * requested (e.g. on a thread switch).
  32. */
  33. void RunLoop(int tight_loop = 1000);
  34. /// Step the CPU one instruction
  35. void SingleStep();
  36. /// Halt the core
  37. void Halt(const char* msg);
  38. /// Kill the core
  39. void Stop();
  40. /// Initialize the core
  41. void Init();
  42. /// Shutdown the core
  43. void Shutdown();
  44. } // namespace