arm_dyncom.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. #include "core/arm/arm_interface.h"
  8. #include "core/arm/skyeye_common/armdefs.h"
  9. class ARM_DynCom final : virtual public ARM_Interface {
  10. public:
  11. ARM_DynCom();
  12. ~ARM_DynCom();
  13. /**
  14. * Set the Program Counter to an address
  15. * @param pc Address to set PC to
  16. */
  17. void SetPC(u32 pc) override;
  18. /*
  19. * Get the current Program Counter
  20. * @return Returns current PC
  21. */
  22. u32 GetPC() const override;
  23. /**
  24. * Get an ARM register
  25. * @param index Register index (0-15)
  26. * @return Returns the value in the register
  27. */
  28. u32 GetReg(int index) const override;
  29. /**
  30. * Set an ARM register
  31. * @param index Register index (0-15)
  32. * @param value Value to set register to
  33. */
  34. void SetReg(int index, u32 value) override;
  35. /**
  36. * Get the current CPSR register
  37. * @return Returns the value of the CPSR register
  38. */
  39. u32 GetCPSR() const override;
  40. /**
  41. * Set the current CPSR register
  42. * @param cpsr Value to set CPSR to
  43. */
  44. void SetCPSR(u32 cpsr) override;
  45. /**
  46. * Returns the number of clock ticks since the last reset
  47. * @return Returns number of clock ticks
  48. */
  49. u64 GetTicks() const override;
  50. /**
  51. * Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time)
  52. * @param ticks Number of ticks to advance the CPU core
  53. */
  54. void AddTicks(u64 ticks) override;
  55. /**
  56. * Saves the current CPU context
  57. * @param ctx Thread context to save
  58. */
  59. void SaveContext(ThreadContext& ctx) override;
  60. /**
  61. * Loads a CPU context
  62. * @param ctx Thread context to load
  63. */
  64. void LoadContext(const ThreadContext& ctx) override;
  65. /// Prepare core for thread reschedule (if needed to correctly handle state)
  66. void PrepareReschedule() override;
  67. /**
  68. * Executes the given number of instructions
  69. * @param num_instructions Number of instructions to executes
  70. */
  71. void ExecuteInstructions(int num_instructions) override;
  72. private:
  73. std::unique_ptr<ARMul_State> state;
  74. u64 ticks;
  75. };