[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 22/29] tcg_i386_funcs: Add update_fp_status to TCGI386ModuleOps
From: |
Gerd Hoffmann |
Subject: |
[PATCH 22/29] tcg_i386_funcs: Add update_fp_status to TCGI386ModuleOps |
Date: |
Tue, 31 Aug 2021 14:15:38 +0200 |
Also add TCGI386ModuleOps struct, which works like TCGModuleOps
but for i386-specific functions.
Signed-off-by: Gerd Hoffmann <kraxel@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
- [PATCH 14/29] tcg_funcs:Add tcg_exec_{realizefn, unrealizefn} to TCGModuleOps, (continued)
- [PATCH 14/29] tcg_funcs:Add tcg_exec_{realizefn, unrealizefn} to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 13/29] tcg_funcs: Add tlb_plugin_lookup to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 15/29] tcg_funcs: Add tb_flush to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 17/29] tcg: drop tb_invalidate_phys_page_range(), Gerd Hoffmann, 2021/08/31
- [PATCH 16/29] tcg: use tb_page_addr_t for tb_invalidate_phys_range(), Gerd Hoffmann, 2021/08/31
- [PATCH 18/29] tcg_funcs: Add tb_invalidate_phys_range to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 19/29] tcg_funcs: Add tb_check_watchpoint to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 21/29] tcg_funcs: Add curr_cflags to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 20/29] tcg_funcs: Add cpu_restore_state to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 23/29] tcg_i386_funcs: Add update_mxcsr_status to TCGI386ModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 22/29] tcg_i386_funcs: Add update_fp_status to TCGI386ModuleOps,
Gerd Hoffmann <=
- [PATCH 24/29] tcg_i386_funcs: Add update_mxcsr_from_sse_status to TCGI386ModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 26/29] tcg_i386_funcs: Add cpu_set_ignne to TCGI386ModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 25/29] tcg_i386_funcs: Add x86_register_ferr_irq to TCGI386ModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 28/29] tcg_i386_funcs: Add cpu_cc_compute_all to TCGI386ModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 27/29] tcg_i386_funcs: Add cpu_x86_update_dr7 to TCGI386ModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 29/29] Revert "build: temporarily disable modular tcg", Gerd Hoffmann, 2021/08/31