[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 13/19] target/i386: split eflags computation out of gen_comput
|
From: |
Paolo Bonzini |
|
Subject: |
[PATCH v2 13/19] target/i386: split eflags computation out of gen_compute_eflags |
|
Date: |
Thu, 19 Oct 2023 12:46:42 +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 v2 03/19] target/i386: implement SHA instructions, (continued)
- [PATCH v2 06/19] target/i386: accept full MemOp in gen_ext_tl, Paolo Bonzini, 2023/10/19
- [PATCH v2 01/19] target/i386: group common checks in the decoding phase, Paolo Bonzini, 2023/10/19
- [PATCH v2 08/19] target/i386: implement CMPccXADD, Paolo Bonzini, 2023/10/19
- [PATCH v2 11/19] target/i386: move 00-5F opcodes to new decoder, Paolo Bonzini, 2023/10/19
- [PATCH v2 09/19] target/i386: do not clobber A0 in POP translation, Paolo Bonzini, 2023/10/19
- [PATCH v2 14/19] tcg: add negsetcondi, Paolo Bonzini, 2023/10/19
- [PATCH v2 07/19] target/i386: introduce flags writeback mechanism, Paolo Bonzini, 2023/10/19
- [PATCH v2 10/19] target/i386: reintroduce debugging mechanism, Paolo Bonzini, 2023/10/19
- [PATCH v2 13/19] target/i386: split eflags computation out of gen_compute_eflags,
Paolo Bonzini <=
- [PATCH v2 12/19] target/i386: adjust decoding of J operand, Paolo Bonzini, 2023/10/19
- [PATCH v2 16/19] target/i386: move operand load and writeback out of gen_cmovcc1, Paolo Bonzini, 2023/10/19
- [PATCH v2 15/19] target/i386: move 60-BF opcodes to new decoder, Paolo Bonzini, 2023/10/19
- [PATCH v2 17/19] target/i386: move remaining conditional operations to new decoder, Paolo Bonzini, 2023/10/19
- [PATCH v2 19/19] target/i386: remove gen_op, Paolo Bonzini, 2023/10/19
- [PATCH v2 18/19] target/i386: remove now converted opcodes from old decoder, Paolo Bonzini, 2023/10/19
- Re: [PATCH v2 00/19] target/i386: decoder changes for 8.2, Paolo Bonzini, 2023/10/19
- Re: [PATCH v2 00/19] target/i386: decoder changes for 8.2, Richard Henderson, 2023/10/19