Also add TCGI386ModuleOps struct, which works like TCGModuleOps but for i386-specific functions.
Signed-off-by: Gerd Hoffmann <kra...@redhat.com> --- include/tcg/tcg-module-i386.h | 9 +++++++++ target/i386/cpu.h | 4 ++-- accel/tcg/tcg-module-i386.c | 10 ++++++++++ target/i386/machine.c | 2 +- target/i386/tcg/fpu_helper.c | 9 ++++++++- accel/tcg/meson.build | 6 ++++++ 6 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 include/tcg/tcg-module-i386.h create mode 100644 accel/tcg/tcg-module-i386.c diff --git a/include/tcg/tcg-module-i386.h b/include/tcg/tcg-module-i386.h new file mode 100644 index 000000000000..3854b506d5dc --- /dev/null +++ b/include/tcg/tcg-module-i386.h @@ -0,0 +1,9 @@ +#ifndef TCG_MODULE_I386_H +#define TCG_MODULE_I386_H + +struct TCGI386ModuleOps { + void (*update_fp_status)(CPUX86State *env); +}; +extern struct TCGI386ModuleOps tcg_i386; + +#endif /* TCG_MODULE_I386_H */ diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 6c50d3ab4f1d..5769c1292683 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1802,6 +1802,7 @@ struct X86CPU { int32_t hv_max_vps; }; +#include "tcg/tcg-module-i386.h" #ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_x86_cpu; @@ -2127,7 +2128,6 @@ static inline bool cpu_vmx_maybe_enabled(CPUX86State *env) int get_pg_mode(CPUX86State *env); /* fpu_helper.c */ -void update_fp_status(CPUX86State *env); void update_mxcsr_status(CPUX86State *env); void update_mxcsr_from_sse_status(CPUX86State *env); @@ -2143,7 +2143,7 @@ static inline void cpu_set_fpuc(CPUX86State *env, uint16_t fpuc) { env->fpuc = fpuc; if (tcg_enabled()) { - update_fp_status(env); + tcg_i386.update_fp_status(env); } } diff --git a/accel/tcg/tcg-module-i386.c b/accel/tcg/tcg-module-i386.c new file mode 100644 index 000000000000..41ce2ba4eb76 --- /dev/null +++ b/accel/tcg/tcg-module-i386.c @@ -0,0 +1,10 @@ +#include "qemu/osdep.h" +#include "cpu.h" + +static void i386_update_cpu_stub(CPUX86State *cpu) +{ +} + +struct TCGI386ModuleOps tcg_i386 = { + .update_fp_status = i386_update_cpu_stub, +}; diff --git a/target/i386/machine.c b/target/i386/machine.c index 571e98853c64..7f5d80766f28 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -371,7 +371,7 @@ static int cpu_post_load(void *opaque, int version_id) } if (tcg_enabled()) { target_ulong dr7; - update_fp_status(env); + tcg_i386.update_fp_status(env); update_mxcsr_status(env); cpu_breakpoint_remove_all(cs, BP_CPU); diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index eddf0bb9dfc4..0f7206e834fd 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -672,7 +672,7 @@ uint32_t helper_fnstcw(CPUX86State *env) return env->fpuc; } -void update_fp_status(CPUX86State *env) +static void update_fp_status(CPUX86State *env) { FloatRoundMode rnd_mode; FloatX80RoundPrec rnd_prec; @@ -3039,3 +3039,10 @@ void helper_movq(CPUX86State *env, void *d, void *s) #define SHIFT 1 #include "ops_sse.h" + +static void tcgi386_module_ops_fpu(void) +{ + tcg_i386.update_fp_status = update_fp_status; +} + +type_init(tcgi386_module_ops_fpu); diff --git a/accel/tcg/meson.build b/accel/tcg/meson.build index 93cbbf9f3926..7f1fdd68233b 100644 --- a/accel/tcg/meson.build +++ b/accel/tcg/meson.build @@ -1,6 +1,12 @@ specific_ss.add(files( 'tcg-module.c', )) +specific_ss.add(when: 'TARGET_I386', if_true: files( + 'tcg-module-i386.c', +)) +specific_ss.add(when: 'TARGET_X86_64', if_true: files( + 'tcg-module-i386.c', +)) specific_ss.add(when: 'CONFIG_TCG', if_true: files( 'cpu-exec-common.c', -- 2.31.1