From f662b9f34269bb9a49b3df1100119eb61a826a9b Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 21 Jan 2020 02:00:04 +0100 Subject: [PATCH] Fixed the 286+ CPU timer running. --- src/cpu/386.c | 12 ++++-------- src/cpu/386_dynarec.c | 14 +++++--------- src/cpu/386_dynarec_ops.c | 4 +--- src/cpu_new/386.c | 8 ++------ src/cpu_new/386_dynarec.c | 8 ++------ src/cpu_new/386_dynarec_ops.c | 4 +--- 6 files changed, 15 insertions(+), 35 deletions(-) diff --git a/src/cpu/386.c b/src/cpu/386.c index 5c7273e04..e4d011bc9 100644 --- a/src/cpu/386.c +++ b/src/cpu/386.c @@ -73,12 +73,8 @@ extern int dontprint; #define OP_TABLE(name) ops_ ## name -#define CLOCK_CYCLES(c) do { cycles -= (c); \ - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) \ - timer_process(); } while(0) -#define CLOCK_CYCLES_ALWAYS(c) do { cycles -= (c); \ - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) \ - timer_process(); } while(0) +#define CLOCK_CYCLES(c) cycles -= (c) +#define CLOCK_CYCLES_ALWAYS(c) cycles -= (c) #include "x86_ops.h" @@ -252,9 +248,9 @@ dontprint=0; if (!timetolive) fatal("Life expired\n"); } - } - + if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) timer_process(); + } } } diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index 91a9eeeeb..67594c786 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -710,12 +710,8 @@ void leave_smm() } #define OP_TABLE(name) ops_ ## name -#define CLOCK_CYCLES(c) do { cycles -= (c); \ - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) \ - timer_process(); } while(0) -#define CLOCK_CYCLES_ALWAYS(c) do { cycles -= (c); \ - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) \ - timer_process(); } while(0) +#define CLOCK_CYCLES(c) cycles -= (c) +#define CLOCK_CYCLES_ALWAYS(c) cycles -= (c) #include "386_ops.h" @@ -1138,10 +1134,10 @@ inrecomp=0; } } } + + if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) + timer_process(); } - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) - timer_process(); - cycles_main -= (cycles_start - cycles); } } diff --git a/src/cpu/386_dynarec_ops.c b/src/cpu/386_dynarec_ops.c index ade318301..7585a305b 100644 --- a/src/cpu/386_dynarec_ops.c +++ b/src/cpu/386_dynarec_ops.c @@ -65,7 +65,5 @@ static __inline void fetch_ea_16_long(uint32_t rmdat) #define OP_TABLE(name) dynarec_ops_ ## name #define CLOCK_CYCLES(c) -#define CLOCK_CYCLES_ALWAYS(c) do { cycles -= (c); \ - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) \ - timer_process(); } while(0) +#define CLOCK_CYCLES_ALWAYS(c) cycles -= (c) #include "386_ops.h" diff --git a/src/cpu_new/386.c b/src/cpu_new/386.c index f70424b10..2b2268920 100644 --- a/src/cpu_new/386.c +++ b/src/cpu_new/386.c @@ -175,12 +175,8 @@ fetch_ea_16_long(uint32_t rmdat) #define OP_TABLE(name) ops_ ## name -#define CLOCK_CYCLES(c) do { cycles -= (c); \ - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) \ - timer_process(); } while(0) -#define CLOCK_CYCLES_ALWAYS(c) do { cycles -= (c); \ - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) \ - timer_process(); } while(0) +#define CLOCK_CYCLES(c) cycles -= (c) +#define CLOCK_CYCLES_ALWAYS(c) cycles -= (c) #include "x86_ops.h" diff --git a/src/cpu_new/386_dynarec.c b/src/cpu_new/386_dynarec.c index 27d706061..0081aceb8 100644 --- a/src/cpu_new/386_dynarec.c +++ b/src/cpu_new/386_dynarec.c @@ -471,12 +471,8 @@ void leave_smm() } #define OP_TABLE(name) ops_ ## name -#define CLOCK_CYCLES(c) do { cycles -= (c); \ - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) \ - timer_process(); } while(0) -#define CLOCK_CYCLES_ALWAYS(c) do { cycles -= (c); \ - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) \ - timer_process(); } while(0) +#define CLOCK_CYCLES(c) cycles -= (c) +#define CLOCK_CYCLES_ALWAYS(c) cycles -= (c) #include "386_ops.h" diff --git a/src/cpu_new/386_dynarec_ops.c b/src/cpu_new/386_dynarec_ops.c index f5224c257..1996b5824 100644 --- a/src/cpu_new/386_dynarec_ops.c +++ b/src/cpu_new/386_dynarec_ops.c @@ -64,8 +64,6 @@ static inline void fetch_ea_16_long(uint32_t rmdat) #define OP_TABLE(name) dynarec_ops_ ## name /*Temporary*/ #define CLOCK_CYCLES(c) -#define CLOCK_CYCLES_ALWAYS(c) do { cycles -= (c); \ - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) \ - timer_process(); } while(0) +#define CLOCK_CYCLES_ALWAYS(c) cycles -= (c) #include "386_ops.h"