diff --git a/src/cpu/386_common.c b/src/cpu/386_common.c index d7544b351..aa5a813b8 100644 --- a/src/cpu/386_common.c +++ b/src/cpu/386_common.c @@ -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(); } diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 61fd700d9..6d66e1531 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -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();