mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 02:17:36 +08:00
Check segment limits on 286 or higher if enabled, do NOT check segment limits if 8086 or 80186
This commit is contained in:
@@ -174,8 +174,6 @@ static GetEAHandler EATable[512]={
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
extern bool do_seg_limits;
|
||||
|
||||
#define GetEADirect(sz) \
|
||||
PhysPt eaa; \
|
||||
if (TEST_PREFIX_ADDR) \
|
||||
|
@@ -29,6 +29,14 @@ bool CPU_WRMSR();
|
||||
bool CPU_SYSENTER();
|
||||
bool CPU_SYSEXIT();
|
||||
|
||||
/* wrap original variable name in inline function prior to #define, use inline function name in redefine of do_seg_limits */
|
||||
static inline bool _seg_limit_check(void) {
|
||||
return do_seg_limits;
|
||||
}
|
||||
|
||||
/* Do not emulate segment limit exceptions on 80186, DO emulate on 286. */
|
||||
#define do_seg_limits (_seg_limit_check() && CPU_ArchitectureType >= CPU_ARCHTYPE_286)
|
||||
|
||||
#define PRE_EXCEPTION { }
|
||||
|
||||
#define CPU_CORE CPU_ARCHTYPE_286
|
||||
|
@@ -22,6 +22,10 @@
|
||||
#include "pic.h"
|
||||
#include "fpu.h"
|
||||
|
||||
/* Do not emulate segment limit exceptions on 8086. This turns the if() statements into if (0)
|
||||
* and the C++ compiler optimizer should then completely omit the code for the 8086 cputype. */
|
||||
#define do_seg_limits (0)
|
||||
|
||||
/* 8086: Apparently exceptions like DIVIDE BY ZERO are given a return address of the next instruction */
|
||||
#define PRE_EXCEPTION SAVEIP
|
||||
|
||||
|
@@ -34,6 +34,14 @@ bool CPU_WRMSR();
|
||||
bool CPU_SYSENTER();
|
||||
bool CPU_SYSEXIT();
|
||||
|
||||
/* wrap original variable name in inline function prior to #define, use inline function name in redefine of do_seg_limits */
|
||||
static inline bool _seg_limit_check(void) {
|
||||
return do_seg_limits;
|
||||
}
|
||||
|
||||
/* Do not emulate segment limit exceptions on 80186, DO emulate on 286. */
|
||||
#define do_seg_limits (_seg_limit_check() && CPU_ArchitectureType >= CPU_ARCHTYPE_286)
|
||||
|
||||
#define PRE_EXCEPTION { }
|
||||
|
||||
#define CPU_CORE CPU_ARCHTYPE_286
|
||||
|
@@ -29,6 +29,10 @@ using namespace std;
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
/* Do not emulate segment limit exceptions on 8086. This turns the if() statements into if (0)
|
||||
* and the C++ compiler optimizer should then completely omit the code for the 8086 cputype. */
|
||||
#define do_seg_limits (0)
|
||||
|
||||
/* 8086: Apparently exceptions like DIVIDE BY ZERO are given a return address of the next instruction */
|
||||
#define PRE_EXCEPTION SAVEIP
|
||||
|
||||
|
Reference in New Issue
Block a user