Split up exec386_dynarec() a bit.

This commit is contained in:
SarahW 2020-09-05 20:51:50 +01:00
commit 5a94c78cbb

View file

@ -240,29 +240,8 @@ static void prefetch_flush()
int cpu_end_block_after_ins = 0; int cpu_end_block_after_ins = 0;
static int cycles_main = 0;
void exec386_dynarec(int cycs)
{
uint8_t temp;
uint32_t addr;
int tempi;
int cycdiff;
int oldcyc;
int cyc_period = cycs / 2000; /*5us*/
cycles_main += cycs; static inline void exec_interpreter(void)
while (cycles_main > 0)
{
int cycles_start;
cycles += cyc_period;
cycles_start = cycles;
while (cycles>0)
{
oldcyc=cycles;
// if (output && CACHE_ON()) pclog("Block %04x:%04x %04x:%08x\n", CS, pc, SS,ESP);
if (!CACHE_ON()) /*Interpret block*/
{ {
cpu_block_end = 0; cpu_block_end = 0;
x86_was_reset = 0; x86_was_reset = 0;
@ -313,28 +292,14 @@ void exec386_dynarec(int cycs)
if (trap) if (trap)
{ {
trap = 0; trap = 0;
flags_rebuild(); cpu_state.oldpc = cpu_state.pc;
if (msw&1) x86_int(1);
{
pmodeint(1,0);
}
else
{
writememw(ss,(SP-2)&0xFFFF,cpu_state.flags);
writememw(ss,(SP-4)&0xFFFF,CS);
writememw(ss,(SP-6)&0xFFFF,cpu_state.pc);
SP-=6;
addr = (1 << 2) + idt.base;
cpu_state.flags &= ~I_FLAG;
cpu_state.flags &= ~T_FLAG;
cpu_state.pc=readmemw(0,addr);
loadcs(readmemw(0,addr+2));
}
} }
cpu_end_block_after_ins = 0; cpu_end_block_after_ins = 0;
} }
else
static inline void exec_recompiler(void)
{ {
uint32_t phys_addr = get_phys(cs+cpu_state.pc); uint32_t phys_addr = get_phys(cs+cpu_state.pc);
int hash = HASH(phys_addr); int hash = HASH(phys_addr);
@ -595,6 +560,32 @@ void exec386_dynarec(int cycs)
} }
static int cycles_main = 0;
void exec386_dynarec(int cycs)
{
uint8_t temp;
int tempi;
int cycdiff;
int oldcyc;
int cyc_period = cycs / 2000; /*5us*/
cycles_main += cycs;
while (cycles_main > 0)
{
int cycles_start;
cycles += cyc_period;
cycles_start = cycles;
while (cycles>0)
{
oldcyc=cycles;
// if (output && CACHE_ON()) pclog("Block %04x:%04x %04x:%08x\n", CS, pc, SS,ESP);
if (!CACHE_ON()) /*Interpret block*/
exec_interpreter();
else
exec_recompiler();
cycdiff=oldcyc-cycles; cycdiff=oldcyc-cycles;
tsc += cycdiff; tsc += cycdiff;
@ -637,25 +628,9 @@ void exec386_dynarec(int cycs)
temp=picinterrupt(); temp=picinterrupt();
if (temp!=0xFF) if (temp!=0xFF)
{ {
cpu_state.oldpc = cpu_state.pc;
x86_int(temp);
// pclog("IRQ %02X %04X:%04X %04X:%04X\n", temp, SS, SP, CS, pc); // pclog("IRQ %02X %04X:%04X %04X:%04X\n", temp, SS, SP, CS, pc);
CPU_BLOCK_END();
flags_rebuild();
if (msw&1)
{
pmodeint(temp,0);
}
else
{
writememw(ss,(SP-2)&0xFFFF,cpu_state.flags);
writememw(ss,(SP-4)&0xFFFF,CS);
writememw(ss,(SP-6)&0xFFFF,cpu_state.pc);
SP-=6;
addr=temp<<2;
cpu_state.flags &= ~I_FLAG;
cpu_state.flags &= ~T_FLAG;
cpu_state.pc=readmemw(0,addr);
loadcs(readmemw(0,addr+2));
}
} }
} }
} }