1
0
Fork 0

Fix the POP Mod/rm issue

Changes for new interrupts
Some privileged instructions.


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1447
This commit is contained in:
Sjoerd van der Berg 2003-11-18 22:23:50 +00:00
parent f854f9a58c
commit 2fbf5e8972
6 changed files with 36 additions and 19 deletions

View file

@ -71,6 +71,7 @@ typedef PhysPt EAPoint;
Bits Full_DeCode(void) {
FullData inst;
restart_core:
if (CPU_Cycles<=0) return CBRET_NONE;
if (!cpu.code.big) {
inst.start_prefix=0x0;;
inst.start_entry=0x0;
@ -81,10 +82,9 @@ restart_core:
EAPoint IPPoint;
LoadIP();
lflags.type=t_UNKNOWN;
while (CPU_Cycles>0) {
while (CPU_Cycles--) {
#if C_DEBUG
cycle_count++;
CPU_Cycles--;
#if C_HEAVY_DEBUG
SaveIP();
if (DEBUG_HeavyIsBreakpoint()) {
@ -104,6 +104,7 @@ restartopcode:
#include "core_full/save.h"
nextopcode:;
}
exit_core:
LEAVECORE;
return CBRET_NONE;
}

View file

@ -1,5 +1,12 @@
switch (inst.code.load) {
/* General loading */
case L_POPwRM:
inst.op1.w = Pop_16();
goto case_L_MODRM;
case L_POPdRM:
inst.op1.d = Pop_32();
goto case_L_MODRM;
case_L_MODRM:
case L_MODRM:
inst.rm=Fetchb();
inst.rm_index=(inst.rm >> 3) & 7;
@ -245,7 +252,7 @@ l_M_Ed:
break;
/* Special cases */
case L_DOUBLE:
inst.entry|=0x100;
inst.entry=inst.start_prefix^0x100;
goto restartopcode;
case L_PRESEG:
inst.prefix|=PREFIX_SEG;
@ -479,7 +486,7 @@ l_M_Ed:
goto nextopcode;
case D_HLT:
LEAVECORE;
CPU_HLT();
CPU_HLT(IPPoint-inst.start);
return CBRET_NONE;
default:
LOG(LOG_CPU,LOG_ERROR)("LOAD:Unhandled code %d opcode %X",inst.code.load,inst.entry);

View file

@ -340,10 +340,12 @@ switch (inst.code.op) {
case O_INT:
LEAVECORE;
#if C_DEBUG
if (((inst.entry & 0xFF)==0xcc) && DEBUG_Breakpoint()) return debugCallback;
else if (DEBUG_IntBreakpoint(inst.op1.b)) return debugCallback;
if (((inst.entry & 0xFF)==0xcc) && DEBUG_Breakpoint())
return debugCallback;
else if (DEBUG_IntBreakpoint(inst.op1.b))
return debugCallback;
#endif
Interrupt(inst.op1.b);
CPU_SW_Interrupt(inst.op1.b,IPPoint-inst.start);
goto restart_core;
case O_INb:
reg_al=IO_Read(inst.op1.d);
@ -444,12 +446,19 @@ switch (inst.code.op) {
LOG(LOG_CPU,LOG_ERROR)("Group 7 Illegal subfunction %X",inst.rm_index);
}
break;
case O_M_Cd_Rd:
case O_M_CRx_Rd:
CPU_SET_CRX(inst.rm_index,inst.op1.d);
break;
case O_M_Rd_Cd:
case O_M_Rd_CRx:
inst.op1.d=CPU_GET_CRX(inst.rm_index);
break;
case O_M_DRx_Rd:
LOG(LOG_CPU,LOG_NORMAL)("MOV DR%d,%X",inst.rm_index,inst.op1.d);
break;
case O_M_Rd_DRx:
inst.op1.d=0;
LOG(LOG_CPU,LOG_NORMAL)("MOV %X,DR%d",inst.op1.d,inst.rm_index);
break;
case O_LAR:
{
FillFlags();

View file

@ -100,7 +100,7 @@ static OpCode OpCodeTable[1024]={
{L_MODRM ,0 ,S_Eb ,M_Gb },{L_MODRM ,0 ,S_Ew ,M_Gw },
{L_MODRM ,0 ,S_Gb ,M_Eb },{L_MODRM ,0 ,S_Gw ,M_Ew },
{L_MODRM ,0 ,S_Ew ,M_SEG },{L_MODRM ,0 ,S_Gw ,M_EA },
{L_MODRM ,0 ,S_SEGm ,M_Ew },{L_MODRM ,0 ,S_Ew ,M_POPw },
{L_MODRM ,0 ,S_SEGm ,M_Ew },{L_POPwRM ,0 ,S_Ew ,M_None },
/* 0x90 - 0x97 */
{D_NOP ,0 ,0 ,0 },{L_REGw ,O_XCHG_AX ,S_REGw ,REGI_CX},
@ -203,8 +203,8 @@ static OpCode OpCodeTable[1024]={
{0 ,0 ,0 ,0 },{0 ,0 ,0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},
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },

View file

@ -23,6 +23,7 @@
count=1;
} else {
/* Calculate amount of ops to do before cycles run out */
CPU_Cycles++;
if ((count>(Bitu)CPU_Cycles) && (inst.code.op<R_SCASB)) {
count_left=count-CPU_Cycles;
count=CPU_Cycles;

View file

@ -2,7 +2,7 @@ enum {
L_N=0,
L_SKIP,
/* Grouped ones using MOD/RM */
L_MODRM,
L_MODRM,L_POPwRM,L_POPdRM,
L_Ib,L_Iw,L_Id,
L_Ibx,L_Iwx,L_Idx, //Sign extend
@ -15,8 +15,6 @@ enum {
L_POPfw,L_POPfd,
L_SEG,
L_FLG,L_INTO,
L_VAL,
@ -82,7 +80,8 @@ enum {
O_GRP6w,O_GRP6d,
O_GRP7w,O_GRP7d,
O_M_Cd_Rd,O_M_Rd_Cd,
O_M_CRx_Rd,O_M_Rd_CRx,
O_M_DRx_Rd,O_M_Rd_DRx,
O_LAR,O_LSL,
O_ARPL,