A number of recompiler fixes and put some of the timer/cycle-related changes behind #ifdef's as they are no longer used but someone may want to still try them out.

This commit is contained in:
OBattler
2020-07-15 18:30:27 +02:00
parent db3364fb4b
commit 0b4b2b4d2f
14 changed files with 89 additions and 41 deletions

View File

@@ -20,6 +20,7 @@ void codegen_accumulate(int acc_reg, int delta)
{
acc_regs[acc_reg].count += delta;
#ifdef USE_ACYCS
if ((acc_reg == ACCREG_cycles) && (delta != 0)) {
if (delta == -1) {
/* -delta = 1 */
@@ -41,6 +42,7 @@ void codegen_accumulate(int acc_reg, int delta)
addlong(-delta);
}
}
#endif
}
void codegen_accumulate_flush(void)

View File

@@ -20,6 +20,7 @@ void codegen_accumulate(int acc_reg, int delta)
{
acc_regs[acc_reg].count += delta;
#ifdef USE_ACYCS
if ((acc_reg == ACCREG_cycles) && (delta != 0)) {
if (delta == -1) {
/* -delta = 1 */
@@ -38,6 +39,7 @@ void codegen_accumulate(int acc_reg, int delta)
addlong((uintptr_t) -delta);
}
}
#endif
}
void codegen_accumulate_flush(void)

View File

@@ -2969,23 +2969,31 @@ static inline void SUB_HOST_REG_IMM(int host_reg, uint32_t imm)
static inline void INC_HOST_REG_W(int host_reg)
{
addbyte(0x66); /*DECW host_reg*/
addbyte(0x66); /*INCW host_reg*/
if (host_reg & 8)
addbyte(0x41);
addbyte(0xff);
addbyte(0xc0 | (host_reg & 7));
}
static inline void INC_HOST_REG(int host_reg)
{
addbyte(0xff); /*DECL host_reg*/
if (host_reg & 8)
addbyte(0x41);
addbyte(0xff); /*INCL host_reg*/
addbyte(0xc0 | (host_reg & 7));
}
static inline void DEC_HOST_REG_W(int host_reg)
{
addbyte(0x66); /*DECW host_reg*/
if (host_reg & 8)
addbyte(0x41);
addbyte(0xff);
addbyte(0xc8 | (host_reg & 7));
}
static inline void DEC_HOST_REG(int host_reg)
{
if (host_reg & 8)
addbyte(0x41);
addbyte(0xff); /*DECL host_reg*/
addbyte(0xc8 | (host_reg & 7));
}

View File

@@ -485,7 +485,7 @@ static inline void SUB_HOST_REG_IMM(int host_reg, uint32_t imm)
static inline void INC_HOST_REG_W(int host_reg)
{
addbyte(0x66); /*DECW host_reg*/
addbyte(0x66); /*INCW host_reg*/
addbyte(0x40 | host_reg);
}
static inline void INC_HOST_REG(int host_reg)

View File

@@ -1097,6 +1097,7 @@ generate_call:
codegen_block_full_ins++;
codegen_endpc = (cs + cpu_state.pc) + 8;
#ifdef CHECK_INT
/* Check for interrupts. */
addbyte(0xf6); /* test byte ptr[&pic_pending],1 */
addbyte(0x04);
@@ -1105,6 +1106,7 @@ generate_call:
addbyte(0x01);
addbyte(0x0F); addbyte(0x85); /*JNZ 0*/
addlong((uint32_t)(uintptr_t)&block->data[BLOCK_EXIT_OFFSET] - (uint32_t)(uintptr_t)(&block->data[block_pos + 4]));
#endif
return;
}
@@ -1178,11 +1180,13 @@ generate_call:
block->ins++;
#ifdef CHECK_INT
/* Check for interrupts. */
addbyte(0x0a); /* or al,byte ptr[&pic_pending] */
addbyte(0x04);
addbyte(0x25);
addlong((uint32_t) (uintptr_t) &pic_pending);
#endif
addbyte(0x85); /*OR %eax, %eax*/
addbyte(0xc0);

View File

@@ -2066,6 +2066,7 @@ generate_call:
codegen_block_full_ins++;
codegen_endpc = (cs + cpu_state.pc) + 8;
#ifdef CHECK_INT
/* Check for interrupts. */
addbyte(0xf6); /* test byte ptr[&pic_pending],1 */
addbyte(0x05);
@@ -2073,6 +2074,7 @@ generate_call:
addbyte(0x01);
addbyte(0x0F); addbyte(0x85); /*JNZ 0*/
addlong((uint32_t)&block->data[BLOCK_EXIT_OFFSET] - (uint32_t)(&block->data[block_pos + 4]));
#endif
return;
}
@@ -2157,10 +2159,12 @@ generate_call:
block->ins++;
#ifdef CHECK_INT
/* Check for interrupts. */
addbyte(0x0a); /* or al,byte ptr[&pic_pending] */
addbyte(0x05);
addlong((uint32_t) (uintptr_t) &pic_pending);
#endif
addbyte(0x09); /*OR %eax, %eax*/
addbyte(0xc0);