2018-09-20 18:08:34 +02:00
|
|
|
#include <stdarg.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <wchar.h>
|
2017-05-05 01:49:42 +02:00
|
|
|
#include <math.h>
|
|
|
|
|
#ifndef INFINITY
|
|
|
|
|
# define INFINITY (__builtin_inff())
|
|
|
|
|
#endif
|
2020-02-29 19:12:23 +01:00
|
|
|
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/86box.h>
|
2016-06-26 00:34:39 +02:00
|
|
|
#include "cpu.h"
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/timer.h>
|
2016-06-26 00:34:39 +02:00
|
|
|
#include "x86.h"
|
|
|
|
|
#include "x86_ops.h"
|
|
|
|
|
#include "x87.h"
|
|
|
|
|
#include "x86_flags.h"
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/io.h>
|
|
|
|
|
#include <86box/mem.h>
|
|
|
|
|
#include <86box/nmi.h>
|
|
|
|
|
#include <86box/pic.h>
|
2016-06-26 00:34:39 +02:00
|
|
|
#include "codegen.h"
|
|
|
|
|
|
|
|
|
|
#define CPU_BLOCK_END() cpu_block_end = 1
|
|
|
|
|
|
|
|
|
|
#include "386_common.h"
|
|
|
|
|
|
|
|
|
|
|
2017-05-05 01:49:42 +02:00
|
|
|
static __inline void fetch_ea_32_long(uint32_t rmdat)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
|
|
|
|
eal_r = eal_w = NULL;
|
2016-08-20 03:40:12 +02:00
|
|
|
easeg = cpu_state.ea_seg->base;
|
|
|
|
|
if (easeg != 0xFFFFFFFF && ((easeg + cpu_state.eaaddr) & 0xFFF) <= 0xFFC)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2016-08-20 03:40:12 +02:00
|
|
|
uint32_t addr = easeg + cpu_state.eaaddr;
|
2021-04-10 07:18:47 +02:00
|
|
|
if ( readlookup2[addr >> 12] != (uintptr_t) LOOKUP_INV)
|
2016-06-26 00:34:39 +02:00
|
|
|
eal_r = (uint32_t *)(readlookup2[addr >> 12] + addr);
|
2021-04-10 07:18:47 +02:00
|
|
|
if (writelookup2[addr >> 12] != (uintptr_t) LOOKUP_INV)
|
2016-06-26 00:34:39 +02:00
|
|
|
eal_w = (uint32_t *)(writelookup2[addr >> 12] + addr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-05 01:49:42 +02:00
|
|
|
static __inline void fetch_ea_16_long(uint32_t rmdat)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
|
|
|
|
eal_r = eal_w = NULL;
|
2016-08-20 03:40:12 +02:00
|
|
|
easeg = cpu_state.ea_seg->base;
|
|
|
|
|
if (easeg != 0xFFFFFFFF && ((easeg + cpu_state.eaaddr) & 0xFFF) <= 0xFFC)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2016-08-20 03:40:12 +02:00
|
|
|
uint32_t addr = easeg + cpu_state.eaaddr;
|
2021-04-10 07:18:47 +02:00
|
|
|
if ( readlookup2[addr >> 12] != (uintptr_t) LOOKUP_INV)
|
2016-06-26 00:34:39 +02:00
|
|
|
eal_r = (uint32_t *)(readlookup2[addr >> 12] + addr);
|
2021-04-10 07:18:47 +02:00
|
|
|
if (writelookup2[addr >> 12] != (uintptr_t) LOOKUP_INV)
|
2016-06-26 00:34:39 +02:00
|
|
|
eal_w = (uint32_t *)(writelookup2[addr >> 12] + addr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-29 19:12:23 +01:00
|
|
|
#define fetch_ea_16(rmdat) cpu_state.pc++; if (cpu_mod != 3) fetch_ea_16_long(rmdat);
|
|
|
|
|
#define fetch_ea_32(rmdat) cpu_state.pc++; if (cpu_mod != 3) fetch_ea_32_long(rmdat);
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2016-08-20 03:40:12 +02:00
|
|
|
|
2016-12-23 03:16:24 +01:00
|
|
|
#define PREFETCH_RUN(instr_cycles, bytes, modrm, reads, read_ls, writes, write_ls, ea32)
|
|
|
|
|
#define PREFETCH_PREFIX()
|
|
|
|
|
#define PREFETCH_FLUSH()
|
2016-08-20 03:40:12 +02:00
|
|
|
|
2016-06-26 00:34:39 +02:00
|
|
|
#define OP_TABLE(name) dynarec_ops_ ## name
|
2020-02-29 19:12:23 +01:00
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
#define CLOCK_CYCLES(c)
|
2022-01-29 07:27:45 -08:00
|
|
|
#define CLOCK_CYCLES_FPU(c)
|
|
|
|
|
#define CONCURRENCY_CYCLES(c) fpu_cycles = (c)
|
2020-04-10 01:08:52 +02:00
|
|
|
#define CLOCK_CYCLES_ALWAYS(c) cycles -= (c)
|
2020-02-29 19:12:23 +01:00
|
|
|
|
2016-06-26 00:34:39 +02:00
|
|
|
#include "386_ops.h"
|