CPU changes.

This commit is contained in:
OBattler
2022-07-16 03:12:24 +02:00
parent e83d1e7ea3
commit 2fd712d092
2 changed files with 36 additions and 2 deletions

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 timer_t *cpu_fast_off_timer = NULL;
static double *cpu_fast_off_period = NULL;
#define AMD_SYSCALL_EIP (msr.star & 0xFFFFFFFF)
#define AMD_SYSCALL_SB ((msr.star >> 32) & 0xFFFF)
@@ -1837,11 +1841,37 @@ sysret(uint32_t fetchdat)
}
void
cpu_register_fast_off_handler(void *timer, double *period)
{
cpu_fast_off_timer = (timer_t *) timer;
cpu_fast_off_period = period;
}
void
cpu_fast_off_advance(void)
{
if (cpu_fast_off_period && (*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)
{
if (cpu_fast_off_period) {
*cpu_fast_off_period = ((double) (val + 1)) * period;
cpu_fast_off_advance();
}
}
void
smi_raise(void)
{
if (is486 && (cpu_fast_off_flags & 0x80000000))
cpu_fast_off_count = cpu_fast_off_val + 1;
cpu_fast_off_advance();
smi_line = 1;
}
@@ -1851,7 +1881,7 @@ void
nmi_raise(void)
{
if (is486 && (cpu_fast_off_flags & 0x20000000))
cpu_fast_off_count = cpu_fast_off_val + 1;
cpu_fast_off_advance();
}

View File

@@ -733,6 +733,10 @@ extern uint8_t do_translate, do_translate2;
extern void reset_808x(int hard);
extern void cpu_register_fast_off_handler(void *timer, double *period);
extern void cpu_fast_off_advance(void);
extern void cpu_fast_off_period_set(uint16_t vla, double period);
extern void smi_raise();
extern void nmi_raise();