This commit is contained in:
Allofich
2021-11-16 17:38:03 +09:00
parent ae4a06c060
commit b109ae25c5
5 changed files with 45 additions and 67 deletions

View File

@@ -116,7 +116,7 @@ public:
addr&=4095;
if (host_readb(hostmem+addr)==(uint8_t)val) return;
host_writeb(hostmem+addr,val);
if (!*(uint8_t*)&write_map[addr]) {
if ((*(uint8_t*)&write_map[addr]) == 0) {
if (active_blocks) return;
active_count--;
if (!active_count) Release();
@@ -136,7 +136,7 @@ public:
addr&=4095;
if (host_readw(hostmem+addr)==(uint16_t)val) return;
host_writew(hostmem+addr,val);
if (!*(uint16_t*)&write_map[addr]) {
if ((*(uint16_t*)&write_map[addr]) == 0) {
if (active_blocks) return;
active_count--;
if (!active_count) Release();
@@ -156,7 +156,7 @@ public:
addr&=4095;
if (host_readd(hostmem+addr)==(uint32_t)val) return;
host_writed(hostmem+addr,val);
if (!*(uint32_t*)&write_map[addr]) {
if ((*(uint32_t*)&write_map[addr]) == 0) {
if (active_blocks) return;
active_count--;
if (!active_count) Release();
@@ -175,7 +175,7 @@ public:
}
addr&=4095;
if (host_readb(hostmem+addr)==(uint8_t)val) return false;
if (!*(uint8_t*)&write_map[addr]) {
if ((*(uint8_t*)&write_map[addr]) == 0) {
if (!active_blocks) {
active_count--;
if (!active_count) Release();
@@ -201,7 +201,7 @@ public:
}
addr&=4095;
if (host_readw(hostmem+addr)==(uint16_t)val) return false;
if (!*(uint16_t*)&write_map[addr]) {
if ((*(uint16_t*)&write_map[addr]) == 0) {
if (!active_blocks) {
active_count--;
if (!active_count) Release();
@@ -227,7 +227,7 @@ public:
}
addr&=4095;
if (host_readd(hostmem+addr)==(uint32_t)val) return false;
if (!*(uint32_t*)&write_map[addr]) {
if ((*(uint32_t*)&write_map[addr]) == 0) {
if (!active_blocks) {
active_count--;
if (!active_count) Release();

View File

@@ -1335,9 +1335,9 @@ static void dyn_fill_ea(bool addseg=true, DynReg * reg_ea=DREG(EA)) {
if (!decode.big_addr) {
Bits imm=0;
switch (decode.modrm.mod) {
case 0:imm=0;break;
case 1:imm=(int8_t)decode_fetchb();break;
case 2:imm=(int16_t)decode_fetchw();break;
case 1:imm=(int8_t)decode_fetchb();break;
case 2:imm=(int16_t)decode_fetchw();break;
default:imm=0;break;
}
DynReg * extend_src=reg_ea;
switch (decode.modrm.rm) {
@@ -2180,16 +2180,6 @@ static void dyn_closeblock(void) {
cache_closeblock();
}
/* UNUSED
static void dyn_normal_exit(BlockReturn code) {
gen_protectflags();
dyn_reduce_cycles();
dyn_set_eip_last();
dyn_save_critical_regs();
gen_return(code);
dyn_closeblock();
}*/
static void dyn_exit_link(Bits eip_change) {
gen_protectflags();
gen_dop_word_imm(DOP_ADD,decode.big_op,DREG(EIP),(decode.code-decode.code_start)+eip_change);
@@ -2244,30 +2234,32 @@ static void dyn_loop(LoopTypes type) {
gen_preloadreg(DREG(CYCLES));
gen_preloadreg(DREG(EIP));
switch (type) {
case LOOP_E:
gen_needflags();
gen_protectflags();
branch1=gen_create_branch(BR_NZ);
break;
case LOOP_NE:
gen_needflags();
gen_protectflags();
branch1=gen_create_branch(BR_Z);
break;
default:
gen_protectflags();
case LOOP_E:
gen_needflags();
gen_protectflags();
branch1=gen_create_branch(BR_NZ);
break;
case LOOP_NE:
gen_needflags();
gen_protectflags();
branch1=gen_create_branch(BR_Z);
break;
default:
gen_protectflags();
}
switch (type) {
case LOOP_E:
case LOOP_NE:
case LOOP_NONE:
gen_sop_word(SOP_DEC,decode.big_addr,DREG(ECX));
branch2=gen_create_branch(BR_Z);
break;
case LOOP_JCXZ:
gen_dop_word(DOP_TEST,decode.big_addr,DREG(ECX),DREG(ECX));
branch2=gen_create_branch(BR_NZ);
break;
case LOOP_E:
case LOOP_NE:
case LOOP_NONE:
gen_sop_word(SOP_DEC,decode.big_addr,DREG(ECX));
branch2=gen_create_branch(BR_Z);
break;
case LOOP_JCXZ:
gen_dop_word(DOP_TEST,decode.big_addr,DREG(ECX),DREG(ECX));
branch2=gen_create_branch(BR_NZ);
break;
default:
break;
}
/* Branch taken */
dyn_reduce_cycles();
@@ -2366,17 +2358,6 @@ static void dyn_iret(void) {
dyn_closeblock();
}
static void dyn_interrupt(Bitu num) {
gen_protectflags();
dyn_flags_gen_to_host();
dyn_reduce_cycles();
dyn_set_eip_last_end(DREG(TMPW));
dyn_save_critical_regs();
dyn_call_function_pagefault_check((void*)&CPU_Interrupt,"%Id%Id%Drd",num,CPU_INT_SOFTWARE,DREG(TMPW));
gen_return_fast(BR_Normal);
dyn_closeblock();
}
static bool dyn_io_writeB(Bitu port,uint8_t val) {
bool ex = CPU_IO_Exception(port,1);
if (!ex) IO_WriteB(port,val);
@@ -2489,7 +2470,6 @@ static CacheBlock * CreateCacheBlock(CodePageHandler * codepage,PhysPt start,Bit
decode.code_start=start;
decode.eip_location=start;
decode.code=start;
//Bitu cycles=0; UNUSED
decode.page.code=codepage;
decode.page.index=start&4095;
decode.page.wmap=codepage->write_map;

View File

@@ -106,7 +106,6 @@ static void dyn_fpu_esc0(){
if (decode.modrm.val >= 0xc0) {
dyn_fpu_top();
Bitu group=(decode.modrm.val >> 3) & 7;
//Bitu sub=(decode.modrm.val & 7);
switch (group){
case 0x00: //FADD ST,STi /
gen_call_function((void*)&FPU_FADD,"%Drd%Drd",DREG(TMPB),DREG(EA));
@@ -436,7 +435,6 @@ static void dyn_fpu_esc3(){
static void dyn_fpu_esc4(){
dyn_get_modrm();
Bitu group=(decode.modrm.val >> 3) & 7;
//Bitu sub=(decode.modrm.val & 7);
if (decode.modrm.val >= 0xc0) {
dyn_fpu_top();
switch(group){

View File

@@ -1000,7 +1000,7 @@ static uint8_t * gen_create_branch_long(BranchTypes type) {
}
static void gen_fill_branch_long(uint8_t * data,uint8_t * from=cache.pos) {
*(uint32_t*)data=(from-data-4);
*((uint32_t*)data) = (from-data-4);
}
static uint8_t * gen_create_jump(uint8_t * to=0) {

View File

@@ -97,19 +97,19 @@ static void dyn_string(STRING_OP op) {
gen_lea(DREG(EA),si_base,DREG(ESI),0,0);
}
switch (op&3) {
case 0:dyn_read_byte(DREG(EA),tmp_reg,false);break;
case 1:dyn_read_word(DREG(EA),tmp_reg,false);break;
case 2:dyn_read_word(DREG(EA),tmp_reg,true);break;
case 0:dyn_read_byte(DREG(EA),tmp_reg,false);break;
case 1:dyn_read_word(DREG(EA),tmp_reg,false);break;
case 2:dyn_read_word(DREG(EA),tmp_reg,true);break;
}
switch (op) {
case STR_OUTSB:
gen_call_function((void*)&IO_WriteB,"%Dw%Dl",DREG(EDX),tmp_reg);break;
case STR_OUTSW:
gen_call_function((void*)&IO_WriteW,"%Dw%Dw",DREG(EDX),tmp_reg);break;
case STR_OUTSD:
gen_call_function((void*)&IO_WriteD,"%Dw%Dd",DREG(EDX),tmp_reg);break;
default:
break;
case STR_OUTSB:
gen_call_function((void*)&IO_WriteB,"%Dw%Dl",DREG(EDX),tmp_reg);break;
case STR_OUTSW:
gen_call_function((void*)&IO_WriteW,"%Dw%Dw",DREG(EDX),tmp_reg);break;
case STR_OUTSD:
gen_call_function((void*)&IO_WriteD,"%Dw%Dd",DREG(EDX),tmp_reg);break;
default:
break;
}
}
if (usedi) {