Several fixes - the MR BIOS'es now work on the recompiler (thank you, port EBh!), so they have been moved out of the Dev branch.

This commit is contained in:
OBattler
2020-05-13 03:43:02 +02:00
parent 870671586d
commit f46181db78
11 changed files with 48 additions and 64 deletions

View File

@@ -275,6 +275,15 @@ static void prefetch_flush()
#ifdef USE_DYNAREC #ifdef USE_DYNAREC
static int cycles_main = 0; static int cycles_main = 0;
void update_tsc(int cycs)
{
if (cycs > 0) {
tsc += cycs;
if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc))
timer_process();
}
}
void exec386_dynarec(int cycs) void exec386_dynarec(int cycs)
{ {
@@ -282,7 +291,9 @@ void exec386_dynarec(int cycs)
uint32_t addr; uint32_t addr;
int tempi; int tempi;
int cycdiff; int cycdiff;
int oldcyc; int oldcyc, oldtsc;
int oldcyc2;
int delta;
uint32_t start_pc = 0; uint32_t start_pc = 0;
int cyc_period = cycs / 2000; /*5us*/ int cyc_period = cycs / 2000; /*5us*/
@@ -305,7 +316,8 @@ void exec386_dynarec(int cycs)
cycdiff=0; cycdiff=0;
#endif #endif
oldcyc=cycles; oldcyc = oldcyc2 = cycles;
oldtsc = tsc;
if (!CACHE_ON()) /*Interpret block*/ if (!CACHE_ON()) /*Interpret block*/
{ {
cpu_block_end = 0; cpu_block_end = 0;
@@ -699,8 +711,18 @@ void exec386_dynarec(int cycs)
#endif #endif
} }
cycdiff=oldcyc-cycles; cycdiff = oldcyc - cycles;
tsc += cycdiff; delta = tsc - oldtsc;
if (delta > 0) {
/* TSC has changed, this means interim timer processing has happened,
see how much we still need to add. */
cycdiff -= delta;
if (cycdiff > 0)
tsc += cycdiff;
} else {
/* TSC has not changed. */
tsc += cycdiff;
}
if (cpu_state.abrt) if (cpu_state.abrt)
{ {
@@ -799,8 +821,10 @@ void exec386_dynarec(int cycs)
} }
} }
if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) if (cycdiff > 0) {
timer_process(); if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc))
timer_process();
}
} }
cycles_main -= (cycles_start - cycles); cycles_main -= (cycles_start - cycles);

View File

@@ -565,6 +565,7 @@ extern int cpu_effective, cpu_alt_reset;
extern void cpu_dynamic_switch(int new_cpu); extern void cpu_dynamic_switch(int new_cpu);
extern void cpu_ven_reset(void); extern void cpu_ven_reset(void);
extern void update_tsc(int cycs);
extern int sysenter(uint32_t fetchdat); extern int sysenter(uint32_t fetchdat);
extern int sysexit(uint32_t fetchdat); extern int sysexit(uint32_t fetchdat);

View File

@@ -222,9 +222,7 @@ extern int machine_at_winbios1429_init(const machine_t *);
extern int machine_at_opti495_init(const machine_t *); extern int machine_at_opti495_init(const machine_t *);
extern int machine_at_opti495_ami_init(const machine_t *); extern int machine_at_opti495_ami_init(const machine_t *);
#if defined(DEV_BRANCH) && defined(USE_MR495)
extern int machine_at_opti495_mr_init(const machine_t *); extern int machine_at_opti495_mr_init(const machine_t *);
#endif
extern int machine_at_ami471_init(const machine_t *); extern int machine_at_ami471_init(const machine_t *);
extern int machine_at_dtk486_init(const machine_t *); extern int machine_at_dtk486_init(const machine_t *);
@@ -281,9 +279,7 @@ extern const device_t *at_endeavor_get_device(void);
extern int machine_at_chariot_init(const machine_t *); extern int machine_at_chariot_init(const machine_t *);
extern int machine_at_mr586_init(const machine_t *); extern int machine_at_mr586_init(const machine_t *);
extern int machine_at_thor_init(const machine_t *); extern int machine_at_thor_init(const machine_t *);
#if defined(DEV_BRANCH) && defined(USE_MRTHOR)
extern int machine_at_mrthor_init(const machine_t *); extern int machine_at_mrthor_init(const machine_t *);
#endif
extern int machine_at_pb640_init(const machine_t *); extern int machine_at_pb640_init(const machine_t *);
extern int machine_at_acerm3a_init(const machine_t *); extern int machine_at_acerm3a_init(const machine_t *);

View File

@@ -328,8 +328,11 @@ outb(uint16_t port, uint8_t val)
p = p->next; p = p->next;
} }
if (!found) if (!found) {
sub_cycles(io_delay); sub_cycles(io_delay);
if (cpu_use_dynarec && (port == 0xeb))
update_tsc(io_delay);
}
io_log("(%i, %i, %04i) outb(%04X, %02X)\n", in_smm, found, qfound, port, val); io_log("(%i, %i, %04i) outb(%04X, %02X)\n", in_smm, found, qfound, port, val);
@@ -418,8 +421,11 @@ outw(uint16_t port, uint16_t val)
} }
} }
if (!found) if (!found) {
sub_cycles(io_delay); sub_cycles(io_delay);
if (cpu_use_dynarec && (port == 0xeb))
update_tsc(io_delay);
}
io_log("(%i, %i, %04i) outw(%04X, %04X)\n", in_smm, found, qfound, port, val); io_log("(%i, %i, %04i) outw(%04X, %04X)\n", in_smm, found, qfound, port, val);
@@ -542,8 +548,11 @@ outl(uint16_t port, uint32_t val)
} }
} }
if (!found) if (!found) {
sub_cycles(io_delay); sub_cycles(io_delay);
if (cpu_use_dynarec && (port == 0xeb))
update_tsc(io_delay);
}
io_log("(%i, %i, %04i) outl(%04X, %08X)\n", in_smm, found, qfound, port, val); io_log("(%i, %i, %04i) outl(%04X, %08X)\n", in_smm, found, qfound, port, val);

View File

@@ -205,7 +205,6 @@ machine_at_opti495_ami_init(const machine_t *model)
} }
#if defined(DEV_BRANCH) && defined(USE_MR495)
int int
machine_at_opti495_mr_init(const machine_t *model) machine_at_opti495_mr_init(const machine_t *model)
{ {
@@ -221,7 +220,6 @@ machine_at_opti495_mr_init(const machine_t *model)
return ret; return ret;
} }
#endif
static void static void

View File

@@ -143,7 +143,6 @@ machine_at_thor_init(const machine_t *model)
} }
#if defined(DEV_BRANCH) && defined(USE_MRTHOR)
int int
machine_at_mrthor_init(const machine_t *model) machine_at_mrthor_init(const machine_t *model)
{ {
@@ -159,7 +158,6 @@ machine_at_mrthor_init(const machine_t *model)
return ret; return ret;
} }
#endif
int int

View File

@@ -166,9 +166,7 @@ const machine_t machines[] = {
/* 386DX machines which utilize the VLB bus */ /* 386DX machines which utilize the VLB bus */
{ "[386DX VLB] Award 386DX clone", "award386dx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 32, 1, 127, machine_at_opti495_init, NULL }, { "[386DX VLB] Award 386DX clone", "award386dx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 32, 1, 127, machine_at_opti495_init, NULL },
{ "[386DX VLB] Dataexpert SX495 (386DX)", "ami386dx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 32, 1, 127, machine_at_opti495_ami_init, NULL }, { "[386DX VLB] Dataexpert SX495 (386DX)", "ami386dx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 32, 1, 127, machine_at_opti495_ami_init, NULL },
#if defined(DEV_BRANCH) && defined(USE_MR495)
{ "[386DX VLB] MR 386DX clone", "mr386dx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 32, 1, 127, machine_at_opti495_mr_init, NULL }, { "[386DX VLB] MR 386DX clone", "mr386dx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 32, 1, 127, machine_at_opti495_mr_init, NULL },
#endif
/* 386DX machines which utilize the MCA bus */ /* 386DX machines which utilize the MCA bus */
{ "[386DX MCA] IBM PS/2 model 70 (type 3)", "ibmps2_m70_type3", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"IBM",cpus_IBM486BL},{"", NULL}}, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_VIDEO, 2, 16, 2, 63, machine_ps2_model_70_type3_init, NULL }, { "[386DX MCA] IBM PS/2 model 70 (type 3)", "ibmps2_m70_type3", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"IBM",cpus_IBM486BL},{"", NULL}}, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_VIDEO, 2, 16, 2, 63, machine_ps2_model_70_type3_init, NULL },
@@ -191,9 +189,7 @@ const machine_t machines[] = {
#endif #endif
{ "[486 VLB] DTK PKM-0038S E-2", "dtk486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 64, 1, 127, machine_at_dtk486_init, NULL }, { "[486 VLB] DTK PKM-0038S E-2", "dtk486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 64, 1, 127, machine_at_dtk486_init, NULL },
#if defined(DEV_BRANCH) && defined(USE_MR495)
{ "[486 VLB] MR 486 clone", "mr486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 32, 1, 127, machine_at_opti495_mr_init, NULL }, { "[486 VLB] MR 486 clone", "mr486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 32, 1, 127, machine_at_opti495_mr_init, NULL },
#endif
{ "[486 VLB] Phoenix SiS 471", "px471", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 128, 1, 127, machine_at_px471_init, NULL }, { "[486 VLB] Phoenix SiS 471", "px471", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 128, 1, 127, machine_at_px471_init, NULL },
#if defined(DEV_BRANCH) && defined(USE_PS2M70T4) #if defined(DEV_BRANCH) && defined(USE_PS2M70T4)
@@ -238,9 +234,7 @@ const machine_t machines[] = {
{ "[Socket 7-3V FX] MR 430FX clone", "mr586", MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 8, 128, 8, 127, machine_at_mr586_init, NULL }, { "[Socket 7-3V FX] MR 430FX clone", "mr586", MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 8, 128, 8, 127, machine_at_mr586_init, NULL },
{ "[Socket 7-3V FX] Intel Advanced/ATX", "thor", MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_thor_init, NULL }, { "[Socket 7-3V FX] Intel Advanced/ATX", "thor", MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_thor_init, NULL },
{ "[Socket 7-3V FX] Intel Advanced/EV", "endeavor", MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_endeavor_init, at_endeavor_get_device }, { "[Socket 7-3V FX] Intel Advanced/EV", "endeavor", MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_endeavor_init, at_endeavor_get_device },
#if defined(DEV_BRANCH) && defined(USE_MRTHOR)
{ "[Socket 7-3V FX] MR Intel Advanced/ATX", "mrthor", MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_mrthor_init, NULL }, { "[Socket 7-3V FX] MR Intel Advanced/ATX", "mrthor", MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_mrthor_init, NULL },
#endif
{ "[Socket 7-3V FX] Packard Bell PB640", "pb640", MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_pb640_init, at_pb640_get_device }, { "[Socket 7-3V FX] Packard Bell PB640", "pb640", MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_pb640_init, at_pb640_get_device },
/* 430HX */ /* 430HX */

View File

@@ -1017,7 +1017,7 @@ pit_set_clock(int clock)
xt_cpu_multi <<= 32ULL; xt_cpu_multi <<= 32ULL;
/* Delay for empty I/O ports. */ /* Delay for empty I/O ports. */
io_delay = (int) round(((double) machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].rspeed) / 1000000.0); io_delay = (int) round(((double) machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].rspeed) / 2000000.0);
MDACONST = (uint64_t) (cpuclock / 2032125.0 * (double)(1ull << 32)); MDACONST = (uint64_t) (cpuclock / 2032125.0 * (double)(1ull << 32));
HERCCONST = MDACONST; HERCCONST = MDACONST;

View File

@@ -26,6 +26,7 @@
#include <86box/plat.h> #include <86box/plat.h>
#include <86box/ui.h> #include <86box/ui.h>
#include <86box/postcard.h> #include <86box/postcard.h>
#include "cpu.h"
static uint16_t postcard_port; static uint16_t postcard_port;
@@ -98,6 +99,9 @@ postcard_write(uint16_t port, uint8_t val, void *priv)
if (postcard_written && val == postcard_code) if (postcard_written && val == postcard_code)
return; return;
if (val == 0x13)
pclog("[%04X:%08X] POST 13\n", CS, cpu_state.pc);
postcard_prev_code = postcard_code; postcard_prev_code = postcard_code;
postcard_code = val; postcard_code = val;
if (postcard_written < 2) if (postcard_written < 2)

View File

@@ -47,12 +47,6 @@ ifeq ($(DEV_BUILD), y)
ifndef MGA ifndef MGA
MGA := y MGA := y
endif endif
ifndef MR495
MR495 := y
endif
ifndef MRTHOR
MRTHOR := y
endif
ifndef PAS16 ifndef PAS16
PAS16 := n PAS16 := n
endif endif
@@ -111,12 +105,6 @@ else
ifndef MGA ifndef MGA
MGA := n MGA := n
endif endif
ifndef MR495
MR495 := n
endif
ifndef MRTHOR
MRTHOR := n
endif
ifndef PAS16 ifndef PAS16
PAS16 := n PAS16 := n
endif endif
@@ -434,14 +422,6 @@ OPTS += -DUSE_MGA
DEVBROBJ += vid_mga.o DEVBROBJ += vid_mga.o
endif endif
ifeq ($(MR495), y)
OPTS += -DUSE_MR495
endif
ifeq ($(MRTHOR), y)
OPTS += -DUSE_MRTHOR
endif
ifeq ($(PAS16), y) ifeq ($(PAS16), y)
OPTS += -DUSE_PAS16 OPTS += -DUSE_PAS16
DEVBROBJ += snd_pas16.o DEVBROBJ += snd_pas16.o

View File

@@ -47,12 +47,6 @@ ifeq ($(DEV_BUILD), y)
ifndef MGA ifndef MGA
MGA := y MGA := y
endif endif
ifndef MR495
MR495 := y
endif
ifndef MRTHOR
MRTHOR := y
endif
ifndef PAS16 ifndef PAS16
PAS16 := n PAS16 := n
endif endif
@@ -111,12 +105,6 @@ else
ifndef MGA ifndef MGA
MGA := n MGA := n
endif endif
ifndef MR495
MR495 := n
endif
ifndef MRTHOR
MRTHOR := n
endif
ifndef PAS16 ifndef PAS16
PAS16 := n PAS16 := n
endif endif
@@ -443,14 +431,6 @@ OPTS += -DUSE_MGA
DEVBROBJ += vid_mga.o DEVBROBJ += vid_mga.o
endif endif
ifeq ($(MR495), y)
OPTS += -DUSE_MR495
endif
ifeq ($(MRTHOR), y)
OPTS += -DUSE_MRTHOR
endif
ifeq ($(PAS16), y) ifeq ($(PAS16), y)
OPTS += -DUSE_PAS16 OPTS += -DUSE_PAS16
DEVBROBJ += snd_pas16.o DEVBROBJ += snd_pas16.o