From ded957188a45de1222ddb45ebdfe2b1633904739 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Fri, 27 Oct 2006 12:01:52 +0000 Subject: [PATCH] Add Beta1 patch: "Add very basic Clipper support." by wd. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2712 --- src/cpu/core_normal.cpp | 3 +++ src/cpu/core_normal/prefix_none.h | 12 +++++++++++- src/cpu/core_simple.cpp | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/cpu/core_normal.cpp b/src/cpu/core_normal.cpp index 14e65403..e74b9ee1 100644 --- a/src/cpu/core_normal.cpp +++ b/src/cpu/core_normal.cpp @@ -71,6 +71,7 @@ extern Bitu cycle_count; #define DO_PREFIX_SEG(_SEG) \ BaseDS=SegBase(_SEG); \ BaseSS=SegBase(_SEG); \ + core.base_val_ds=_SEG; \ goto restart_opcode; #define DO_PREFIX_ADDR() \ @@ -92,6 +93,7 @@ static struct { Bitu opcode_index; PhysPt cseip; PhysPt base_ds,base_ss; + SegNames base_val_ds; bool rep_zero; Bitu prefixes; GetEAHandler * ea_table; @@ -142,6 +144,7 @@ Bits CPU_Core_Normal_Run(void) { core.ea_table=&EATable[cpu.code.big*256]; BaseDS=SegBase(ds); BaseSS=SegBase(ss); + core.base_val_ds=ds; #if C_DEBUG #if C_HEAVY_DEBUG if (DEBUG_HeavyIsBreakpoint()) { diff --git a/src/cpu/core_normal/prefix_none.h b/src/cpu/core_normal/prefix_none.h index 97ea24d2..b7b4f174 100644 --- a/src/cpu/core_normal/prefix_none.h +++ b/src/cpu/core_normal/prefix_none.h @@ -431,7 +431,17 @@ { GetRMrb; if (rm >= 0xc0 ) {GetEArb;*earb=*rmrb;} - else {GetEAa;SaveMb(eaa,*rmrb);} + else { + if (cpu.pmode) { + Descriptor desc; + cpu.gdt.GetDescriptor(SegValue(core.base_val_ds),desc); + if ((desc.Type()==DESC_CODE_R_NC_A) || (desc.Type()==DESC_CODE_R_NC_NA)) { + CPU_Exception(EXCEPTION_GP,SegValue(core.base_val_ds) & 0xfffc); + continue; + } + } + GetEAa;SaveMb(eaa,*rmrb); + } break; } CASE_W(0x89) /* MOV Ew,Gw */ diff --git a/src/cpu/core_simple.cpp b/src/cpu/core_simple.cpp index c07aeba7..e79514ab 100644 --- a/src/cpu/core_simple.cpp +++ b/src/cpu/core_simple.cpp @@ -63,6 +63,7 @@ extern Bitu cycle_count; #define DO_PREFIX_SEG(_SEG) \ BaseDS=SegBase(_SEG); \ BaseSS=SegBase(_SEG); \ + core.base_val_ds=_SEG; \ goto restart_opcode; #define DO_PREFIX_ADDR() \ @@ -84,6 +85,7 @@ static struct { Bitu opcode_index; HostPt cseip; PhysPt base_ds,base_ss; + SegNames base_val_ds; bool rep_zero; Bitu prefixes; GetEAHandler * ea_table; @@ -137,6 +139,7 @@ Bits CPU_Core_Simple_Run(void) { core.ea_table=&EATable[cpu.code.big*256]; BaseDS=SegBase(ds); BaseSS=SegBase(ss); + core.base_val_ds=ds; #if C_DEBUG #if C_HEAVY_DEBUG if (DEBUG_HeavyIsBreakpoint()) {