From cd5f7c966643928071a30e86e97acbe27322611c Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Wed, 31 Mar 2004 17:27:31 +0000 Subject: [PATCH] Changed some cpu functions to get opcode length as parameter Added cli and sti functions Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1747 --- src/cpu/core_normal/prefix_66.h | 7 +++--- src/cpu/core_normal/prefix_none.h | 18 +++++---------- src/cpu/cpu.cpp | 38 +++++++++++++++++++++++-------- 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/cpu/core_normal/prefix_66.h b/src/cpu/core_normal/prefix_66.h index 3e10ce47..94d99c07 100644 --- a/src/cpu/core_normal/prefix_66.h +++ b/src/cpu/core_normal/prefix_66.h @@ -380,7 +380,7 @@ { Bit32u newip=Fetchd();Bit16u newcs=Fetchw(); LEAVECORE; - CPU_CALL(true,newcs,newip); + CPU_CALL(true,newcs,newip,core.ip_lookup-core.op_start); goto decode_start; } CASE_D(0x9c) /* PUSHFD */ @@ -530,7 +530,7 @@ CASE_D(0xcf) /* IRET */ { LEAVECORE; - CPU_IRET(true); + CPU_IRET(true,core.ip_lookup-core.op_start); #if CPU_TRAP_CHECK if (GETFLAG(TF)) { cpudecoder=CPU_Core_Normal_Trap_Run; @@ -540,7 +540,6 @@ #if CPU_PIC_CHECK if (GETFLAG(IF) && PIC_IRQCheck) return CBRET_NONE; #endif -//TODO TF check goto decode_start; } CASE_D(0xd1) /* GRP2 Ed,1 */ @@ -641,7 +640,7 @@ Bit32u newip=LoadMd(eaa); Bit16u newcs=LoadMw(eaa+4); LEAVECORE; - CPU_CALL(true,newcs,newip); + CPU_CALL(true,newcs,newip,core.ip_lookup-core.op_start); goto decode_start; } break; diff --git a/src/cpu/core_normal/prefix_none.h b/src/cpu/core_normal/prefix_none.h index f5354374..9e8a1b58 100644 --- a/src/cpu/core_normal/prefix_none.h +++ b/src/cpu/core_normal/prefix_none.h @@ -237,7 +237,7 @@ break; CASE_W(0x63) /* ARPL Ew,Rw */ { - if (((cpu.pmode) && (reg_flags & FLAG_VM)) || (!cpu.pmode)) goto illegal_opcode; + if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode; FillFlags(); GetRMrw; if (rm >= 0xc0 ) { @@ -792,7 +792,7 @@ CASE_W(0xcf) /* IRET */ { LEAVECORE; - CPU_IRET(false); + CPU_IRET(false,core.ip_lookup-core.op_start); #if CPU_PIC_CHECK if (GETFLAG(IF) && PIC_IRQCheck) return CBRET_NONE; #endif @@ -1059,20 +1059,14 @@ SETFLAGBIT(CF,true); break; CASE_B(0xfa) /* CLI */ - if (cpu.pmode && (GETFLAG_IOPL #include "dosbox.h" @@ -91,6 +91,28 @@ void CPU_SetFlags(Bitu word,Bitu mask) { cpu.direction=1-((reg_flags & FLAG_DF) >> 9); } +bool CPU_CLI(Bitu opLen) { + if (cpu.pmode && ((!GETFLAG(VM) && (GETFLAG_IOPL0) + if (call.saved.gate.paramcount&31) for (Bits i=(call.saved.gate.paramcount&31)-1;i>=0;i--) CPU_Push32(mem_readd(o_stack+i*4)); CPU_Push32(SegValue(cs)); @@ -720,7 +742,7 @@ call_code: } else { CPU_Push16(o_ss); //save old stack CPU_Push16(o_esp); - if (call.saved.gate.paramcount&31>0) + if (call.saved.gate.paramcount&31) for (Bits i=(call.saved.gate.paramcount&31)-1;i>=0;i--) CPU_Push16(mem_readw(o_stack+i*2)); CPU_Push16(SegValue(cs)); @@ -982,7 +1004,6 @@ void CPU_LAR(Bitu selector,Bitu & ar) { return; } Descriptor desc;Bitu rpl=selector & 3; - ar=0; if (!cpu.gdt.GetDescriptor(selector,desc)){ SETFLAGBIT(ZF,false); return; @@ -991,7 +1012,7 @@ void CPU_LAR(Bitu selector,Bitu & ar) { case DESC_CODE_N_C_A: case DESC_CODE_N_C_NA: case DESC_CODE_R_C_A: case DESC_CODE_R_C_NA: break; - + case DESC_286_INT_GATE: case DESC_286_TRAP_GATE: { case DESC_386_INT_GATE: case DESC_386_TRAP_GATE: SETFLAGBIT(ZF,false); @@ -1034,7 +1055,6 @@ void CPU_LSL(Bitu selector,Bitu & limit) { return; } Descriptor desc;Bitu rpl=selector & 3; - limit=0; if (!cpu.gdt.GetDescriptor(selector,desc)){ SETFLAGBIT(ZF,false); return; @@ -1300,7 +1320,7 @@ void CPU_Init(Section* sec) { else { LOG_MSG("CPU:Unknown core type %s, switcing back to normal.",core); } - CPU_JMP(false,0,0); //Setup the first cpu core + CPU_JMP(false,0,0,0); //Setup the first cpu core if (!CPU_CycleMax) CPU_CycleMax = 2500; if(!CPU_CycleUp) CPU_CycleUp = 500;