[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/43] gen-icount: Use tcg_set_insn_param
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 16/43] gen-icount: Use tcg_set_insn_param |
Date: |
Thu, 12 May 2016 14:32:38 +0100 |
From: "Edgar E. Iglesias" <address@hidden>
Use tcg_set_insn_param() instead of directly accessing internal
tcg data structures to update an insn param.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Edgar E. Iglesias <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
include/exec/gen-icount.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h
index 05d89d3..a011324 100644
--- a/include/exec/gen-icount.h
+++ b/include/exec/gen-icount.h
@@ -5,14 +5,13 @@
/* Helpers for instruction counting code generation. */
-static TCGArg *icount_arg;
+static int icount_start_insn_idx;
static TCGLabel *icount_label;
static TCGLabel *exitreq_label;
static inline void gen_tb_start(TranslationBlock *tb)
{
TCGv_i32 count, flag, imm;
- int i;
exitreq_label = gen_new_label();
flag = tcg_temp_new_i32();
@@ -31,13 +30,12 @@ static inline void gen_tb_start(TranslationBlock *tb)
-ENV_OFFSET + offsetof(CPUState, icount_decr.u32));
imm = tcg_temp_new_i32();
+ /* We emit a movi with a dummy immediate argument. Keep the insn index
+ * of the movi so that we later (when we know the actual insn count)
+ * can update the immediate argument with the actual insn count. */
+ icount_start_insn_idx = tcg_op_buf_count();
tcg_gen_movi_i32(imm, 0xdeadbeef);
- /* This is a horrid hack to allow fixing up the value later. */
- i = tcg_ctx.gen_last_op_idx;
- i = tcg_ctx.gen_op_buf[i].args;
- icount_arg = &tcg_ctx.gen_opparam_buf[i + 1];
-
tcg_gen_sub_i32(count, count, imm);
tcg_temp_free_i32(imm);
@@ -53,7 +51,9 @@ static void gen_tb_end(TranslationBlock *tb, int num_insns)
tcg_gen_exit_tb((uintptr_t)tb + TB_EXIT_REQUESTED);
if (tb->cflags & CF_USE_ICOUNT) {
- *icount_arg = num_insns;
+ /* Update the num_insn immediate parameter now that we know
+ * the actual insn count. */
+ tcg_set_insn_param(icount_start_insn_idx, 1, num_insns);
gen_set_label(icount_label);
tcg_gen_exit_tb((uintptr_t)tb + TB_EXIT_ICOUNT_EXPIRED);
}
--
1.9.1
- [Qemu-devel] [PULL 31/43] i.MX: Add sabrelite i.MX6 emulation., (continued)
- [Qemu-devel] [PULL 31/43] i.MX: Add sabrelite i.MX6 emulation., Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 20/43] hw/display: QOM'ify exynos4210_fimd.c, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 08/43] hw/intc: QOM'ify slavio_intctl.c, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 14/43] target-arm: Fix descriptor address masking in ARM address translation, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 24/43] ACPI: move acpi_build_srat_memory to common place, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 04/43] hw/intc: QOM'ify exynos4210_combiner.c, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 29/43] i.MX: Add the Freescale SPI Controller, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 27/43] i.MX: Add i.MX6 System Reset Controller device., Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 35/43] hw/arm: QOM'ify armv7m.c, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 22/43] ACPI: Add GICC Affinity Structure, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 16/43] gen-icount: Use tcg_set_insn_param,
Peter Maydell <=
- [Qemu-devel] [PULL 28/43] FIFO: Add a FIFO32 implementation, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 32/43] hw/display/blizzard: Expand out macros, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 25/43] ACPI: Virt: Generate SRAT table, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 37/43] hw/arm: QOM'ify integratorcp.c, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 03/43] hw/intc: QOM'ify etraxfs_pic.c, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 39/43] hw/arm: QOM'ify pxa2xx_pic.c, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 33/43] hw/display/blizzard: Remove blizzard_template.h, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 38/43] hw/arm: QOM'ify pxa2xx.c, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 10/43] hw/intc: QOM'ify omap_intc.c, Peter Maydell, 2016/05/12
- [Qemu-devel] [PULL 34/43] target-arm: Avoid unnecessary TLB flush on TCR_EL2, TCR_EL3 writes, Peter Maydell, 2016/05/12