[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 33/34] accel/tcg: Make translator.c (partially) target indepe
|
From: |
Anton Johansson |
|
Subject: |
[RFC PATCH 33/34] accel/tcg: Make translator.c (partially) target independent |
|
Date: |
Fri, 19 Jan 2024 15:40:23 +0100 |
Make CPUState offset calculations target independent by using that
CPUState and CPUArchState are statically guaranteed to lie next to each
other in memory.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
accel/tcg/translator.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
index 65219b52eb..43303577d7 100644
--- a/accel/tcg/translator.c
+++ b/accel/tcg/translator.c
@@ -19,8 +19,8 @@
static void gen_io_start(void)
{
tcg_gen_st_i32(tcg_constant_i32(1), tcg_env,
- offsetof(ArchCPU, parent_obj.neg.can_do_io) -
- offsetof(ArchCPU, env));
+ offsetof(CPUState, neg.can_do_io) -
+ sizeof(CPUState));
}
bool translator_io_start(DisasContextBase *db)
@@ -53,8 +53,8 @@ static TCGOp *gen_tb_start(uint32_t cflags)
TCGOp *icount_start_insn = NULL;
tcg_gen_ld_i32(count, tcg_env,
- offsetof(ArchCPU, parent_obj.neg.icount_decr.u32)
- - offsetof(ArchCPU, env));
+ offsetof(CPUState, neg.icount_decr.u32) -
+ sizeof(CPUState));
if (cflags & CF_USE_ICOUNT) {
/*
@@ -82,8 +82,8 @@ static TCGOp *gen_tb_start(uint32_t cflags)
if (cflags & CF_USE_ICOUNT) {
tcg_gen_st16_i32(count, tcg_env,
- offsetof(ArchCPU, parent_obj.neg.icount_decr.u16.low)
- - offsetof(ArchCPU, env));
+ offsetof(CPUState, neg.icount_decr.u16.low) -
+ sizeof(CPUState));
/*
* cpu->can_do_io is cleared automatically here at the beginning of
* each translation block. The cost is minimal and only paid for
@@ -92,8 +92,8 @@ static TCGOp *gen_tb_start(uint32_t cflags)
* go with gen_io_start().
*/
tcg_gen_st_i32(tcg_constant_i32(0), tcg_env,
- offsetof(ArchCPU, parent_obj.neg.can_do_io) -
- offsetof(ArchCPU, env));
+ offsetof(CPUState, neg.can_do_io) -
+ sizeof(CPUState));
}
return icount_start_insn;
--
2.43.0
- [RFC PATCH 22/34] accel/tcg: [CPUTLB] Move CPU_TLB_DYN_[DEFAULT|MIN]* to cputlb.c, (continued)
- [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, 2024/01/19
- [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 <=
- [RFC PATCH 32/34] accel/tcg: Make tcg-runtime.c target independent, Anton Johansson, 2024/01/19
- [RFC PATCH 30/34] accel/tcg: Make tcg-all.c target indpendent, Anton Johansson, 2024/01/19
- [RFC PATCH 31/34] accel/tcg: Make tcg-runtime-gvec.c target independent, Anton Johansson, 2024/01/19