CPU changes.

This commit is contained in:
OBattler
2022-07-16 03:21:21 +02:00
parent c58360df3e
commit a35c4aa674
2 changed files with 18 additions and 10 deletions

View File

@@ -73,7 +73,7 @@ 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;
static double cpu_fast_off_period = 0.0;
#define AMD_SYSCALL_EIP (msr.star & 0xFFFFFFFF)
@@ -1842,28 +1842,35 @@ sysret(uint32_t fetchdat)
void
cpu_register_fast_off_handler(void *timer, double *period)
cpu_register_fast_off_handler(void *timer)
{
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);
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)
{
if (cpu_fast_off_period) {
*cpu_fast_off_period = ((double) (val + 1)) * period;
cpu_fast_off_advance();
}
cpu_fast_off_period = ((double) (val + 1)) * period;
cpu_fast_off_advance();
}
void
cpu_fast_off_reset(void)
{
cpu_register_fast_off_handler(NULL);
cpu_fast_off_period = 0.0;
cpu_fast_off_advance();
}

View File

@@ -733,9 +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_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();