Reordered some CPU variables and rewrote codegen emitted by the old recompiler's 64-bit version of codegen_accumulate_flush() to not assume 32-bit pointers, fixes 64-bit old recompiler, closes #1615.
This commit is contained in:
@@ -48,11 +48,16 @@ void codegen_accumulate(int acc_reg, int delta)
|
||||
void codegen_accumulate_flush(void)
|
||||
{
|
||||
if (acc_regs[0].count) {
|
||||
addbyte(0x81); /*ADD $acc_regs[0].count,acc_regs[0].dest*/
|
||||
addbyte(0x04);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t) acc_regs[0].dest_reg);
|
||||
addbyte(0x55); /*push rbp*/
|
||||
addbyte(0x48); /*mov rbp,val*/
|
||||
addbyte(0xbd);
|
||||
addlong((uint32_t) (acc_regs[0].dest_reg & 0xffffffffULL));
|
||||
addlong((uint32_t) (acc_regs[0].dest_reg >> 32ULL));
|
||||
addbyte(0x81); /* add d,[rbp][0],val */
|
||||
addbyte(0x45);
|
||||
addbyte(0x00);
|
||||
addlong(acc_regs[0].count);
|
||||
addbyte(0x5d); /*pop rbp*/
|
||||
}
|
||||
|
||||
acc_regs[0].count = 0;
|
||||
|
@@ -69,6 +69,9 @@ enum {
|
||||
#define CPUID_3DNOW (1UL << 31UL)
|
||||
|
||||
|
||||
/* Make sure this is as low as possible. */
|
||||
cpu_state_t cpu_state;
|
||||
|
||||
#ifdef USE_DYNAREC
|
||||
const OpFn *x86_dynarec_opcodes, *x86_dynarec_opcodes_0f,
|
||||
*x86_dynarec_opcodes_d8_a16, *x86_dynarec_opcodes_d8_a32,
|
||||
@@ -128,8 +131,6 @@ double cpu_dmulti;
|
||||
|
||||
msr_t msr;
|
||||
|
||||
cpu_state_t cpu_state;
|
||||
|
||||
cyrix_t cyrix;
|
||||
|
||||
cpu_family_t *cpu_f;
|
||||
|
@@ -461,6 +461,8 @@ COMPILE_TIME_ASSERT(sizeof(cpu_state_t) <= 128)
|
||||
|
||||
|
||||
/* Global variables. */
|
||||
extern cpu_state_t cpu_state;
|
||||
|
||||
extern const cpu_family_t cpu_families[];
|
||||
extern const cpu_legacy_machine_t cpu_legacy_table[];
|
||||
extern cpu_family_t *cpu_f;
|
||||
@@ -505,7 +507,6 @@ extern uint32_t cpu_cur_status;
|
||||
extern uint64_t cpu_CR4_mask;
|
||||
extern uint64_t tsc;
|
||||
extern msr_t msr;
|
||||
extern cpu_state_t cpu_state;
|
||||
extern uint8_t opcode;
|
||||
extern int cgate16;
|
||||
extern int cpl_override;
|
||||
|
Reference in New Issue
Block a user