Merge branch '86Box:master' into nec-v20

This commit is contained in:
Jasmine Iwanek
2022-07-16 01:30:56 -04:00
committed by GitHub
35 changed files with 245 additions and 159 deletions

View File

@@ -210,9 +210,6 @@ exec386(int cycs)
loadcs(readmemw(0, addr + 2));
}
} else if (nmi && nmi_enable && nmi_mask) {
if (is486 && (cpu_fast_off_flags & 0x20000000))
cpu_fast_off_count = cpu_fast_off_val + 1;
cpu_state.oldpc = cpu_state.pc;
x86_int(2);
nmi_enable = 0;

View File

@@ -22,6 +22,7 @@
#include <86box/fdd.h>
#include <86box/fdc.h>
#include <86box/keyboard.h>
#include <86box/timer.h>
#include "386_common.h"
#include "x86_flags.h"
#include "x86seg.h"
@@ -71,6 +72,9 @@ int smm_in_hlt = 0, smi_block = 0;
uint32_t addr64, addr64_2;
uint32_t addr64a[8], addr64a_2[8];
static pc_timer_t *cpu_fast_off_timer = NULL;
static double cpu_fast_off_period = 0.0;
#define AMD_SYSCALL_EIP (msr.star & 0xFFFFFFFF)
#define AMD_SYSCALL_SB ((msr.star >> 32) & 0xFFFF)
@@ -1183,9 +1187,6 @@ enter_smm(int in_hlt)
void
enter_smm_check(int in_hlt)
{
if (smi_line && (cpu_fast_off_flags & 0x80000000))
cpu_fast_off_count = cpu_fast_off_val + 1;
if ((in_smm == 0) && smi_line) {
#ifdef ENABLE_386_COMMON_LOG
x386_common_log("SMI while not in SMM\n");
@@ -1840,6 +1841,60 @@ sysret(uint32_t fetchdat)
}
void
cpu_register_fast_off_handler(void *timer)
{
cpu_fast_off_timer = (pc_timer_t *) timer;
}
void
cpu_fast_off_advance(void)
{
timer_disable(cpu_fast_off_timer);
if (cpu_fast_off_period != 0.0)
timer_on_auto(cpu_fast_off_timer, cpu_fast_off_period);
}
void
cpu_fast_off_period_set(uint16_t val, double period)
{
cpu_fast_off_period = ((double) (val + 1)) * period;
cpu_fast_off_advance();
}
void
cpu_fast_off_reset(void)
{
if (cpu_fast_off_timer)
timer_disable(cpu_fast_off_timer);
cpu_register_fast_off_handler(NULL);
cpu_fast_off_period = 0.0;
cpu_fast_off_advance();
}
void
smi_raise(void)
{
if (is486 && (cpu_fast_off_flags & 0x80000000))
cpu_fast_off_advance();
smi_line = 1;
}
void
nmi_raise(void)
{
if (is486 && (cpu_fast_off_flags & 0x20000000))
cpu_fast_off_advance();
}
#ifndef USE_DYNAREC
/* This is for compatibility with new x87 code. */
void codegen_set_rounding_mode(int mode)

View File

@@ -819,9 +819,6 @@ exec386_dynarec(int cycs)
if (smi_line)
enter_smm_check(0);
else if (nmi && nmi_enable && nmi_mask) {
if (is486 && (cpu_fast_off_flags & 0x20000000))
cpu_fast_off_count = cpu_fast_off_val + 1;
#ifndef USE_NEW_DYNAREC
oldcs = CS;
#endif

View File

@@ -743,4 +743,12 @@ extern uint8_t do_translate, do_translate2;
extern void reset_808x(int hard);
extern void cpu_register_fast_off_handler(void *timer);
extern void cpu_fast_off_advance(void);
extern void cpu_fast_off_period_set(uint16_t vla, double period);
extern void cpu_fast_off_reset(void);
extern void smi_raise();
extern void nmi_raise();
#endif /*EMU_CPU_H*/