Reverted some changes and reworked some lines in cpu/386.c.

This commit is contained in:
OBattler
2023-08-17 02:52:49 +02:00
parent bf38c4adef
commit 44ba846ae6

View File

@@ -77,7 +77,6 @@ x386_log(const char *fmt, ...)
static __inline void static __inline void
fetch_ea_32_long(uint32_t rmdat) fetch_ea_32_long(uint32_t rmdat)
{ {
eal_r = eal_w = NULL;
easeg = cpu_state.ea_seg->base; easeg = cpu_state.ea_seg->base;
if (cpu_rm == 4) { if (cpu_rm == 4) {
uint8_t sib = rmdat >> 8; uint8_t sib = rmdat >> 8;
@@ -122,19 +121,11 @@ fetch_ea_32_long(uint32_t rmdat)
cpu_state.eaaddr = getlong(); cpu_state.eaaddr = getlong();
} }
} }
if (easeg != 0xFFFFFFFF && ((easeg + cpu_state.eaaddr) & 0xFFF) <= 0xFFC) {
uint32_t addr = easeg + cpu_state.eaaddr;
if (readlookup2[addr >> 12] != (uintptr_t) -1)
eal_r = (uint32_t *) (readlookup2[addr >> 12] + addr);
if (writelookup2[addr >> 12] != (uintptr_t) -1)
eal_w = (uint32_t *) (writelookup2[addr >> 12] + addr);
}
} }
static __inline void static __inline void
fetch_ea_16_long(uint32_t rmdat) fetch_ea_16_long(uint32_t rmdat)
{ {
eal_r = eal_w = NULL;
easeg = cpu_state.ea_seg->base; easeg = cpu_state.ea_seg->base;
if (!cpu_mod && cpu_rm == 6) { if (!cpu_mod && cpu_rm == 6) {
cpu_state.eaaddr = getword(); cpu_state.eaaddr = getword();
@@ -158,13 +149,6 @@ fetch_ea_16_long(uint32_t rmdat)
} }
cpu_state.eaaddr &= 0xFFFF; cpu_state.eaaddr &= 0xFFFF;
} }
if (easeg != 0xFFFFFFFF && ((easeg + cpu_state.eaaddr) & 0xFFF) <= 0xFFC) {
uint32_t addr = easeg + cpu_state.eaaddr;
if (readlookup2[addr >> 12] != (uintptr_t) -1)
eal_r = (uint32_t *) (readlookup2[addr >> 12] + addr);
if (writelookup2[addr >> 12] != (uintptr_t) -1)
eal_w = (uint32_t *) (writelookup2[addr >> 12] + addr);
}
} }
#define fetch_ea_16(rmdat) \ #define fetch_ea_16(rmdat) \
@@ -225,15 +209,12 @@ fetch_ea_16_long(uint32_t rmdat)
#define CLOCK_CYCLES_ALWAYS(c) cycles -= (c) #define CLOCK_CYCLES_ALWAYS(c) cycles -= (c)
#define CHECK_READ_CS(chseg, low, high) \ #define CHECK_READ_CS(size) \
if ((low < (chseg)->limit_low) || (high > (chseg)->limit_high)) \ if ((cpu_state.pc < cpu_state.seg_cs.limit_low) || \
x86gpf("Limit check (READ)", 0); \ ((cpu_state.pc + size - 1) > cpu_state.seg_cs.limit_high)) \
if (msw & 1 && !(cpu_state.eflags & VM_FLAG) && !((chseg)->access & 0x80)) { \ x86gpf("Limit check (READ)", 0); \
if ((chseg) == &cpu_state.seg_ss) \ if (msw & 1 && !(cpu_state.eflags & VM_FLAG) && !(cpu_state.seg_cs.access & 0x80)) \
x86ss(NULL, (chseg)->seg & 0xfffc); \ x86np("Read from seg not present", cpu_state.seg_cs.seg & 0xfffc); \
else \
x86np("Read from seg not present", (chseg)->seg & 0xfffc); \
}
#include "386_ops.h" #include "386_ops.h"
@@ -277,11 +258,7 @@ exec386_2386(int cycs)
fetchdat = fastreadl_fetch(cs + cpu_state.pc); fetchdat = fastreadl_fetch(cs + cpu_state.pc);
ol = opcode_length[fetchdat & 0xff]; ol = opcode_length[fetchdat & 0xff];
if (ol < 4) { CHECK_READ_CS(MIN(ol, 4));
CHECK_READ_CS(&cpu_state.seg_cs, cpu_state.pc, cpu_state.pc + ol - 1);
} else {
CHECK_READ_CS(&cpu_state.seg_cs, cpu_state.pc, cpu_state.pc + 3);
}
if (!cpu_state.abrt) { if (!cpu_state.abrt) {
#ifdef ENABLE_386_LOG #ifdef ENABLE_386_LOG