[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 28/34] accel/tcg: Make plugin-gen.c target independent
From: |
Anton Johansson |
Subject: |
[RFC PATCH 28/34] accel/tcg: Make plugin-gen.c target independent |
Date: |
Fri, 19 Jan 2024 15:40:18 +0100 |
Switches computation of offsets into CPUState to use that the offset
between CPUState and CPUArchState is guaranteed to be sizeof(CPUState).
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
accel/tcg/plugin-gen.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c
index d31c9993ea..ce7635958f 100644
--- a/accel/tcg/plugin-gen.c
+++ b/accel/tcg/plugin-gen.c
@@ -43,10 +43,9 @@
* CPU's index into a TCG temp, since the first callback did it already.
*/
#include "qemu/osdep.h"
-#include "cpu.h"
#include "tcg/tcg.h"
#include "tcg/tcg-temp-internal.h"
-#include "tcg/tcg-op.h"
+#include "tcg/tcg-op-common.h"
#include "exec/exec-all.h"
#include "exec/plugin-gen.h"
#include "exec/translator.h"
@@ -104,8 +103,8 @@ static void gen_empty_udata_cb(void)
TCGv_ptr udata = tcg_temp_ebb_new_ptr();
tcg_gen_movi_ptr(udata, 0);
- tcg_gen_ld_i32(cpu_index, tcg_env,
- -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index));
+ tcg_gen_ld_i32(cpu_index, tcg_env, offsetof(CPUState, cpu_index) -
+ sizeof(CPUState));
gen_helper_plugin_vcpu_udata_cb(cpu_index, udata);
tcg_temp_free_ptr(udata);
@@ -138,8 +137,8 @@ static void gen_empty_mem_cb(TCGv_i64 addr, uint32_t info)
tcg_gen_movi_i32(meminfo, info);
tcg_gen_movi_ptr(udata, 0);
- tcg_gen_ld_i32(cpu_index, tcg_env,
- -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index));
+ tcg_gen_ld_i32(cpu_index, tcg_env, offsetof(CPUState, cpu_index) -
+ sizeof(CPUState));
gen_helper_plugin_vcpu_mem_cb(cpu_index, meminfo, addr, udata);
@@ -158,7 +157,7 @@ static void gen_empty_mem_helper(void)
tcg_gen_movi_ptr(ptr, 0);
tcg_gen_st_ptr(ptr, tcg_env, offsetof(CPUState, plugin_mem_cbs) -
- offsetof(ArchCPU, env));
+ sizeof(CPUState));
tcg_temp_free_ptr(ptr);
}
@@ -582,7 +581,7 @@ void plugin_gen_disable_mem_helpers(void)
return;
}
tcg_gen_st_ptr(tcg_constant_ptr(NULL), tcg_env,
- offsetof(CPUState, plugin_mem_cbs) - offsetof(ArchCPU,
env));
+ offsetof(CPUState, plugin_mem_cbs) - sizeof(CPUState));
}
static void plugin_gen_tb_udata(const struct qemu_plugin_tb *ptb,
--
2.43.0
- Re: [RFC PATCH 20/34] accel/tcg: [CPUTLB] Use TCGContext.guest_mo for memory ordering, (continued)
- [RFC PATCH 19/34] accel/tcg: [CPUTLB] Use TCGContext.addr_type instead of TARGET_LONG_BITS, Anton Johansson, 2024/01/19
- [RFC PATCH 23/34] tcg: [CPUTLB] Add `mo_te` field to TCGContext, Anton Johansson, 2024/01/19
- [RFC PATCH 21/34] accel/tcg: [CPUTLB] Use tcg_ctx->tlb_dyn_max_bits, Anton Johansson, 2024/01/19
- [RFC PATCH 22/34] accel/tcg: [CPUTLB] Move CPU_TLB_DYN_[DEFAULT|MIN]* to cputlb.c, Anton Johansson, 2024/01/19
- [RFC PATCH 25/34] accel/tcg: [CPUTLB] Use tcg_ctx->mo_te instead of MO_TE, Anton Johansson, 2024/01/19
- [RFC PATCH 28/34] accel/tcg: Make plugin-gen.c target independent,
Anton Johansson <=
- [RFC PATCH 27/34] accel/tcg: Make translate-all.c target independent, Anton Johansson, 2024/01/19
- [RFC PATCH 29/34] accel/tcg: Make tb-maint.c target indpendent, Anton Johansson, 2024/01/19
- [RFC PATCH 34/34] accel/tcg: Compile (a few files) once for system-mode, Anton Johansson, 2024/01/19
- [RFC PATCH 33/34] accel/tcg: Make translator.c (partially) target independent, Anton Johansson, 2024/01/19
- [RFC PATCH 32/34] accel/tcg: Make tcg-runtime.c target independent, Anton Johansson, 2024/01/19