From 43de744e01d213180a75def4b0d07fc808e75b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Strohh=C3=A4cker?= Date: Fri, 1 Jun 2007 16:40:40 +0000 Subject: [PATCH] move some FillFlags calls into their respective cpu function; change some cpu functions to directly return values Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2864 --- include/cpu.h | 14 +++++---- src/cpu/core_full/load.h | 5 --- src/cpu/core_full/loadwrite.h | 1 - src/cpu/core_full/op.h | 46 +++++++--------------------- src/cpu/core_normal/prefix_0f.h | 27 ++++++---------- src/cpu/core_normal/prefix_66.h | 4 --- src/cpu/core_normal/prefix_66_0f.h | 27 ++++++---------- src/cpu/core_normal/prefix_none.h | 10 ++---- src/cpu/core_normal/support.h | 1 - src/cpu/cpu.cpp | 49 +++++++++++++++++++++--------- src/cpu/flags.cpp | 21 +++++++------ src/cpu/lazyflags.h | 13 ++++---- src/debug/debug.cpp | 7 ++--- src/hardware/iohandler.cpp | 8 +---- 14 files changed, 99 insertions(+), 134 deletions(-) diff --git a/include/cpu.h b/include/cpu.h index 16e0d4ca..430e1821 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -68,10 +68,12 @@ bool CPU_LTR(Bitu selector); void CPU_LIDT(Bitu limit,Bitu base); void CPU_LGDT(Bitu limit,Bitu base); -void CPU_STR(Bitu & selector); -void CPU_SLDT(Bitu & selector); -void CPU_SIDT(Bitu & limit,Bitu & base); -void CPU_SGDT(Bitu & limit,Bitu & base); +Bitu CPU_STR(void); +Bitu CPU_SLDT(void); +Bitu CPU_SIDT_base(void); +Bitu CPU_SIDT_limit(void); +Bitu CPU_SGDT_base(void); +Bitu CPU_SGDT_limit(void); void CPU_ARPL(Bitu & dest_sel,Bitu src_sel); void CPU_LAR(Bitu selector,Bitu & ar); @@ -88,8 +90,8 @@ bool CPU_READ_DRX(Bitu dr,Bit32u & retvalue); bool CPU_WRITE_TRX(Bitu dr,Bitu value); bool CPU_READ_TRX(Bitu dr,Bit32u & retvalue); -void CPU_SMSW(Bitu & word); -Bitu CPU_LMSW(Bitu word); +Bitu CPU_SMSW(void); +bool CPU_LMSW(Bitu word); void CPU_VERR(Bitu selector); void CPU_VERW(Bitu selector); diff --git a/src/cpu/core_full/load.h b/src/cpu/core_full/load.h index 1f47b886..ec63d572 100644 --- a/src/cpu/core_full/load.h +++ b/src/cpu/core_full/load.h @@ -284,14 +284,12 @@ l_M_Ed: inst_op1_d=4; break; case D_IRETw: - FillFlags(); CPU_IRET(false,GetIP()); if (GETFLAG(IF) && PIC_IRQCheck) { return CBRET_NONE; } continue; case D_IRETd: - FillFlags(); CPU_IRET(true,GetIP()); if (GETFLAG(IF) && PIC_IRQCheck) return CBRET_NONE; @@ -407,12 +405,10 @@ l_M_Ed: cpu.direction=-1; goto nextopcode; case D_PUSHF: - FillFlags(); if (CPU_PUSHF(inst.code.extra)) RunException(); goto nextopcode; case D_POPF: if (CPU_POPF(inst.code.extra)) RunException(); - lflags.type=t_UNKNOWN; if (GETFLAG(IF) && PIC_IRQCheck) { SaveIP(); return CBRET_NONE; @@ -481,7 +477,6 @@ l_M_Ed: cpu.cr0&=(~CR0_TASKSWITCH); goto nextopcode; case D_ICEBP: - FillFlags(); CPU_SW_Interrupt_NoIOPLCheck(1,GetIP()); continue; default: diff --git a/src/cpu/core_full/loadwrite.h b/src/cpu/core_full/loadwrite.h index 37670d2a..aca53c49 100644 --- a/src/cpu/core_full/loadwrite.h +++ b/src/cpu/core_full/loadwrite.h @@ -3,7 +3,6 @@ #define GetIP() (inst.cseip-SegBase(cs)) #define RunException() { \ - FillFlags(); \ CPU_Exception(cpu.exception.which,cpu.exception.error); \ continue; \ } diff --git a/src/cpu/core_full/op.h b/src/cpu/core_full/op.h index d7a454f2..ed407a3a 100644 --- a/src/cpu/core_full/op.h +++ b/src/cpu/core_full/op.h @@ -338,8 +338,8 @@ switch (inst.code.op) { CPU_JMP(true,inst_op2_d,inst_op1_d,GetIP()); continue; case O_INT: - FillFlags(); #if C_DEBUG + FillFlags(); if (((inst.entry & 0xFF)==0xcc) && DEBUG_Breakpoint()) return debugCallback; else if (DEBUG_IntBreakpoint(inst_op1_b)) @@ -379,18 +379,10 @@ switch (inst.code.op) { if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegalopcode; switch (inst.rm_index) { case 0x00: /* SLDT */ - { - Bitu selector; - CPU_SLDT(selector); - inst_op1_d=(Bit32u)selector; - } + inst_op1_d=(Bit32u)CPU_SLDT(); break; case 0x01: /* STR */ - { - Bitu selector; - CPU_STR(selector); - inst_op1_d=(Bit32u)selector; - } + inst_op1_d=(Bit32u)CPU_STR(); break; case 0x02: /* LLDT */ if (cpu.cpl) EXCEPTION(EXCEPTION_GP); @@ -401,11 +393,9 @@ switch (inst.code.op) { if (CPU_LTR(inst_op1_d)) RunException(); goto nextopcode; /* Else value will saved */ case 0x04: /* VERR */ - FillFlags(); CPU_VERR(inst_op1_d); goto nextopcode; /* Else value will saved */ case 0x05: /* VERW */ - FillFlags(); CPU_VERW(inst_op1_d); goto nextopcode; /* Else value will saved */ default: @@ -417,21 +407,13 @@ switch (inst.code.op) { case O_GRP7d: switch (inst.rm_index) { case 0: /* SGDT */ - { - Bitu limit,base; - CPU_SGDT(limit,base); - SaveMw(inst.rm_eaa,limit); - SaveMd(inst.rm_eaa+2,base); - goto nextopcode; - } + SaveMw(inst.rm_eaa,CPU_SGDT_limit()); + SaveMd(inst.rm_eaa+2,CPU_SGDT_base()); + goto nextopcode; case 1: /* SIDT */ - { - Bitu limit,base; - CPU_SIDT(limit,base); - SaveMw(inst.rm_eaa,limit); - SaveMd(inst.rm_eaa+2,base); - goto nextopcode; - } + SaveMw(inst.rm_eaa,CPU_SIDT_limit()); + SaveMd(inst.rm_eaa+2,CPU_SIDT_base()); + goto nextopcode; case 2: /* LGDT */ if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP); CPU_LGDT(LoadMw(inst.rm_eaa),LoadMd(inst.rm_eaa+2)&((inst.code.op == O_GRP7w) ? 0xFFFFFF : 0xFFFFFFFF)); @@ -441,11 +423,8 @@ switch (inst.code.op) { CPU_LIDT(LoadMw(inst.rm_eaa),LoadMd(inst.rm_eaa+2)&((inst.code.op == O_GRP7w) ? 0xFFFFFF : 0xFFFFFFFF)); goto nextopcode; case 4: /* SMSW */ - { - Bitu word;CPU_SMSW(word); - inst_op1_d=word; - break; - } + inst_op1_d=CPU_SMSW(); + break; case 6: /* LMSW */ FillFlags(); if (CPU_LMSW(inst_op1_w)) RunException(); @@ -481,7 +460,6 @@ switch (inst.code.op) { case O_LAR: { if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegalopcode; - FillFlags(); Bitu ar=inst_op2_d; CPU_LAR(inst_op1_w,ar); inst_op1_d=(Bit32u)ar; @@ -490,7 +468,6 @@ switch (inst.code.op) { case O_LSL: { if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegalopcode; - FillFlags(); Bitu limit=inst_op2_d; CPU_LSL(inst_op1_w,limit); inst_op1_d=(Bit32u)limit; @@ -499,7 +476,6 @@ switch (inst.code.op) { case O_ARPL: { if ((reg_flags & FLAG_VM) || !cpu.pmode) goto illegalopcode; - FillFlags(); Bitu new_sel=inst_op1_d; CPU_ARPL(new_sel,inst_op2_d); inst_op1_d=(Bit32u)new_sel; diff --git a/src/cpu/core_normal/prefix_0f.h b/src/cpu/core_normal/prefix_0f.h index 59244371..086771b7 100644 --- a/src/cpu/core_normal/prefix_0f.h +++ b/src/cpu/core_normal/prefix_0f.h @@ -25,15 +25,14 @@ case 0x01: /* STR */ { Bitu saveval; - if (!which) CPU_SLDT(saveval); - else CPU_STR(saveval); + if (!which) saveval=CPU_SLDT(); + else saveval=CPU_STR(); if (rm >= 0xc0) {GetEArw;*earw=saveval;} else {GetEAa;SaveMw(eaa,saveval);} } break; case 0x02:case 0x03:case 0x04:case 0x05: { - FillFlags(); Bitu loadval; if (rm >= 0xc0 ) {GetEArw;loadval=*earw;} else {GetEAa;loadval=LoadMw(eaa);} @@ -64,17 +63,15 @@ { GetRM;Bitu which=(rm>>3)&7; if (rm < 0xc0) { //First ones all use EA - GetEAa;Bitu limit,base; + GetEAa;Bitu limit; switch (which) { case 0x00: /* SGDT */ - CPU_SGDT(limit,base); - SaveMw(eaa,limit); - SaveMd(eaa+2,base); + SaveMw(eaa,CPU_SGDT_limit()); + SaveMd(eaa+2,CPU_SGDT_base()); break; case 0x01: /* SIDT */ - CPU_SIDT(limit,base); - SaveMw(eaa,limit); - SaveMd(eaa+2,base); + SaveMw(eaa,CPU_SIDT_limit()); + SaveMd(eaa+2,CPU_SIDT_base()); break; case 0x02: /* LGDT */ if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP); @@ -85,8 +82,7 @@ CPU_LIDT(LoadMw(eaa),LoadMd(eaa+2) & 0xFFFFFF); break; case 0x04: /* SMSW */ - CPU_SMSW(limit); - SaveMw(eaa,limit); + SaveMw(eaa,CPU_SMSW()); break; case 0x06: /* LMSW */ limit=LoadMw(eaa); @@ -98,7 +94,7 @@ break; } } else { - GetEArw;Bitu limit; + GetEArw; switch (which) { case 0x02: /* LGDT */ if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP); @@ -107,8 +103,7 @@ if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP); goto illegal_opcode; case 0x04: /* SMSW */ - CPU_SMSW(limit); - *earw=limit; + *earw=CPU_SMSW(); break; case 0x06: /* LMSW */ if (CPU_LMSW(*earw)) RUNEXCEPTION(); @@ -122,7 +117,6 @@ CASE_0F_W(0x02) /* LAR Gw,Ew */ { if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode; - FillFlags(); GetRMrw;Bitu ar=*rmrw; if (rm >= 0xc0) { GetEArw;CPU_LAR(*earw,ar); @@ -135,7 +129,6 @@ CASE_0F_W(0x03) /* LSL Gw,Ew */ { if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode; - FillFlags(); GetRMrw;Bitu limit=*rmrw; if (rm >= 0xc0) { GetEArw;CPU_LSL(*earw,limit); diff --git a/src/cpu/core_normal/prefix_66.h b/src/cpu/core_normal/prefix_66.h index a76e43fa..f2aef294 100644 --- a/src/cpu/core_normal/prefix_66.h +++ b/src/cpu/core_normal/prefix_66.h @@ -170,7 +170,6 @@ CASE_D(0x63) /* ARPL Ed,Rd */ { if (((cpu.pmode) && (reg_flags & FLAG_VM)) || (!cpu.pmode)) goto illegal_opcode; - FillFlags(); GetRMrw; if (rm >= 0xc0 ) { GetEArd;Bitu new_sel=(Bit16u)*eard; @@ -398,12 +397,10 @@ continue; } CASE_D(0x9c) /* PUSHFD */ - FillFlags(); if (CPU_PUSHF(true)) RUNEXCEPTION(); break; CASE_D(0x9d) /* POPFD */ if (CPU_POPF(true)) RUNEXCEPTION(); - lflags.type=t_UNKNOWN; #if CPU_TRAP_CHECK if (GETFLAG(TF)) { cpudecoder=CPU_Core_Normal_Trap_Run; @@ -511,7 +508,6 @@ } CASE_D(0xcf) /* IRET */ { - FillFlags(); CPU_IRET(true,GETIP); #if CPU_TRAP_CHECK if (GETFLAG(TF)) { diff --git a/src/cpu/core_normal/prefix_66_0f.h b/src/cpu/core_normal/prefix_66_0f.h index 3022ba58..8c00c268 100644 --- a/src/cpu/core_normal/prefix_66_0f.h +++ b/src/cpu/core_normal/prefix_66_0f.h @@ -25,8 +25,8 @@ case 0x01: /* STR */ { Bitu saveval; - if (!which) CPU_SLDT(saveval); - else CPU_STR(saveval); + if (!which) saveval=CPU_SLDT(); + else saveval=CPU_STR(); if (rm >= 0xc0) {GetEArw;*earw=(Bit16u)saveval;} else {GetEAa;SaveMw(eaa,saveval);} } @@ -34,7 +34,6 @@ case 0x02:case 0x03:case 0x04:case 0x05: { /* Just use 16-bit loads since were only using selectors */ - FillFlags(); Bitu loadval; if (rm >= 0xc0 ) {GetEArw;loadval=*earw;} else {GetEAa;loadval=LoadMw(eaa);} @@ -66,17 +65,15 @@ { GetRM;Bitu which=(rm>>3)&7; if (rm < 0xc0) { //First ones all use EA - GetEAa;Bitu limit,base; + GetEAa;Bitu limit; switch (which) { case 0x00: /* SGDT */ - CPU_SGDT(limit,base); - SaveMw(eaa,(Bit16u)limit); - SaveMd(eaa+2,(Bit32u)base); + SaveMw(eaa,(Bit16u)CPU_SGDT_limit()); + SaveMd(eaa+2,(Bit32u)CPU_SGDT_base()); break; case 0x01: /* SIDT */ - CPU_SIDT(limit,base); - SaveMw(eaa,(Bit16u)limit); - SaveMd(eaa+2,(Bit32u)base); + SaveMw(eaa,(Bit16u)CPU_SIDT_limit()); + SaveMd(eaa+2,(Bit32u)CPU_SIDT_base()); break; case 0x02: /* LGDT */ if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP); @@ -87,8 +84,7 @@ CPU_LIDT(LoadMw(eaa),LoadMd(eaa+2)); break; case 0x04: /* SMSW */ - CPU_SMSW(limit); - SaveMw(eaa,(Bit16u)limit); + SaveMw(eaa,(Bit16u)CPU_SMSW()); break; case 0x06: /* LMSW */ limit=LoadMw(eaa); @@ -100,7 +96,7 @@ break; } } else { - GetEArd;Bitu limit; + GetEArd; switch (which) { case 0x02: /* LGDT */ if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP); @@ -109,8 +105,7 @@ if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP); goto illegal_opcode; case 0x04: /* SMSW */ - CPU_SMSW(limit); - *eard=(Bit32u)limit; + *eard=(Bit32u)CPU_SMSW(); break; case 0x06: /* LMSW */ if (CPU_LMSW(*eard)) RUNEXCEPTION(); @@ -127,7 +122,6 @@ CASE_0F_D(0x02) /* LAR Gd,Ed */ { if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode; - FillFlags(); GetRMrd;Bitu ar=*rmrd; if (rm >= 0xc0) { GetEArw;CPU_LAR(*earw,ar); @@ -140,7 +134,6 @@ CASE_0F_D(0x03) /* LSL Gd,Ew */ { if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode; - FillFlags(); GetRMrd;Bitu limit=*rmrd; /* Just load 16-bit values for selectors */ if (rm >= 0xc0) { diff --git a/src/cpu/core_normal/prefix_none.h b/src/cpu/core_normal/prefix_none.h index 36739a3f..9622294f 100644 --- a/src/cpu/core_normal/prefix_none.h +++ b/src/cpu/core_normal/prefix_none.h @@ -239,7 +239,6 @@ CASE_W(0x63) /* ARPL Ew,Rw */ { if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode; - FillFlags(); GetRMrw; if (rm >= 0xc0 ) { GetEArw;Bitu new_sel=*earw; @@ -574,12 +573,10 @@ CASE_B(0x9b) /* WAIT */ break; /* No waiting here */ CASE_W(0x9c) /* PUSHF */ - FillFlags(); if (CPU_PUSHF(false)) RUNEXCEPTION(); break; CASE_W(0x9d) /* POPF */ if (CPU_POPF(false)) RUNEXCEPTION(); - lflags.type=t_UNKNOWN; #if CPU_TRAP_CHECK if (GETFLAG(TF)) { cpudecoder=CPU_Core_Normal_Trap_Run; @@ -740,8 +737,8 @@ CPU_RET(false,0,GETIP); continue; CASE_B(0xcc) /* INT3 */ - FillFlags(); #if C_DEBUG + FillFlags(); if (DEBUG_Breakpoint()) return debugCallback; #endif @@ -753,8 +750,8 @@ CASE_B(0xcd) /* INT Ib */ { Bit8u num=Fetchb(); - FillFlags(); #if C_DEBUG + FillFlags(); if (DEBUG_IntBreakpoint(num)) { return debugCallback; } @@ -767,7 +764,6 @@ } CASE_B(0xce) /* INTO */ if (get_OF()) { - FillFlags(); CPU_SW_Interrupt(4,GETIP); #if CPU_TRAP_CHECK cpu.trap_skip=true; @@ -777,7 +773,6 @@ break; CASE_W(0xcf) /* IRET */ { - FillFlags(); CPU_IRET(false,GETIP); #if CPU_TRAP_CHECK if (GETFLAG(TF)) { @@ -953,7 +948,6 @@ LOG(LOG_CPU,LOG_NORMAL)("CPU:LOCK"); /* FIXME: see case D_LOCK in core_full/load.h */ break; CASE_B(0xf1) /* ICEBP */ - FillFlags(); CPU_SW_Interrupt_NoIOPLCheck(1,GETIP); #if CPU_TRAP_CHECK cpu.trap_skip=true; diff --git a/src/cpu/core_normal/support.h b/src/cpu/core_normal/support.h index 8a789552..65dbfa3e 100644 --- a/src/cpu/core_normal/support.h +++ b/src/cpu/core_normal/support.h @@ -42,7 +42,6 @@ static INLINE Bit32s Fetchds() { #define RUNEXCEPTION() { \ - FillFlags(); \ CPU_Exception(cpu.exception.which,cpu.exception.error); \ continue; \ } diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp index d7a77c33..ba6e72a7 100644 --- a/src/cpu/cpu.cpp +++ b/src/cpu/cpu.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cpu.cpp,v 1.99 2007-04-14 11:16:29 c2woody Exp $ */ +/* $Id: cpu.cpp,v 1.100 2007-06-01 16:40:40 c2woody Exp $ */ #include #include @@ -27,6 +27,7 @@ #include "mapper.h" #include "setup.h" #include "paging.h" +#include "lazyflags.h" #include "support.h" Bitu DEBUG_EnableDebugger(void); @@ -62,10 +63,12 @@ Bitu CPU_AutoDetermineMode; void CPU_Core_Full_Init(void); void CPU_Core_Normal_Init(void); void CPU_Core_Simple_Init(void); +#if (C_DYNAMIC_X86) void CPU_Core_Dyn_X86_Init(void); void CPU_Core_Dyn_X86_Cache_Init(bool enable_cache); void CPU_Core_Dyn_X86_Cache_Close(void); void CPU_Core_Dyn_X86_SetFPUMode(bool dh_fpu); +#endif /* In debug mode exceptions are tested and dosbox exits when * a unhandled exception state is detected. @@ -178,6 +181,7 @@ bool CPU_POPF(Bitu use32) { if (use32) CPU_SetFlags(CPU_Pop32(),mask); else CPU_SetFlags(CPU_Pop16(),mask & 0xffff); + DestroyConditionFlags(); return false; } @@ -186,6 +190,7 @@ bool CPU_PUSHF(Bitu use32) { /* Not enough privileges to execute PUSHF */ return CPU_PrepareException(EXCEPTION_GP,0); } + FillFlags(); if (use32) CPU_Push32(reg_flags & 0xfcffff); else CPU_Push16(reg_flags); @@ -258,6 +263,7 @@ enum TSwitchType { }; bool CPU_SwitchTask(Bitu new_tss_selector,TSwitchType tstype,Bitu old_eip) { + FillFlags(); TaskStateSegment new_tss; if (!new_tss.SetSelector(new_tss_selector)) E_Exit("Illegal TSS for switch, selector=%x, switchtype=%x",new_tss_selector,tstype); @@ -447,6 +453,7 @@ void CPU_Exception(Bitu which,Bitu error ) { Bit8u lastint; void CPU_Interrupt(Bitu num,Bitu type,Bitu oldeip) { lastint=num; + FillFlags(); #if C_DEBUG switch (num) { case 0xcd: @@ -666,6 +673,7 @@ void CPU_IRET(bool use32,Bitu oldeip) { CPU_SetFlags(CPU_Pop16(),FMASK_ALL & 0xffff); } cpu.code.big=false; + DestroyConditionFlags(); return; } else { /* Protected mode IRET */ if (reg_flags & FLAG_VM) { @@ -686,6 +694,7 @@ void CPU_IRET(bool use32,Bitu oldeip) { CPU_SetFlags(CPU_Pop16(),FMASK_NORMAL|FLAG_NT); } cpu.code.big=false; + DestroyConditionFlags(); return; } } @@ -717,6 +726,7 @@ void CPU_IRET(bool use32,Bitu oldeip) { n_gs=CPU_Pop32() & 0xffff; CPU_SetFlags(n_flags,FMASK_ALL | FLAG_VM); + DestroyConditionFlags(); cpu.cpl=3; CPU_SetSegGeneral(ss,n_ss); @@ -779,6 +789,7 @@ void CPU_IRET(bool use32,Bitu oldeip) { Bitu mask=cpu.cpl ? (FMASK_NORMAL | FLAG_NT) : FMASK_ALL; if (GETFLAG_IOPL0)) return CPU_PrepareException(EXCEPTION_GP,0); word&=0xf; if (cpu.cr0 & 1) word|=1; @@ -1624,6 +1640,7 @@ Bitu CPU_LMSW(Bitu word) { } void CPU_ARPL(Bitu & dest_sel,Bitu src_sel) { + FillFlags(); if ((dest_sel & 3) < (src_sel & 3)) { dest_sel=(dest_sel & 0xfffc) + (src_sel & 3); // dest_sel|=0xff3f0000; @@ -1634,6 +1651,7 @@ void CPU_ARPL(Bitu & dest_sel,Bitu src_sel) { } void CPU_LAR(Bitu selector,Bitu & ar) { + FillFlags(); if (selector == 0) { SETFLAGBIT(ZF,false); return; @@ -1685,6 +1703,7 @@ void CPU_LAR(Bitu selector,Bitu & ar) { } void CPU_LSL(Bitu selector,Bitu & limit) { + FillFlags(); if (selector == 0) { SETFLAGBIT(ZF,false); return; @@ -1727,6 +1746,7 @@ void CPU_LSL(Bitu selector,Bitu & limit) { } void CPU_VERR(Bitu selector) { + FillFlags(); if (selector == 0) { SETFLAGBIT(ZF,false); return; @@ -1759,6 +1779,7 @@ void CPU_VERR(Bitu selector) { } void CPU_VERW(Bitu selector) { + FillFlags(); if (selector == 0) { SETFLAGBIT(ZF,false); return; diff --git a/src/cpu/flags.cpp b/src/cpu/flags.cpp index b6830206..f56b876e 100644 --- a/src/cpu/flags.cpp +++ b/src/cpu/flags.cpp @@ -31,7 +31,7 @@ LazyFlags lflags; /* CF Carry Flag -- Set on high-order bit carry or borrow; cleared otherwise. */ -Bitu get_CF(void) { +Bit32u get_CF(void) { switch (lflags.type) { case t_UNKNOWN: @@ -43,7 +43,6 @@ Bitu get_CF(void) { case t_DECd: case t_MUL: return GETFLAG(CF); - break; case t_ADDb: return (lf_resb #include "dosbox.h" @@ -227,7 +227,6 @@ void IO_WriteB(Bitu port,Bitu val) { RealPt icb = CALLBACK_RealPointer(call_priv_io); SegSet16(cs,RealSeg(icb)); reg_eip = RealOff(icb)+0x08; - FillFlags(); CPU_Exception(cpu.exception.which,cpu.exception.error); DOSBOX_RunMachine(); @@ -263,7 +262,6 @@ void IO_WriteW(Bitu port,Bitu val) { RealPt icb = CALLBACK_RealPointer(call_priv_io); SegSet16(cs,RealSeg(icb)); reg_eip = RealOff(icb)+0x0a; - FillFlags(); CPU_Exception(cpu.exception.which,cpu.exception.error); DOSBOX_RunMachine(); @@ -299,7 +297,6 @@ void IO_WriteD(Bitu port,Bitu val) { RealPt icb = CALLBACK_RealPointer(call_priv_io); SegSet16(cs,RealSeg(icb)); reg_eip = RealOff(icb)+0x0c; - FillFlags(); CPU_Exception(cpu.exception.which,cpu.exception.error); DOSBOX_RunMachine(); @@ -330,7 +327,6 @@ Bitu IO_ReadB(Bitu port) { RealPt icb = CALLBACK_RealPointer(call_priv_io); SegSet16(cs,RealSeg(icb)); reg_eip = RealOff(icb)+0x00; - FillFlags(); CPU_Exception(cpu.exception.which,cpu.exception.error); DOSBOX_RunMachine(); @@ -366,7 +362,6 @@ Bitu IO_ReadW(Bitu port) { RealPt icb = CALLBACK_RealPointer(call_priv_io); SegSet16(cs,RealSeg(icb)); reg_eip = RealOff(icb)+0x02; - FillFlags(); CPU_Exception(cpu.exception.which,cpu.exception.error); DOSBOX_RunMachine(); @@ -402,7 +397,6 @@ Bitu IO_ReadD(Bitu port) { RealPt icb = CALLBACK_RealPointer(call_priv_io); SegSet16(cs,RealSeg(icb)); reg_eip = RealOff(icb)+0x04; - FillFlags(); CPU_Exception(cpu.exception.which,cpu.exception.error); DOSBOX_RunMachine();