Initial 64-bit recompiler.
Various 64-bit fixes. Various fixes to allow building under MinGW-w64.
This commit is contained in:
parent
5be9127d64
commit
08254b8dfb
15 changed files with 1314 additions and 25 deletions
|
|
@ -4,14 +4,14 @@ extern uint16_t ea_rseg;
|
||||||
#undef writememb
|
#undef writememb
|
||||||
|
|
||||||
|
|
||||||
#define readmemb(s,a) ((readlookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF)?readmemb386l(s,a): *(uint8_t *)(readlookup2[((s)+(a))>>12] + (s) + (a)) )
|
#define readmemb(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF)?readmemb386l(s,a): *(uint8_t *)(readlookup2[(uint32_t)((s)+(a))>>12] + (uint32_t)((s) + (a))) )
|
||||||
#define readmemq(s,a) ((readlookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFF8)?readmemql(s,a):*(uint64_t *)(readlookup2[((s)+(a))>>12]+(s)+(a)))
|
#define readmemq(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFF8)?readmemql(s,a):*(uint64_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uint32_t)((s)+(a))))
|
||||||
|
|
||||||
#define writememb(s,a,v) if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF) writememb386l(s,a,v); else *(uint8_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
#define writememb(s,a,v) if (writelookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF) writememb386l(s,a,v); else *(uint8_t *)(writelookup2[(uint32_t)((s) + (a)) >> 12] + (uint32_t)((s) + (a))) = v
|
||||||
|
|
||||||
#define writememw(s,a,v) if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFE) writememwl(s,a,v); else *(uint16_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
#define writememw(s,a,v) if (writelookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFE) writememwl(s,a,v); else *(uint16_t *)(writelookup2[(uint32_t)((s) + (a)) >> 12] + (uint32_t)((s) + (a))) = v
|
||||||
#define writememl(s,a,v) if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFC) writememll(s,a,v); else *(uint32_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
#define writememl(s,a,v) if (writelookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFC) writememll(s,a,v); else *(uint32_t *)(writelookup2[(uint32_t)((s) + (a)) >> 12] + (uint32_t)((s) + (a))) = v
|
||||||
#define writememq(s,a,v) if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFF8) writememql(s,a,v); else *(uint64_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
#define writememq(s,a,v) if (writelookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFF8) writememql(s,a,v); else *(uint64_t *)(writelookup2[(uint32_t)((s) + (a)) >> 12] + (uint32_t)((s) + (a))) = v
|
||||||
|
|
||||||
|
|
||||||
#define check_io_perm(port) if (!IOPLp || (eflags&VM_FLAG)) \
|
#define check_io_perm(port) if (!IOPLp || (eflags&VM_FLAG)) \
|
||||||
|
|
|
||||||
|
|
@ -135,10 +135,11 @@ static inline void fetch_ea_32_long(uint32_t rmdat)
|
||||||
}
|
}
|
||||||
if (easeg != 0xFFFFFFFF && ((easeg + eaaddr) & 0xFFF) <= 0xFFC)
|
if (easeg != 0xFFFFFFFF && ((easeg + eaaddr) & 0xFFF) <= 0xFFC)
|
||||||
{
|
{
|
||||||
if ( readlookup2[(easeg + eaaddr) >> 12] != -1)
|
uint32_t addr = easeg + eaaddr;
|
||||||
eal_r = (uint32_t *)(readlookup2[(easeg + eaaddr) >> 12] + easeg + eaaddr);
|
if ( readlookup2[addr >> 12] != -1)
|
||||||
if (writelookup2[(easeg + eaaddr) >> 12] != -1)
|
eal_r = (uint32_t *)(readlookup2[addr >> 12] + addr);
|
||||||
eal_w = (uint32_t *)(writelookup2[(easeg + eaaddr) >> 12] + easeg + eaaddr);
|
if (writelookup2[addr >> 12] != -1)
|
||||||
|
eal_w = (uint32_t *)(writelookup2[addr >> 12] + addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,10 +177,11 @@ static inline void fetch_ea_16_long(uint32_t rmdat)
|
||||||
}
|
}
|
||||||
if (easeg != 0xFFFFFFFF && ((easeg + eaaddr) & 0xFFF) <= 0xFFC)
|
if (easeg != 0xFFFFFFFF && ((easeg + eaaddr) & 0xFFF) <= 0xFFC)
|
||||||
{
|
{
|
||||||
if ( readlookup2[(easeg + eaaddr) >> 12] != -1)
|
uint32_t addr = easeg + eaaddr;
|
||||||
eal_r = (uint32_t *)(readlookup2[(easeg + eaaddr) >> 12] + easeg + eaaddr);
|
if ( readlookup2[addr >> 12] != -1)
|
||||||
if (writelookup2[(easeg + eaaddr) >> 12] != -1)
|
eal_r = (uint32_t *)(readlookup2[addr >> 12] + addr);
|
||||||
eal_w = (uint32_t *)(writelookup2[(easeg + eaaddr) >> 12] + easeg + eaaddr);
|
if (writelookup2[addr >> 12] != -1)
|
||||||
|
eal_w = (uint32_t *)(writelookup2[addr >> 12] + addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,127 @@ extern uint32_t *mod1seg[8];
|
||||||
|
|
||||||
/*Copy-and-pasted from 386_dynarec.c, is not in a header file because it will
|
/*Copy-and-pasted from 386_dynarec.c, is not in a header file because it will
|
||||||
eventually be different for the dynarec ops*/
|
eventually be different for the dynarec ops*/
|
||||||
|
#ifdef __amd64__
|
||||||
|
static inline void fetch_ea_32_long(uint32_t rmdat)
|
||||||
|
{
|
||||||
|
eal_r = eal_w = NULL;
|
||||||
|
easeg = ea_seg->base;
|
||||||
|
ea_rseg = ea_seg->seg;
|
||||||
|
if (rm == 4)
|
||||||
|
{
|
||||||
|
uint8_t sib = rmdat >> 8;
|
||||||
|
|
||||||
|
switch (mod)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
eaaddr = regs[sib & 7].l;
|
||||||
|
pc++;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
pc++;
|
||||||
|
eaaddr = ((uint32_t)(int8_t)getbyte()) + regs[sib & 7].l;
|
||||||
|
// pc++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
eaaddr = (fastreadl(cs + pc + 1)) + regs[sib & 7].l;
|
||||||
|
pc += 5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*SIB byte present*/
|
||||||
|
if ((sib & 7) == 5 && !mod)
|
||||||
|
eaaddr = getlong();
|
||||||
|
else if ((sib & 6) == 4 && !ssegs)
|
||||||
|
{
|
||||||
|
easeg = ss;
|
||||||
|
ea_rseg = SS;
|
||||||
|
ea_seg = &_ss;
|
||||||
|
}
|
||||||
|
if (((sib >> 3) & 7) != 4)
|
||||||
|
eaaddr += regs[(sib >> 3) & 7].l << (sib >> 6);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
eaaddr = regs[rm].l;
|
||||||
|
if (mod)
|
||||||
|
{
|
||||||
|
if (rm == 5 && !ssegs)
|
||||||
|
{
|
||||||
|
easeg = ss;
|
||||||
|
ea_rseg = SS;
|
||||||
|
ea_seg = &_ss;
|
||||||
|
}
|
||||||
|
if (mod == 1)
|
||||||
|
{
|
||||||
|
eaaddr += ((uint32_t)(int8_t)(rmdat >> 8));
|
||||||
|
pc++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
eaaddr += getlong();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (rm == 5)
|
||||||
|
{
|
||||||
|
eaaddr = getlong();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (easeg != 0xFFFFFFFF && ((easeg + eaaddr) & 0xFFF) <= 0xFFC)
|
||||||
|
{
|
||||||
|
uint32_t addr = easeg + eaaddr;
|
||||||
|
if ( readlookup2[addr >> 12] != -1)
|
||||||
|
eal_r = (uint32_t *)(readlookup2[addr >> 12] + addr);
|
||||||
|
if (writelookup2[addr >> 12] != -1)
|
||||||
|
eal_w = (uint32_t *)(writelookup2[addr >> 12] + addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void fetch_ea_16_long(uint32_t rmdat)
|
||||||
|
{
|
||||||
|
eal_r = eal_w = NULL;
|
||||||
|
easeg = ea_seg->base;
|
||||||
|
ea_rseg = ea_seg->seg;
|
||||||
|
if (!mod && rm == 6)
|
||||||
|
{
|
||||||
|
eaaddr = getword();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (mod)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
eaaddr = 0;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
eaaddr = (uint16_t)(int8_t)(rmdat >> 8); pc++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
eaaddr = getword();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
eaaddr += (*mod1add[0][rm]) + (*mod1add[1][rm]);
|
||||||
|
if (mod1seg[rm] == &ss && !ssegs)
|
||||||
|
{
|
||||||
|
easeg = ss;
|
||||||
|
ea_rseg = SS;
|
||||||
|
ea_seg = &_ss;
|
||||||
|
}
|
||||||
|
eaaddr &= 0xFFFF;
|
||||||
|
}
|
||||||
|
if (easeg != 0xFFFFFFFF && ((easeg + eaaddr) & 0xFFF) <= 0xFFC)
|
||||||
|
{
|
||||||
|
uint32_t addr = easeg + eaaddr;
|
||||||
|
if ( readlookup2[addr >> 12] != -1)
|
||||||
|
eal_r = (uint32_t *)(readlookup2[addr >> 12] + addr);
|
||||||
|
if (writelookup2[addr >> 12] != -1)
|
||||||
|
eal_w = (uint32_t *)(writelookup2[addr >> 12] + addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define fetch_ea_16(rmdat) pc++; mod=(rmdat >> 6) & 3; reg=(rmdat >> 3) & 7; rm = rmdat & 7; if (mod != 3) { fetch_ea_16_long(rmdat); if (abrt) return 1; }
|
||||||
|
#define fetch_ea_32(rmdat) pc++; mod=(rmdat >> 6) & 3; reg=(rmdat >> 3) & 7; rm = rmdat & 7; if (mod != 3) { fetch_ea_32_long(rmdat); } if (abrt) return 1
|
||||||
|
|
||||||
|
#else /*__amd64__*/
|
||||||
|
|
||||||
static inline void fetch_ea_32_long(uint32_t rmdat)
|
static inline void fetch_ea_32_long(uint32_t rmdat)
|
||||||
{
|
{
|
||||||
eal_r = eal_w = NULL;
|
eal_r = eal_w = NULL;
|
||||||
|
|
@ -49,6 +170,10 @@ static inline void fetch_ea_16_long(uint32_t rmdat)
|
||||||
#define fetch_ea_16(rmdat) pc++; if (mod != 3) fetch_ea_16_long(rmdat);
|
#define fetch_ea_16(rmdat) pc++; if (mod != 3) fetch_ea_16_long(rmdat);
|
||||||
#define fetch_ea_32(rmdat) pc++; if (mod != 3) fetch_ea_32_long(rmdat);
|
#define fetch_ea_32(rmdat) pc++; if (mod != 3) fetch_ea_32_long(rmdat);
|
||||||
|
|
||||||
|
#endif /*__amd64__*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define OP_TABLE(name) dynarec_ops_ ## name
|
#define OP_TABLE(name) dynarec_ops_ ## name
|
||||||
#define CLOCK_CYCLES(c)
|
#define CLOCK_CYCLES(c)
|
||||||
#define CLOCK_CYCLES_ALWAYS(c) cycles -= (c)
|
#define CLOCK_CYCLES_ALWAYS(c) cycles -= (c)
|
||||||
|
|
|
||||||
|
|
@ -594,7 +594,7 @@ chdir(pcempath);
|
||||||
printf("ES : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",es,_es.limit,_es.access, _es.limit_low, _es.limit_high);
|
printf("ES : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",es,_es.limit,_es.access, _es.limit_low, _es.limit_high);
|
||||||
if (is386)
|
if (is386)
|
||||||
{
|
{
|
||||||
printf("FS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",fs,_fs.limit,_fs.access, _fs.limit_low, _fs.limit_high);
|
printf("FS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",seg_fs,_fs.limit,_fs.access, _fs.limit_low, _fs.limit_high);
|
||||||
printf("GS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",gs,_gs.limit,_gs.access, _gs.limit_low, _gs.limit_high);
|
printf("GS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",gs,_gs.limit,_gs.access, _gs.limit_low, _gs.limit_high);
|
||||||
}
|
}
|
||||||
printf("SS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",ss,_ss.limit,_ss.access, _ss.limit_low, _ss.limit_high);
|
printf("SS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",ss,_ss.limit,_ss.access, _ss.limit_low, _ss.limit_high);
|
||||||
|
|
|
||||||
47
src/Makefile.mingw64
Normal file
47
src/Makefile.mingw64
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
VPATH = . dosbox resid-fp
|
||||||
|
CPP = g++.exe
|
||||||
|
CC = gcc.exe
|
||||||
|
WINDRES = windres.exe
|
||||||
|
CFLAGS = -O3 -fomit-frame-pointer
|
||||||
|
OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o ali1429.o amstrad.o cdrom-ioctl.o \
|
||||||
|
codegen.o codegen_ops.o codegen_timing_486.o codegen_timing_pentium.o codegen_x86-64.o compaq.o config.o cpu.o dac.o \
|
||||||
|
device.o disc.o disc_fdi.o disc_img.o dma.o fdc.o fdc37c665.o fdi2raw.o gameport.o headland.o i430lx.o i430fx.o \
|
||||||
|
i430vx.o ide.o intel.o intel_flash.o io.o jim.o keyboard.o keyboard_amstrad.o keyboard_at.o \
|
||||||
|
keyboard_olim24.o keyboard_pcjr.o keyboard_xt.o lpt.o mcr.o mem.o model.o mouse.o mouse_ps2.o \
|
||||||
|
mouse_serial.o neat.o nmi.o nvr.o olivetti_m24.o opti.o pc.o pci.o pic.o piix.o pit.o ppi.o ps1.o rom.o \
|
||||||
|
serial.o sis496.o sound.o sound_ad1848.o sound_adlib.o sound_adlibgold.o sound_cms.o sound_dbopl.o \
|
||||||
|
sound_emu8k.o sound_gus.o sound_mpu401_uart.o sound_opl.o sound_pas16.o sound_resid.o \
|
||||||
|
sound_sb.o sound_sb_dsp.o sound_sn76489.o sound_speaker.o sound_ssi2001.o sound_wss.o \
|
||||||
|
soundopenal.o timer.o um8881f.o um8669f.o vid_ati_eeprom.o vid_ati_mach64.o vid_ati18800.o \
|
||||||
|
vid_ati28800.o vid_ati68860_ramdac.o vid_cga.o vid_cl5429.o vid_ega.o vid_et4000.o \
|
||||||
|
vid_et4000w32.o vid_et4000w32i.o vid_hercules.o vid_icd2061.o vid_ics2595.o vid_mda.o \
|
||||||
|
vid_olivetti_m24.o vid_oti067.o vid_paradise.o vid_pc1512.o vid_pc1640.o vid_pc200.o \
|
||||||
|
vid_pcjr.o vid_s3.o vid_s3_virge.o vid_sdac_ramdac.o vid_stg_ramdac.o vid_svga.o \
|
||||||
|
vid_svga_render.o vid_tandy.o vid_tgui9440.o vid_tkd8001_ramdac.o vid_tvga.o vid_unk_ramdac.o \
|
||||||
|
vid_vga.o vid_voodoo.o video.o wd76c10.o win.o win-config.o win-d3d.o win-d3d-fs.o win-ddraw.o \
|
||||||
|
win-ddraw-fs.o win-deviceconfig.o win-hdconf.o win-joystick.o win-keyboard.o win-midi.o win-mouse.o \
|
||||||
|
win-status.o win-time.o win-video.o x86seg.o x87.o xtide.o pc.res
|
||||||
|
FMOBJ = dbopl.o
|
||||||
|
SIDOBJ = convolve.o convolve-sse.o envelope.o extfilt.o filter.o pot.o sid.o voice.o wave6581__ST.o wave6581_P_T.o wave6581_PS_.o wave6581_PST.o wave8580__ST.o wave8580_P_T.o wave8580_PS_.o wave8580_PST.o wave.o
|
||||||
|
|
||||||
|
|
||||||
|
LIBS = -mwindows -lwinmm -lopenal32 -lddraw -ldinput -ldxguid -ld3d9 -lstdc++
|
||||||
|
|
||||||
|
PCem64.exe: $(OBJ) $(FMOBJ) $(SIDOBJ)
|
||||||
|
$(CC) $(OBJ) $(FMOBJ) $(SIDOBJ) -o "PCem64.exe" $(LIBS)
|
||||||
|
|
||||||
|
all : PCem64.exe
|
||||||
|
|
||||||
|
clean :
|
||||||
|
rm *.o
|
||||||
|
rm *.exe
|
||||||
|
rm *.res
|
||||||
|
|
||||||
|
%.o : %.c
|
||||||
|
$(CC) $(CFLAGS) -c $<
|
||||||
|
|
||||||
|
%.o : %.cc
|
||||||
|
$(CPP) $(CFLAGS) -c $<
|
||||||
|
|
||||||
|
pc.res: pc.rc
|
||||||
|
$(WINDRES) -i pc.rc --input-format=rc -o pc.res -O coff
|
||||||
|
|
@ -2,20 +2,26 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#ifdef __MINGW64__
|
||||||
|
#include "ntddcdrm.h"
|
||||||
|
#else
|
||||||
#include "ddk/ntddcdrm.h"
|
#include "ddk/ntddcdrm.h"
|
||||||
//#include "ntddcdrm.h"
|
#endif
|
||||||
#include "ibm.h"
|
#include "ibm.h"
|
||||||
#include "ide.h"
|
#include "ide.h"
|
||||||
#include "cdrom-ioctl.h"
|
#include "cdrom-ioctl.h"
|
||||||
|
|
||||||
int cdrom_drive;
|
int cdrom_drive;
|
||||||
|
|
||||||
|
#ifndef __MINGW64__
|
||||||
typedef struct _CDROM_TOC_SESSION_DATA {
|
typedef struct _CDROM_TOC_SESSION_DATA {
|
||||||
UCHAR Length[2];
|
UCHAR Length[2];
|
||||||
UCHAR FirstCompleteSession;
|
UCHAR FirstCompleteSession;
|
||||||
UCHAR LastCompleteSession;
|
UCHAR LastCompleteSession;
|
||||||
TRACK_DATA TrackData[1];
|
TRACK_DATA TrackData[1];
|
||||||
} CDROM_TOC_SESSION_DATA, *PCDROM_TOC_SESSION_DATA;
|
} CDROM_TOC_SESSION_DATA, *PCDROM_TOC_SESSION_DATA;
|
||||||
|
#endif
|
||||||
|
|
||||||
static ATAPI ioctl_atapi;
|
static ATAPI ioctl_atapi;
|
||||||
|
|
||||||
static uint32_t last_block = 0;
|
static uint32_t last_block = 0;
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,16 @@ static inline void addlong(uint32_t val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void addquad(uint64_t val)
|
||||||
|
{
|
||||||
|
*(uint64_t *)&codeblock[block_current].data[block_pos] = val;
|
||||||
|
block_pos += 8;
|
||||||
|
if (block_pos >= 1760)
|
||||||
|
{
|
||||||
|
CPU_BLOCK_END();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*Current physical page of block being recompiled. -1 if no recompilation taking place */
|
/*Current physical page of block being recompiled. -1 if no recompilation taking place */
|
||||||
extern uint32_t recomp_page;
|
extern uint32_t recomp_page;
|
||||||
|
|
||||||
|
|
|
||||||
1039
src/codegen_x86-64.c
Normal file
1039
src/codegen_x86-64.c
Normal file
File diff suppressed because it is too large
Load diff
19
src/codegen_x86-64.h
Normal file
19
src/codegen_x86-64.h
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#define BLOCK_SIZE 0x4000
|
||||||
|
#define BLOCK_MASK 0x3fff
|
||||||
|
#define BLOCK_START 0
|
||||||
|
|
||||||
|
#define HASH_SIZE 0x20000
|
||||||
|
#define HASH_MASK 0x1ffff
|
||||||
|
|
||||||
|
#define HASH(l) ((l) & 0x1ffff)
|
||||||
|
|
||||||
|
#define BLOCK_EXIT_OFFSET 0x7f0
|
||||||
|
#define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 20)
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
OP_RET = 0xc3
|
||||||
|
};
|
||||||
|
|
||||||
|
#define NR_HOST_REGS 3
|
||||||
|
extern int host_reg_mapping[NR_HOST_REGS];
|
||||||
|
|
@ -18,8 +18,8 @@ int writelnext;
|
||||||
extern int mmu_perm;
|
extern int mmu_perm;
|
||||||
|
|
||||||
#define readmemb(a) ((readlookup2[(a)>>12]==-1)?readmembl(a):*(uint8_t *)(readlookup2[(a) >> 12] + (a)))
|
#define readmemb(a) ((readlookup2[(a)>>12]==-1)?readmembl(a):*(uint8_t *)(readlookup2[(a) >> 12] + (a)))
|
||||||
#define readmemw(s,a) ((readlookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFE)?readmemwl(s,a):*(uint16_t *)(readlookup2[((s)+(a))>>12]+(s)+(a)))
|
#define readmemw(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFE)?readmemwl(s,a):*(uint16_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uint32_t)((s)+(a))))
|
||||||
#define readmeml(s,a) ((readlookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFC)?readmemll(s,a):*(uint32_t *)(readlookup2[((s)+(a))>>12]+(s)+(a)))
|
#define readmeml(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFC)?readmemll(s,a):*(uint32_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uint32_t)((s)+(a))))
|
||||||
|
|
||||||
//#define writememb(a,v) if (writelookup2[(a)>>12]==0xFFFFFFFF) writemembl(a,v); else ram[writelookup2[(a)>>12]+((a)&0xFFF)]=v
|
//#define writememb(a,v) if (writelookup2[(a)>>12]==0xFFFFFFFF) writemembl(a,v); else ram[writelookup2[(a)>>12]+((a)&0xFFF)]=v
|
||||||
//#define writememw(s,a,v) if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF) writememwl(s,a,v); else *((uint16_t *)(&ram[writelookup2[((s)+(a))>>12]+(((s)+(a))&0xFFF)]))=v
|
//#define writememw(s,a,v) if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF) writememwl(s,a,v); else *((uint16_t *)(&ram[writelookup2[((s)+(a))>>12]+(((s)+(a))&0xFFF)]))=v
|
||||||
|
|
@ -142,7 +142,7 @@ uint8_t *pccache2;
|
||||||
#define ds _ds.base
|
#define ds _ds.base
|
||||||
#define es _es.base
|
#define es _es.base
|
||||||
#define ss _ss.base
|
#define ss _ss.base
|
||||||
#define fs _fs.base
|
#define seg_fs _fs.base
|
||||||
#define gs _gs.base
|
#define gs _gs.base
|
||||||
|
|
||||||
#define CPL ((_cs.access>>5)&3)
|
#define CPL ((_cs.access>>5)&3)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
|
|
||||||
|
#ifndef UPDOWN_CLASS
|
||||||
|
#define UPDOWN_CLASS L"msctls_updown32"
|
||||||
|
#endif
|
||||||
|
|
||||||
MainMenu MENU DISCARDABLE
|
MainMenu MENU DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
POPUP "&File"
|
POPUP "&File"
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ float convolve_sse(const float *a, const float *b, int n)
|
||||||
int diff = (int) (a - b) & 0xf;
|
int diff = (int) (a - b) & 0xf;
|
||||||
/* long cast is no-op for x86-32, but x86-64 gcc needs 64 bit intermediate
|
/* long cast is no-op for x86-32, but x86-64 gcc needs 64 bit intermediate
|
||||||
* to convince compiler we mean this. */
|
* to convince compiler we mean this. */
|
||||||
unsigned int a_align = (unsigned int) (unsigned long) a & 0xf;
|
unsigned int a_align = (unsigned int) (uintptr_t) a & 0xf;
|
||||||
|
|
||||||
/* advance if necessary. We can't let n fall < 0, so no while (n --). */
|
/* advance if necessary. We can't let n fall < 0, so no while (n --). */
|
||||||
while (n > 0 && a_align != 0 && a_align != 16) {
|
while (n > 0 && a_align != 0 && a_align != 16) {
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef USE_OPENAL
|
#ifdef USE_OPENAL
|
||||||
#include <AL/al.h>
|
#include <AL/al.h>
|
||||||
|
#ifdef __MINGW64__
|
||||||
|
#include <AL/alc.h>
|
||||||
|
#else
|
||||||
#include <AL/alut.h>
|
#include <AL/alut.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#include "ibm.h"
|
#include "ibm.h"
|
||||||
|
|
||||||
FILE *allog;
|
FILE *allog;
|
||||||
|
|
@ -18,7 +22,40 @@ ALenum format; // internal format
|
||||||
#define BUFLEN SOUNDBUFLEN
|
#define BUFLEN SOUNDBUFLEN
|
||||||
|
|
||||||
void closeal();
|
void closeal();
|
||||||
|
#ifdef __MINGW64__
|
||||||
|
ALvoid alutInit(ALint *argc,ALbyte **argv)
|
||||||
|
{
|
||||||
|
ALCcontext *Context;
|
||||||
|
ALCdevice *Device;
|
||||||
|
|
||||||
|
//Open device
|
||||||
|
Device=alcOpenDevice((ALubyte*)"DirectSound3D");
|
||||||
|
//Create context(s)
|
||||||
|
Context=alcCreateContext(Device,NULL);
|
||||||
|
//Set active context
|
||||||
|
alcMakeContextCurrent(Context);
|
||||||
|
//Register extensions
|
||||||
|
}
|
||||||
|
|
||||||
|
ALvoid alutExit(ALvoid)
|
||||||
|
{
|
||||||
|
ALCcontext *Context;
|
||||||
|
ALCdevice *Device;
|
||||||
|
|
||||||
|
//Unregister extensions
|
||||||
|
|
||||||
|
//Get active context
|
||||||
|
Context=alcGetCurrentContext();
|
||||||
|
//Get device for active context
|
||||||
|
Device=alcGetContextsDevice(Context);
|
||||||
|
//Disable context
|
||||||
|
alcMakeContextCurrent(NULL);
|
||||||
|
//Release context(s)
|
||||||
|
alcDestroyContext(Context);
|
||||||
|
//Close device
|
||||||
|
alcCloseDevice(Device);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
void initalmain(int argc, char *argv[])
|
void initalmain(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENAL
|
#ifdef USE_OPENAL
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ int optype;
|
||||||
#define JMP 1
|
#define JMP 1
|
||||||
#define CALL 2
|
#define CALL 2
|
||||||
#define IRET 3
|
#define IRET 3
|
||||||
#define INT 4
|
#define OPTYPE_INT 4
|
||||||
|
|
||||||
uint32_t oxpc;
|
uint32_t oxpc;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1934,7 +1934,7 @@ void pmodeint(int num, int soft)
|
||||||
x86np("Int task gate not present\n", segdat[1] & 0xfffc);
|
x86np("Int task gate not present\n", segdat[1] & 0xfffc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
optype=INT;
|
optype=OPTYPE_INT;
|
||||||
cpl_override=1;
|
cpl_override=1;
|
||||||
taskswitch286(seg,segdat2,segdat2[2]&0x800);
|
taskswitch286(seg,segdat2,segdat2[2]&0x800);
|
||||||
cpl_override=0;
|
cpl_override=0;
|
||||||
|
|
@ -2366,7 +2366,7 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32)
|
||||||
new_ldt=readmemw(base,0x60);
|
new_ldt=readmemw(base,0x60);
|
||||||
|
|
||||||
if (abrt) return;
|
if (abrt) return;
|
||||||
if (optype==JMP || optype==INT)
|
if (optype==JMP || optype==OPTYPE_INT)
|
||||||
{
|
{
|
||||||
if (tr.seg&4) tempw=readmemw(ldt.base,(tr.seg&~7)+4);
|
if (tr.seg&4) tempw=readmemw(ldt.base,(tr.seg&~7)+4);
|
||||||
else tempw=readmemw(gdt.base,(tr.seg&~7)+4);
|
else tempw=readmemw(gdt.base,(tr.seg&~7)+4);
|
||||||
|
|
@ -2402,13 +2402,13 @@ void taskswitch286(uint16_t seg, uint16_t *segdat, int is32)
|
||||||
writememl(tr.base,0x5C,GS);
|
writememl(tr.base,0x5C,GS);
|
||||||
writememl(tr.base,0x60,ldt.seg);
|
writememl(tr.base,0x60,ldt.seg);
|
||||||
|
|
||||||
if (optype==INT)
|
if (optype==OPTYPE_INT)
|
||||||
{
|
{
|
||||||
writememl(base,0,tr.seg);
|
writememl(base,0,tr.seg);
|
||||||
new_flags|=NT_FLAG;
|
new_flags|=NT_FLAG;
|
||||||
}
|
}
|
||||||
if (abrt) return;
|
if (abrt) return;
|
||||||
if (optype==JMP || optype==INT)
|
if (optype==JMP || optype==OPTYPE_INT)
|
||||||
{
|
{
|
||||||
if (tr.seg&4) tempw=readmemw(ldt.base,(seg&~7)+4);
|
if (tr.seg&4) tempw=readmemw(ldt.base,(seg&~7)+4);
|
||||||
else tempw=readmemw(gdt.base,(seg&~7)+4);
|
else tempw=readmemw(gdt.base,(seg&~7)+4);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue