Reorganized some CPU structures a bit and fixed inappropriate behavior of some mem.c functions on 64-bit binaries (and made mem.c aware of ARM64 as well), fixes both 64-bit recompilers, closes #1215.

This commit is contained in:
OBattler
2021-08-27 13:31:47 +02:00
parent eb827a6629
commit ddc7c5b78a
20 changed files with 181 additions and 176 deletions

View File

@@ -210,11 +210,12 @@ typedef union {
} x86reg;
typedef struct {
uint32_t base;
uint32_t limit;
uint8_t access, ar_high;
int8_t checked; /*Non-zero if selector is known to be valid*/
uint16_t seg;
uint32_t base, limit,
limit_low, limit_high;
uint32_t limit_low, limit_high;
int checked; /*Non-zero if selector is known to be valid*/
} x86seg;
typedef union {
@@ -352,9 +353,9 @@ typedef struct {
} rm_data;
uint8_t ssegs, ismmx,
abrt, pad;
abrt, _smi_line;
int _cycles;
int _cycles, _in_smm;
uint16_t npxs, npxc;
@@ -364,8 +365,6 @@ typedef struct {
MMX_REG MM[8];
uint16_t old_npxc, new_npxc;
#ifdef USE_NEW_DYNAREC
uint32_t old_fp_control, new_fp_control;
#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
@@ -374,6 +373,8 @@ typedef struct {
#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 || defined __amd64__ || defined _M_X64
uint32_t trunc_fp_control;
#endif
#else
uint16_t old_npxc, new_npxc;
#endif
x86seg seg_cs, seg_ds, seg_es, seg_ss,
@@ -385,8 +386,17 @@ typedef struct {
} CR0;
uint16_t flags, eflags;
uint32_t _smbase;
} cpu_state_t;
#define in_smm cpu_state._in_smm
#define smi_line cpu_state._smi_line
#define smbase cpu_state._smbase
/*The cpu_state.flags below must match in both cpu_cur_status and block->status for a block
to be valid*/
#define CPU_STATUS_USE32 (1 << 0)
@@ -495,9 +505,8 @@ extern int hasfpu;
extern uint32_t cpu_features;
extern int in_smm, smi_line, smi_latched, smm_in_hlt;
extern int smi_latched, smm_in_hlt;
extern int smi_block;
extern uint32_t smbase;
#ifdef USE_NEW_DYNAREC
extern uint16_t cpu_cur_status;