core.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 mode;
  20. };
  21. extern ARM_Interface* g_app_core; ///< ARM11 application core
  22. extern ARM_Interface* g_sys_core; ///< ARM11 system (OS) core
  23. ////////////////////////////////////////////////////////////////////////////////////////////////////
  24. /// Start the core
  25. void Start();
  26. /**
  27. * Run the core CPU loop
  28. * This function runs the core for the specified number of CPU instructions before trying to update
  29. * hardware. This is much faster than SingleStep (and should be equivalent), as the CPU is not
  30. * required to do a full dispatch with each instruction. NOTE: the number of instructions requested
  31. * is not guaranteed to run, as this will be interrupted preemptively if a hardware update is
  32. * requested (e.g. on a thread switch).
  33. */
  34. void RunLoop(int tight_loop=1000);
  35. /// Step the CPU one instruction
  36. void SingleStep();
  37. /// Halt the core
  38. void Halt(const char *msg);
  39. /// Kill the core
  40. void Stop();
  41. /// Initialize the core
  42. int Init();
  43. /// Shutdown the core
  44. void Shutdown();
  45. } // namespace