[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 13/18] target/i386: split eflags computation out of gen_compute_e
From: |
Paolo Bonzini |
Subject: |
[PATCH 13/18] target/i386: split eflags computation out of gen_compute_eflags |
Date: |
Sat, 14 Oct 2023 12:01:15 +0200 |
The new x86 decoder wants to compute EFLAGS before writeback, which
can be an issue for some instructions such as ARPL. Extract code
to compute the EFLAGS without clobbering CC_SRC, in case the ARPL
memory write causes a fault.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/tcg/translate.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index e13bf7df591..2da7c357cdc 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -872,18 +872,20 @@ static void gen_op_update_neg_cc(DisasContext *s)
tcg_gen_movi_tl(s->cc_srcT, 0);
}
-/* compute all eflags to cc_src */
-static void gen_compute_eflags(DisasContext *s)
+/* compute all eflags to reg */
+static void gen_mov_eflags(DisasContext *s, TCGv reg)
{
TCGv zero, dst, src1, src2;
int live, dead;
if (s->cc_op == CC_OP_EFLAGS) {
+ if (reg != cpu_cc_src) {
+ tcg_gen_mov_tl(reg, cpu_cc_src);
+ }
return;
}
if (s->cc_op == CC_OP_CLR) {
- tcg_gen_movi_tl(cpu_cc_src, CC_Z | CC_P);
- set_cc_op(s, CC_OP_EFLAGS);
+ tcg_gen_movi_tl(reg, CC_Z | CC_P);
return;
}
@@ -909,7 +911,13 @@ static void gen_compute_eflags(DisasContext *s)
}
gen_update_cc_op(s);
- gen_helper_cc_compute_all(cpu_cc_src, dst, src1, src2, cpu_cc_op);
+ gen_helper_cc_compute_all(reg, dst, src1, src2, cpu_cc_op);
+}
+
+/* compute all eflags to cc_src */
+static void gen_compute_eflags(DisasContext *s)
+{
+ gen_mov_eflags(s, cpu_cc_src);
set_cc_op(s, CC_OP_EFLAGS);
}
--
2.41.0
- Re: [PATCH 04/18] tests/tcg/i386: initialize more registers in test-avx, (continued)
- [PATCH 06/18] target/i386: accept full MemOp in gen_ext_tl, Paolo Bonzini, 2023/10/14
- [PATCH 09/18] target/i386: do not clobber A0 in POP translation, Paolo Bonzini, 2023/10/14
- [PATCH 03/18] target/i386: implement SHA instructions, Paolo Bonzini, 2023/10/14
- [PATCH 10/18] target/i386: reintroduce debugging mechanism, Paolo Bonzini, 2023/10/14
- [PATCH 12/18] target/i386: adjust decoding of J operand, Paolo Bonzini, 2023/10/14
- [PATCH 13/18] target/i386: split eflags computation out of gen_compute_eflags,
Paolo Bonzini <=
- [PATCH 07/18] target/i386: introduce flags writeback mechanism, Paolo Bonzini, 2023/10/14
- [PATCH 08/18] target/i386: implement CMPccXADD, Paolo Bonzini, 2023/10/14
- [PATCH 14/18] target/i386: move 60-BF opcodes to new decoder, Paolo Bonzini, 2023/10/14
- [PATCH 16/18] target/i386: move remaining conditional operations to new decoder, Paolo Bonzini, 2023/10/14