2016-07-01 15:01:06 +02:00
|
|
|
/* This file is part of the dynarmic project.
|
|
|
|
* Copyright (c) 2016 MerryMage
|
|
|
|
* This software may be used and distributed according to the terms of the GNU
|
|
|
|
* General Public License version 2 or any later version.
|
|
|
|
*/
|
2016-08-05 19:54:19 +02:00
|
|
|
|
2016-07-01 15:01:06 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
|
|
|
namespace Dynarmic {
|
|
|
|
namespace BackendX64 {
|
|
|
|
|
2016-08-13 01:10:23 +02:00
|
|
|
class BlockOfCode;
|
|
|
|
|
2016-08-24 21:07:08 +02:00
|
|
|
constexpr size_t SpillCount = 64;
|
2016-07-01 15:01:06 +02:00
|
|
|
|
2016-12-15 22:31:58 +01:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(push)
|
|
|
|
#pragma warning(disable:4324) // Structure was padded due to alignment specifier
|
|
|
|
#endif
|
|
|
|
|
2018-01-01 23:49:17 +01:00
|
|
|
struct A32JitState {
|
2018-01-02 18:45:39 +01:00
|
|
|
using ProgramCounterType = u32;
|
|
|
|
|
2018-01-01 23:49:17 +01:00
|
|
|
A32JitState() { ResetRSB(); }
|
2016-08-13 01:10:23 +02:00
|
|
|
|
2016-07-01 15:01:06 +02:00
|
|
|
std::array<u32, 16> Reg{}; // Current register file.
|
|
|
|
// TODO: Mode-specific register sets unimplemented.
|
|
|
|
|
2017-12-02 15:03:54 +01:00
|
|
|
u32 CPSR_ge = 0;
|
2017-12-02 16:24:10 +01:00
|
|
|
u32 CPSR_et = 0;
|
2017-12-02 16:54:48 +01:00
|
|
|
u32 CPSR_q = 0;
|
2017-12-09 16:42:47 +01:00
|
|
|
u32 CPSR_nzcv = 0;
|
|
|
|
u32 CPSR_jaifm = 0;
|
|
|
|
|
2017-12-02 14:55:04 +01:00
|
|
|
u32 Cpsr() const;
|
|
|
|
void SetCpsr(u32 cpsr);
|
|
|
|
|
2016-08-05 19:54:19 +02:00
|
|
|
alignas(u64) std::array<u32, 64> ExtReg{}; // Extension registers.
|
2016-08-01 21:03:13 +02:00
|
|
|
|
2016-08-02 14:46:12 +02:00
|
|
|
std::array<u64, SpillCount> Spill{}; // Spill.
|
2016-07-01 15:01:06 +02:00
|
|
|
|
2016-08-07 19:08:48 +02:00
|
|
|
// For internal use (See: BlockOfCode::RunCode)
|
2016-08-07 01:40:29 +02:00
|
|
|
u32 guest_MXCSR = 0x00001f80;
|
2016-08-05 19:54:19 +02:00
|
|
|
u32 save_host_MXCSR = 0;
|
2017-12-03 03:42:22 +01:00
|
|
|
s64 cycles_to_run = 0;
|
2016-07-04 11:22:11 +02:00
|
|
|
s64 cycles_remaining = 0;
|
2016-08-15 16:02:08 +02:00
|
|
|
bool halt_requested = false;
|
2016-08-05 19:54:19 +02:00
|
|
|
|
TranslateArm: Implement CLREX, LDREX, LDREXB, LDREXD, LDREXH, STREX, STREXB, STREXD, STREXH, SWP, SWPB
2016-08-09 23:48:20 +02:00
|
|
|
// Exclusive state
|
|
|
|
static constexpr u32 RESERVATION_GRANULE_MASK = 0xFFFFFFF8;
|
|
|
|
u32 exclusive_state = 0;
|
|
|
|
u32 exclusive_address = 0;
|
|
|
|
|
2016-08-15 16:48:22 +02:00
|
|
|
static constexpr size_t RSBSize = 8; // MUST be a power of 2.
|
2017-11-27 21:29:19 +01:00
|
|
|
static constexpr size_t RSBPtrMask = RSBSize - 1;
|
2016-08-13 01:10:23 +02:00
|
|
|
u32 rsb_ptr = 0;
|
|
|
|
std::array<u64, RSBSize> rsb_location_descriptors;
|
|
|
|
std::array<u64, RSBSize> rsb_codeptrs;
|
2016-08-31 22:57:33 +02:00
|
|
|
void ResetRSB();
|
2016-08-13 01:10:23 +02:00
|
|
|
|
2016-08-06 18:21:29 +02:00
|
|
|
u32 FPSCR_IDC = 0;
|
|
|
|
u32 FPSCR_UFC = 0;
|
2016-09-05 15:39:17 +02:00
|
|
|
u32 FPSCR_mode = 0;
|
|
|
|
u32 FPSCR_nzcv = 0;
|
2016-08-05 19:54:19 +02:00
|
|
|
u32 old_FPSCR = 0;
|
|
|
|
u32 Fpscr() const;
|
|
|
|
void SetFpscr(u32 FPSCR);
|
2017-12-12 15:18:21 +01:00
|
|
|
|
|
|
|
u64 GetUniqueHash() const;
|
2016-07-01 15:01:06 +02:00
|
|
|
};
|
|
|
|
|
2016-12-15 22:31:58 +01:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(pop)
|
|
|
|
#endif
|
|
|
|
|
2016-08-24 21:07:08 +02:00
|
|
|
using CodePtr = const void*;
|
2016-07-01 15:01:06 +02:00
|
|
|
|
|
|
|
} // namespace BackendX64
|
|
|
|
} // namespace Dynarmic
|