mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-20 21:41:29 +08:00
code cleanup: clarify comparison against null (doesn't fix GCC warning
about type-punning though). remove two unused functions in fpu DH dynamic core. add default clause to switch statements.
This commit is contained in:
@@ -136,7 +136,7 @@ public:
|
|||||||
addr&=4095;
|
addr&=4095;
|
||||||
if (host_readw(hostmem+addr)==(Bit16u)val) return;
|
if (host_readw(hostmem+addr)==(Bit16u)val) return;
|
||||||
host_writew(hostmem+addr,val);
|
host_writew(hostmem+addr,val);
|
||||||
if (!*(Bit16u*)&write_map[addr]) {
|
if ((*(Bit16u*)&write_map[addr]) == 0) {
|
||||||
if (active_blocks) return;
|
if (active_blocks) return;
|
||||||
active_count--;
|
active_count--;
|
||||||
if (!active_count) Release();
|
if (!active_count) Release();
|
||||||
@@ -156,7 +156,7 @@ public:
|
|||||||
addr&=4095;
|
addr&=4095;
|
||||||
if (host_readd(hostmem+addr)==(Bit32u)val) return;
|
if (host_readd(hostmem+addr)==(Bit32u)val) return;
|
||||||
host_writed(hostmem+addr,val);
|
host_writed(hostmem+addr,val);
|
||||||
if (!*(Bit32u*)&write_map[addr]) {
|
if ((*(Bit32u*)&write_map[addr]) == 0) {
|
||||||
if (active_blocks) return;
|
if (active_blocks) return;
|
||||||
active_count--;
|
active_count--;
|
||||||
if (!active_count) Release();
|
if (!active_count) Release();
|
||||||
@@ -201,7 +201,7 @@ public:
|
|||||||
}
|
}
|
||||||
addr&=4095;
|
addr&=4095;
|
||||||
if (host_readw(hostmem+addr)==(Bit16u)val) return false;
|
if (host_readw(hostmem+addr)==(Bit16u)val) return false;
|
||||||
if (!*(Bit16u*)&write_map[addr]) {
|
if ((*(Bit16u*)&write_map[addr]) == 0) {
|
||||||
if (!active_blocks) {
|
if (!active_blocks) {
|
||||||
active_count--;
|
active_count--;
|
||||||
if (!active_count) Release();
|
if (!active_count) Release();
|
||||||
@@ -227,7 +227,7 @@ public:
|
|||||||
}
|
}
|
||||||
addr&=4095;
|
addr&=4095;
|
||||||
if (host_readd(hostmem+addr)==(Bit32u)val) return false;
|
if (host_readd(hostmem+addr)==(Bit32u)val) return false;
|
||||||
if (!*(Bit32u*)&write_map[addr]) {
|
if ((*(Bit32u*)&write_map[addr]) == 0) {
|
||||||
if (!active_blocks) {
|
if (!active_blocks) {
|
||||||
active_count--;
|
active_count--;
|
||||||
if (!active_count) Release();
|
if (!active_count) Release();
|
||||||
|
@@ -955,9 +955,9 @@ static void dyn_fill_ea(bool addseg=true, DynReg * reg_ea=DREG(EA)) {
|
|||||||
if (!decode.big_addr) {
|
if (!decode.big_addr) {
|
||||||
Bits imm;
|
Bits imm;
|
||||||
switch (decode.modrm.mod) {
|
switch (decode.modrm.mod) {
|
||||||
case 0:imm=0;break;
|
|
||||||
case 1:imm=(Bit8s)decode_fetchb();break;
|
case 1:imm=(Bit8s)decode_fetchb();break;
|
||||||
case 2:imm=(Bit16s)decode_fetchw();break;
|
case 2:imm=(Bit16s)decode_fetchw();break;
|
||||||
|
default:imm=0;break;
|
||||||
}
|
}
|
||||||
DynReg * extend_src=reg_ea;
|
DynReg * extend_src=reg_ea;
|
||||||
switch (decode.modrm.rm) {
|
switch (decode.modrm.rm) {
|
||||||
@@ -1763,15 +1763,6 @@ static void dyn_closeblock(void) {
|
|||||||
cache_closeblock();
|
cache_closeblock();
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
static void dyn_exit_link(Bits eip_change) {
|
||||||
gen_protectflags();
|
gen_protectflags();
|
||||||
gen_dop_word_imm(DOP_ADD,decode.big_op,DREG(EIP),(decode.code-decode.code_start)+eip_change);
|
gen_dop_word_imm(DOP_ADD,decode.big_op,DREG(EIP),(decode.code-decode.code_start)+eip_change);
|
||||||
@@ -1834,6 +1825,8 @@ static void dyn_loop(LoopTypes type) {
|
|||||||
gen_needflags();
|
gen_needflags();
|
||||||
branch1=gen_create_branch(BR_Z);
|
branch1=gen_create_branch(BR_Z);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
gen_protectflags();
|
gen_protectflags();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -1849,6 +1842,8 @@ static void dyn_loop(LoopTypes type) {
|
|||||||
gen_releasereg(DREG(ECX));
|
gen_releasereg(DREG(ECX));
|
||||||
branch2=gen_create_branch(BR_NZ);
|
branch2=gen_create_branch(BR_NZ);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
gen_lea(DREG(EIP),DREG(EIP),0,0,eip_base+eip_add);
|
gen_lea(DREG(EIP),DREG(EIP),0,0,eip_base+eip_add);
|
||||||
gen_releasereg(DREG(EIP));
|
gen_releasereg(DREG(EIP));
|
||||||
@@ -1940,17 +1935,6 @@ static void dyn_iret(void) {
|
|||||||
dyn_closeblock();
|
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();
|
|
||||||
gen_call_function((void*)&CPU_Interrupt,"%Id%Id%Drd",num,CPU_INT_SOFTWARE,DREG(TMPW));
|
|
||||||
gen_return_fast(BR_Normal);
|
|
||||||
dyn_closeblock();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dyn_add_iocheck(Bitu access_size) {
|
static void dyn_add_iocheck(Bitu access_size) {
|
||||||
gen_call_function((void *)&CPU_IO_Exception,"%Dw%Id",DREG(EDX),access_size);
|
gen_call_function((void *)&CPU_IO_Exception,"%Dw%Id",DREG(EDX),access_size);
|
||||||
dyn_check_bool_exception_al();
|
dyn_check_bool_exception_al();
|
||||||
@@ -1983,7 +1967,6 @@ static CacheBlock * CreateCacheBlock(CodePageHandler * codepage,PhysPt start,Bit
|
|||||||
/* Init a load of variables */
|
/* Init a load of variables */
|
||||||
decode.code_start=start;
|
decode.code_start=start;
|
||||||
decode.code=start;
|
decode.code=start;
|
||||||
Bitu cycles=0;
|
|
||||||
decode.page.code=codepage;
|
decode.page.code=codepage;
|
||||||
decode.page.index=start&4095;
|
decode.page.index=start&4095;
|
||||||
decode.page.wmap=codepage->write_map;
|
decode.page.wmap=codepage->write_map;
|
||||||
@@ -2360,8 +2343,6 @@ restart_prefix:
|
|||||||
//RET far Iw / Ret
|
//RET far Iw / Ret
|
||||||
case 0xca:dyn_ret_far(decode_fetchw());goto finish_block;
|
case 0xca:dyn_ret_far(decode_fetchw());goto finish_block;
|
||||||
case 0xcb:dyn_ret_far(0);goto finish_block;
|
case 0xcb:dyn_ret_far(0);goto finish_block;
|
||||||
/* Interrupt */
|
|
||||||
// case 0xcd:dyn_interrupt(decode_fetchb());goto finish_block;
|
|
||||||
/* IRET */
|
/* IRET */
|
||||||
case 0xcf:dyn_iret();goto finish_block;
|
case 0xcf:dyn_iret();goto finish_block;
|
||||||
|
|
||||||
|
@@ -98,7 +98,6 @@ static void dyn_fpu_esc0(){
|
|||||||
if (decode.modrm.val >= 0xc0) {
|
if (decode.modrm.val >= 0xc0) {
|
||||||
dyn_fpu_top();
|
dyn_fpu_top();
|
||||||
Bitu group=(decode.modrm.val >> 3) & 7;
|
Bitu group=(decode.modrm.val >> 3) & 7;
|
||||||
Bitu sub=(decode.modrm.val & 7);
|
|
||||||
switch (group){
|
switch (group){
|
||||||
case 0x00: //FADD ST,STi /
|
case 0x00: //FADD ST,STi /
|
||||||
gen_call_function((void*)&FPU_FADD,"%Ddr%Ddr",DREG(TMPB),DREG(EA));
|
gen_call_function((void*)&FPU_FADD,"%Ddr%Ddr",DREG(TMPB),DREG(EA));
|
||||||
@@ -424,7 +423,6 @@ static void dyn_fpu_esc3(){
|
|||||||
static void dyn_fpu_esc4(){
|
static void dyn_fpu_esc4(){
|
||||||
dyn_get_modrm();
|
dyn_get_modrm();
|
||||||
Bitu group=(decode.modrm.val >> 3) & 7;
|
Bitu group=(decode.modrm.val >> 3) & 7;
|
||||||
Bitu sub=(decode.modrm.val & 7);
|
|
||||||
if (decode.modrm.val >= 0xc0) {
|
if (decode.modrm.val >= 0xc0) {
|
||||||
dyn_fpu_top();
|
dyn_fpu_top();
|
||||||
switch(group){
|
switch(group){
|
||||||
|
@@ -314,8 +314,6 @@ static void dh_fpu_esc3(){
|
|||||||
|
|
||||||
static void dh_fpu_esc4(){
|
static void dh_fpu_esc4(){
|
||||||
dyn_get_modrm();
|
dyn_get_modrm();
|
||||||
Bitu group=(decode.modrm.val >> 3) & 7;
|
|
||||||
Bitu sub=(decode.modrm.val & 7);
|
|
||||||
if (decode.modrm.val >= 0xc0) {
|
if (decode.modrm.val >= 0xc0) {
|
||||||
cache_addb(0xdc);
|
cache_addb(0xdc);
|
||||||
cache_addb(decode.modrm.val);
|
cache_addb(decode.modrm.val);
|
||||||
@@ -387,8 +385,6 @@ static void dh_fpu_esc5(){
|
|||||||
|
|
||||||
static void dh_fpu_esc6(){
|
static void dh_fpu_esc6(){
|
||||||
dyn_get_modrm();
|
dyn_get_modrm();
|
||||||
Bitu group=(decode.modrm.val >> 3) & 7;
|
|
||||||
Bitu sub=(decode.modrm.val & 7);
|
|
||||||
if (decode.modrm.val >= 0xc0) {
|
if (decode.modrm.val >= 0xc0) {
|
||||||
cache_addb(0xde);
|
cache_addb(0xde);
|
||||||
cache_addb(decode.modrm.val);
|
cache_addb(decode.modrm.val);
|
||||||
|
@@ -979,7 +979,7 @@ static Bit8u * gen_create_branch_long(BranchTypes type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void gen_fill_branch_long(Bit8u * data,Bit8u * from=cache.pos) {
|
static void gen_fill_branch_long(Bit8u * data,Bit8u * from=cache.pos) {
|
||||||
*(Bit32u*)data=(from-data-4);
|
*((Bit32u*)data) = (from-data-4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bit8u * gen_create_jump(Bit8u * to=0) {
|
static Bit8u * gen_create_jump(Bit8u * to=0) {
|
||||||
|
@@ -79,7 +79,7 @@ static void dyn_string(STRING_OP op) {
|
|||||||
DynState rep_state;
|
DynState rep_state;
|
||||||
dyn_savestate(&rep_state);
|
dyn_savestate(&rep_state);
|
||||||
Bit8u * rep_start=cache.pos;
|
Bit8u * rep_start=cache.pos;
|
||||||
Bit8u * rep_ecx_jmp;
|
Bit8u * rep_ecx_jmp=NULL;
|
||||||
/* Check if ECX!=zero */
|
/* Check if ECX!=zero */
|
||||||
if (decode.rep) {
|
if (decode.rep) {
|
||||||
gen_dop_word(DOP_OR,decode.big_addr,DREG(ECX),DREG(ECX));
|
gen_dop_word(DOP_OR,decode.big_addr,DREG(ECX),DREG(ECX));
|
||||||
@@ -104,6 +104,8 @@ static void dyn_string(STRING_OP op) {
|
|||||||
gen_call_function((void*)&IO_WriteW,"%Id%Dw",DREG(EDX),tmp_reg);break;
|
gen_call_function((void*)&IO_WriteW,"%Id%Dw",DREG(EDX),tmp_reg);break;
|
||||||
case STR_OUTSD:
|
case STR_OUTSD:
|
||||||
gen_call_function((void*)&IO_WriteD,"%Id%Dd",DREG(EDX),tmp_reg);break;
|
gen_call_function((void*)&IO_WriteD,"%Id%Dd",DREG(EDX),tmp_reg);break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (usedi) {
|
if (usedi) {
|
||||||
|
Reference in New Issue
Block a user