On 6/4/24 02:18, Paolo Bonzini wrote:
Use decode.c's support for intercepts, doing the check in TCG-generated
code rather than the helper. This is cleaner because it allows removing
the eip_addend argument to helper_pause(), even though it adds a bit of
bloat for opcode 0x90's new decoding function.
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
target/i386/helper.h | 2 +-
target/i386/tcg/helper-tcg.h | 1 -
target/i386/tcg/misc_helper.c | 10 +---------
target/i386/tcg/sysemu/misc_helper.c | 2 +-
target/i386/tcg/decode-new.c.inc | 15 ++++++++++++++-
target/i386/tcg/emit.c.inc | 20 ++++++++------------
6 files changed, 25 insertions(+), 25 deletions(-)
Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
+static void decode_90(DisasContext *s, CPUX86State *env, X86OpEntry *entry,
uint8_t *b)
+{
+ static X86OpEntry pause = X86_OP_ENTRY0(PAUSE, svm(PAUSE));
+ static X86OpEntry nop = X86_OP_ENTRY0(NOP);
+ static X86OpEntry xchg_ax = X86_OP_ENTRY2(XCHG, 0,v, LoBits,v);
+
+ if (REX_B(s)) {
+ *entry = xchg_ax;
+ } else {
+ *entry = (s->prefix & PREFIX_REPZ) ? pause : nop;
+ }
+}
Thanks. I had wished for this instead of
static void gen_XCHG(DisasContext *s, CPUX86State *env, X86DecodedInsn
*decode)
{
- if (decode->b == 0x90 && !REX_B(s)) {
- if (s->prefix & PREFIX_REPZ) {
- gen_update_cc_op(s);
- gen_update_eip_cur(s);
- gen_helper_pause(tcg_env, cur_insn_len_i32(s));
- s->base.is_jmp = DISAS_NORETURN;
- }
- /* No writeback. */
- decode->op[0].unit = X86_OP_SKIP;
- return;
- }
this from the beginning, but since it wasn't wrong, I didn't mention it.
r~