[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 26/31] target/s390x: fake instruction loading when handling 'ex'
From: |
Alex Bennée |
Subject: |
[PULL 26/31] target/s390x: fake instruction loading when handling 'ex' |
Date: |
Mon, 31 Oct 2022 13:10:05 +0000 |
The s390x EXecute instruction is a bit weird as we synthesis the
executed instruction from what we have stored in memory. This missed
the plugin instrumentation.
Work around this with a special helper to inform the rest of the
translator about the instruction so things stay consistent.
Reviewed-by: David Hildenbrand <david@redhat.com>
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20221027183637.2772968-26-alex.bennee@linaro.org>
diff --git a/include/exec/translator.h b/include/exec/translator.h
index 3b77f5f4aa..af2ff95cd5 100644
--- a/include/exec/translator.h
+++ b/include/exec/translator.h
@@ -211,6 +211,23 @@ translator_ldq_swap(CPUArchState *env, DisasContextBase
*db,
return ret;
}
+/**
+ * translator_fake_ldb - fake instruction load
+ * @insn8: byte of instruction
+ * @pc: program counter of instruction
+ *
+ * This is a special case helper used where the instruction we are
+ * about to translate comes from somewhere else (e.g. being
+ * re-synthesised for s390x "ex"). It ensures we update other areas of
+ * the translator with details of the executed instruction.
+ */
+
+static inline void translator_fake_ldb(uint8_t insn8, abi_ptr pc)
+{
+ plugin_insn_append(pc, &insn8, sizeof(insn8));
+}
+
+
/*
* Return whether addr is on the same page as where disassembly started.
* Translators can use this to enforce the rule that only single-insn
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index f4122db434..03efccdf9f 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -6317,12 +6317,18 @@ static const DisasInsn *extract_insn(CPUS390XState
*env, DisasContext *s)
if (unlikely(s->ex_value)) {
/* Drop the EX data now, so that it's clear on exception paths. */
TCGv_i64 zero = tcg_const_i64(0);
+ int i;
tcg_gen_st_i64(zero, cpu_env, offsetof(CPUS390XState, ex_value));
tcg_temp_free_i64(zero);
/* Extract the values saved by EXECUTE. */
insn = s->ex_value & 0xffffffffffff0000ull;
ilen = s->ex_value & 0xf;
+ /* register insn bytes with translator so plugins work */
+ for (i = 0; i < ilen; i++) {
+ uint8_t byte = extract64(insn, 56 - (i * 8), 8);
+ translator_fake_ldb(byte, pc + i);
+ }
op = insn >> 56;
} else {
insn = ld_code2(env, s, pc);
--
2.34.1
- [PULL 13/31] tcg: Avoid using hardcoded /tmp, (continued)
- [PULL 13/31] tcg: Avoid using hardcoded /tmp, Alex Bennée, 2022/10/31
- [PULL 12/31] semihosting/arm-compat-semi: Avoid using hardcoded /tmp, Alex Bennée, 2022/10/31
- [PULL 09/31] tests/docker: Add flex/bison to `debian-hexagon-cross`, Alex Bennée, 2022/10/31
- [PULL 15/31] hw/usb: dev-mtp: Use g_mkdir(), Alex Bennée, 2022/10/31
- [PULL 11/31] tests/tcg/nios2: Tweak 10m50-ghrd.ld, Alex Bennée, 2022/10/31
- [PULL 14/31] block/vvfat: Unify the mkdir() call, Alex Bennée, 2022/10/31
- [PULL 01/31] tests/lcitool: Rename non-Debian specific helper, Alex Bennée, 2022/10/31
- [PULL 05/31] tests/docker: Add flex/bison to `debian-all-test`, Alex Bennée, 2022/10/31
- [PULL 02/31] tests/lcitool: Refresh to latest libvirt-ci module, Alex Bennée, 2022/10/31
- [PULL 08/31] tests/avocado: extend the timeout for x86_64 tcg tests, Alex Bennée, 2022/10/31
- [PULL 26/31] target/s390x: fake instruction loading when handling 'ex',
Alex Bennée <=
- [PULL 25/31] target/s390x: don't probe next pc for EXecuted insns, Alex Bennée, 2022/10/31
- [PULL 28/31] contrib/plugins: enable debug on CONFIG_DEBUG_TCG, Alex Bennée, 2022/10/31
- [PULL 19/31] tests/avocado: set -machine none for userfwd and vnc tests, Alex Bennée, 2022/10/31
- [PULL 17/31] MAINTAINERS: add features_to_c.sh to gdbstub files, Alex Bennée, 2022/10/31
- [PULL 30/31] tests/unit: cleanups for test-io-channel-command, Alex Bennée, 2022/10/31
- [PULL 24/31] target/s390x: don't use ld_code2 to probe next pc, Alex Bennée, 2022/10/31
- [PULL 20/31] tests/avocado: raspi2_initrd: Wait for guest shutdown message before stopping, Alex Bennée, 2022/10/31
- [PULL 21/31] tests/avocado: disable sh4 rd2 tests on Gitlab, Alex Bennée, 2022/10/31
- [PULL 23/31] tests/tcg: re-enable threadcount for sh4, Alex Bennée, 2022/10/31
- [PULL 31/31] tests/vm: use -o IdentitiesOnly=yes for ssh, Alex Bennée, 2022/10/31