Cleaned up exec386_dynarec() a bit.
This commit is contained in:
parent
9060f4552f
commit
2ccf771cf3
1 changed files with 282 additions and 312 deletions
|
|
@ -506,7 +506,7 @@ int dontprint=0;
|
|||
#include "386_ops.h"
|
||||
|
||||
|
||||
#define CACHE_ON() (!(cr0 & (1 << 30)) /*&& (cr0 & 1)*/ && !(cpu_state.flags & T_FLAG))
|
||||
#define CACHE_ON() (!(cr0 & (1 << 30)) && !(cpu_state.flags & T_FLAG))
|
||||
//#define CACHE_ON() 0
|
||||
|
||||
static int cycles_main = 0;
|
||||
|
|
@ -518,7 +518,7 @@ void exec386_dynarec(int cycs)
|
|||
int cycdiff;
|
||||
int oldcyc;
|
||||
int cyc_period = cycs / 2000; /*5us*/
|
||||
//output = 3;
|
||||
|
||||
cycles_main += cycs;
|
||||
while (cycles_main > 0)
|
||||
{
|
||||
|
|
@ -527,7 +527,6 @@ void exec386_dynarec(int cycs)
|
|||
cycles += cyc_period;
|
||||
cycles_start = cycles;
|
||||
|
||||
// output=3;
|
||||
while (cycles>0)
|
||||
{
|
||||
oldcyc=cycles;
|
||||
|
|
@ -546,8 +545,7 @@ void exec386_dynarec(int cycs)
|
|||
cpu_state.ssegs = 0;
|
||||
|
||||
fetchdat = fastreadl(cs + cpu_state.pc);
|
||||
// if (!fetchdat)
|
||||
// fatal("Dead with cache off\n");
|
||||
|
||||
if (!cpu_state.abrt)
|
||||
{
|
||||
trap = cpu_state.flags & T_FLAG;
|
||||
|
|
@ -564,12 +562,6 @@ void exec386_dynarec(int cycs)
|
|||
if (((cs + cpu_state.pc) >> 12) != pccache)
|
||||
CPU_BLOCK_END();
|
||||
|
||||
/* if (ssegs)
|
||||
{
|
||||
ds=oldds;
|
||||
ss=oldss;
|
||||
ssegs=0;
|
||||
}*/
|
||||
if (cpu_state.abrt)
|
||||
CPU_BLOCK_END();
|
||||
if (trap)
|
||||
|
|
@ -579,11 +571,6 @@ void exec386_dynarec(int cycs)
|
|||
|
||||
ins++;
|
||||
insc++;
|
||||
|
||||
/* if ((cs + pc) == 4)
|
||||
fatal("4\n");*/
|
||||
/* if (ins >= 141400000)
|
||||
output = 3;*/
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -667,20 +654,16 @@ void exec386_dynarec(int cycs)
|
|||
|
||||
// if (output) pclog("Run block at %04x:%04x %04x %04x %04x %04x %04x %04x ESP=%08x %04x %08x %08x %016llx %08x\n", CS, pc, AX, BX, CX, DX, SI, DI, ESP, BP, get_phys(cs+pc), block->phys, block->page_mask, block->endpc);
|
||||
|
||||
inrecomp=1;
|
||||
inrecomp=1;
|
||||
code();
|
||||
inrecomp=0;
|
||||
// cpu_recomp_ins += block->ins;
|
||||
inrecomp=0;
|
||||
|
||||
cpu_recomp_blocks++;
|
||||
/* ins += codeblock_ins[index];
|
||||
insc += codeblock_ins[index];*/
|
||||
/* pclog("Exit block now %04X:%04X\n", CS, pc);*/
|
||||
}
|
||||
else if (valid_block && !cpu_state.abrt)
|
||||
{
|
||||
uint32_t start_pc = cpu_state.pc;
|
||||
|
||||
// pclog("Hash %08x %i\n", codeblock_hash_pc[HASH(cs + pc)], codeblock_page_dirty[(cs + pc) >> 12]);
|
||||
cpu_block_end = 0;
|
||||
x86_was_reset = 0;
|
||||
|
||||
|
|
@ -699,10 +682,7 @@ inrecomp=0;
|
|||
cpu_state.ssegs = 0;
|
||||
|
||||
fetchdat = fastreadl(cs + cpu_state.pc);
|
||||
// if (fetchdat == 0xffffffff)
|
||||
// fatal("Dead ffffffff\n");
|
||||
// if (!fetchdat)
|
||||
// fatal("Dead\n");
|
||||
|
||||
if (!cpu_state.abrt)
|
||||
{
|
||||
trap = cpu_state.flags & T_FLAG;
|
||||
|
|
@ -752,19 +732,15 @@ inrecomp=0;
|
|||
codegen_reset();
|
||||
|
||||
codegen_in_recompile = 0;
|
||||
// output &= ~2;
|
||||
}
|
||||
else if (!cpu_state.abrt)
|
||||
{
|
||||
/*Mark block but do not recompile*/
|
||||
uint32_t start_pc = cpu_state.pc;
|
||||
|
||||
// pclog("Hash %08x %i\n", codeblock_hash_pc[HASH(cs + pc)], codeblock_page_dirty[(cs + pc) >> 12]);
|
||||
cpu_block_end = 0;
|
||||
x86_was_reset = 0;
|
||||
|
||||
// cpu_new_blocks++;
|
||||
|
||||
codegen_block_init(phys_addr);
|
||||
|
||||
// if (output) pclog("Recompile block at %04x:%04x %04x %04x %04x %04x %04x %04x ESP=%04x %04x %02x%02x:%02x%02x %02x%02x:%02x%02x %02x%02x:%02x%02x\n", CS, pc, AX, BX, CX, DX, SI, DI, ESP, BP, ram[0x116330+0x6df4+0xa+3], ram[0x116330+0x6df4+0xa+2], ram[0x116330+0x6df4+0xa+1], ram[0x116330+0x6df4+0xa+0], ram[0x11d136+3],ram[0x11d136+2],ram[0x11d136+1],ram[0x11d136+0], ram[(0x119abe)+0x3],ram[(0x119abe)+0x2],ram[(0x119abe)+0x1],ram[(0x119abe)+0x0]);
|
||||
|
|
@ -824,21 +800,15 @@ inrecomp=0;
|
|||
|
||||
if (x86_was_reset)
|
||||
codegen_reset();
|
||||
|
||||
// output &= ~2;
|
||||
}
|
||||
else
|
||||
cpu_state.oldpc = cpu_state.pc;
|
||||
|
||||
// if (output && (SP & 1))
|
||||
// fatal("odd SP\n");
|
||||
}
|
||||
|
||||
cycdiff=oldcyc-cycles;
|
||||
tsc += cycdiff;
|
||||
|
||||
// timer_end_period(cycles);
|
||||
|
||||
if (cpu_state.abrt)
|
||||
{
|
||||
flags_rebuild();
|
||||
|
|
@ -865,7 +835,6 @@ inrecomp=0;
|
|||
{
|
||||
trap = 0;
|
||||
flags_rebuild();
|
||||
// oldpc=pc;
|
||||
if (msw&1)
|
||||
{
|
||||
pmodeint(1,0);
|
||||
|
|
@ -923,6 +892,7 @@ inrecomp=0;
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc))
|
||||
timer_process();
|
||||
cycles_main -= (cycles_start - cycles);
|
||||
|
|
|
|||
Loading…
Reference in a new issue