arm_dynarmic_32.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Copyright 2020 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <memory>
  6. #include <unordered_map>
  7. #include <dynarmic/A32/a32.h>
  8. #include <dynarmic/A64/a64.h>
  9. #include <dynarmic/A64/exclusive_monitor.h>
  10. #include "common/common_types.h"
  11. #include "common/hash.h"
  12. #include "core/arm/arm_interface.h"
  13. #include "core/arm/exclusive_monitor.h"
  14. namespace Memory {
  15. class Memory;
  16. }
  17. namespace Core {
  18. class DynarmicCallbacks32;
  19. class DynarmicExclusiveMonitor;
  20. class System;
  21. class ARM_Dynarmic_32 final : public ARM_Interface {
  22. public:
  23. ARM_Dynarmic_32(System& system, ExclusiveMonitor& exclusive_monitor, std::size_t core_index);
  24. ~ARM_Dynarmic_32() override;
  25. void SetPC(u64 pc) override;
  26. u64 GetPC() const override;
  27. u64 GetReg(int index) const override;
  28. void SetReg(int index, u64 value) override;
  29. u128 GetVectorReg(int index) const override;
  30. void SetVectorReg(int index, u128 value) override;
  31. u32 GetPSTATE() const override;
  32. void SetPSTATE(u32 pstate) override;
  33. void Run() override;
  34. void Step() override;
  35. VAddr GetTlsAddress() const override;
  36. void SetTlsAddress(VAddr address) override;
  37. void SetTPIDR_EL0(u64 value) override;
  38. u64 GetTPIDR_EL0() const override;
  39. void SaveContext(ThreadContext32& ctx) override;
  40. void SaveContext(ThreadContext64& ctx) override {}
  41. void LoadContext(const ThreadContext32& ctx) override;
  42. void LoadContext(const ThreadContext64& ctx) override {}
  43. void PrepareReschedule() override;
  44. void ClearExclusiveState() override;
  45. void ClearInstructionCache() override;
  46. void PageTableChanged(Common::PageTable& new_page_table,
  47. std::size_t new_address_space_size_in_bits) override;
  48. private:
  49. std::shared_ptr<Dynarmic::A32::Jit> MakeJit(Common::PageTable& page_table,
  50. std::size_t address_space_bits) const;
  51. using JitCacheKey = std::pair<Common::PageTable*, std::size_t>;
  52. using JitCacheType =
  53. std::unordered_map<JitCacheKey, std::shared_ptr<Dynarmic::A32::Jit>, Common::PairHash>;
  54. friend class DynarmicCallbacks32;
  55. std::unique_ptr<DynarmicCallbacks32> cb;
  56. JitCacheType jit_cache;
  57. std::shared_ptr<Dynarmic::A32::Jit> jit;
  58. std::size_t core_index;
  59. DynarmicExclusiveMonitor& exclusive_monitor;
  60. std::array<u32, 84> CP15_regs{};
  61. };
  62. } // namespace Core