core.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 "common/common_types.h"
  6. class ARM_Interface;
  7. ////////////////////////////////////////////////////////////////////////////////////////////////////
  8. namespace Core {
  9. struct ThreadContext {
  10. u32 cpu_registers[13];
  11. u32 sp;
  12. u32 lr;
  13. u32 pc;
  14. u32 cpsr;
  15. u32 fpu_registers[32];
  16. u32 fpscr;
  17. u32 fpexc;
  18. // These are not part of native ThreadContext, but needed by emu
  19. u32 reg_15;
  20. u32 mode;
  21. };
  22. extern ARM_Interface* g_app_core; ///< ARM11 application core
  23. extern ARM_Interface* g_sys_core; ///< ARM11 system (OS) core
  24. ////////////////////////////////////////////////////////////////////////////////////////////////////
  25. /// Start the core
  26. void Start();
  27. /**
  28. * Run the core CPU loop
  29. * This function runs the core for the specified number of CPU instructions before trying to update
  30. * hardware. This is much faster than SingleStep (and should be equivalent), as the CPU is not
  31. * required to do a full dispatch with each instruction. NOTE: the number of instructions requested
  32. * is not guaranteed to run, as this will be interrupted preemptively if a hardware update is
  33. * requested (e.g. on a thread switch).
  34. */
  35. void RunLoop(int tight_loop=1000);
  36. /// Step the CPU one instruction
  37. void SingleStep();
  38. /// Halt the core
  39. void Halt(const char *msg);
  40. /// Kill the core
  41. void Stop();
  42. /// Initialize the core
  43. int Init();
  44. /// Shutdown the core
  45. void Shutdown();
  46. } // namespace