From: Ilya Leoshkevich <iii@linux.ibm.com>
To: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Cc: fam@euphon.net, berrange@redhat.com, f4bug@amsat.org,
aurelien@aurel32.net, pbonzini@redhat.com, stefanha@redhat.com,
crosa@redhat.com,
Richard Henderson <richard.henderson@linaro.org>,
David Hildenbrand <david@redhat.com>,
Cornelia Huck <cohuck@redhat.com>, Thomas Huth <thuth@redhat.com>,
"open list:S390 TCG CPUs" <qemu-s390x@nongnu.org>
Subject: Re: [PATCH v3 25/26] target/s390x: fake instruction loading when handling 'ex'
Date: Fri, 21 Oct 2022 12:56:57 +0200 [thread overview]
Message-ID: <a7b39d519028801ccfb10898ad1ddcc47b02caef.camel@linux.ibm.com> (raw)
In-Reply-To: <20221020115209.1761864-26-alex.bennee@linaro.org>
On Thu, 2022-10-20 at 12:52 +0100, Alex Bennée wrote:
> 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.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Cc: Richard Henderson <richard.henderson@linaro.org>
>
> ---
> v2
> - s/w/b/ for translator_fake_ldb
> - add comment to extract_insn
> - reword commit message
> ---
> include/exec/translator.h | 17 +++++++++++++++++
> target/s390x/tcg/translate.c | 6 ++++++
> 2 files changed, 23 insertions(+)
>
> 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 95279e5dc3..8101f5f569 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);
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
next prev parent reply other threads:[~2022-10-21 11:08 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 11:51 [PATCH v3 00/26] testing/next (docker, avocado, s390x, MAINTAINERS) Alex Bennée
2022-10-20 11:51 ` [PATCH v3 01/26] tests/docker: update fedora-win[32|64]-cross with lcitool Alex Bennée
2022-10-20 22:07 ` Richard Henderson
2022-10-20 11:51 ` [PATCH v3 02/26] tests/docker: update test-mingw to run single build Alex Bennée
2022-10-20 11:51 ` [PATCH v3 03/26] tests/docker: Add flex/bison to `debian-all-test` Alex Bennée
2022-10-20 11:54 ` Thomas Huth
2022-10-20 11:51 ` [PATCH v3 04/26] configure: don't enable cross compilers unless in target_list Alex Bennée
2022-10-20 22:10 ` Richard Henderson
2023-01-02 13:24 ` Stefan Weil via
2023-01-02 20:50 ` Alex Bennée
2022-10-20 11:51 ` [PATCH v3 05/26] configure: fix the --enable-static --disable-pie case Alex Bennée
2022-10-20 22:09 ` Richard Henderson
2022-10-20 11:51 ` [PATCH v3 06/26] tests/avocado: extend the timeout for x86_64 tcg tests Alex Bennée
2022-10-20 13:05 ` Thomas Huth
2022-10-20 22:11 ` Richard Henderson
2022-10-20 11:51 ` [PATCH v3 07/26] tests/docker: Add flex/bison to `debian-hexagon-cross` Alex Bennée
2022-10-20 11:55 ` Thomas Huth
2022-10-20 11:51 ` [PATCH v3 08/26] tests/tcg: use regular semihosting for nios2-softmmu Alex Bennée
2022-10-20 22:12 ` Richard Henderson
2022-10-20 11:51 ` [PATCH v3 09/26] semihosting/arm-compat-semi: Avoid using hardcoded /tmp Alex Bennée
2022-10-20 15:53 ` Philippe Mathieu-Daudé
2022-10-20 22:13 ` Richard Henderson
2022-10-20 11:51 ` [PATCH v3 10/26] tcg: " Alex Bennée
2022-10-20 15:54 ` Philippe Mathieu-Daudé
2022-10-20 11:51 ` [PATCH v3 11/26] util/qemu-sockets: Use g_get_tmp_dir() to get the directory for temporary files Alex Bennée
2022-10-20 15:58 ` Philippe Mathieu-Daudé
2022-10-20 11:51 ` [PATCH v3 12/26] block/vvfat: Unify the mkdir() call Alex Bennée
2022-10-20 15:59 ` Philippe Mathieu-Daudé
2022-10-21 8:10 ` Kevin Wolf
2022-10-20 11:51 ` [PATCH v3 13/26] fsdev/virtfs-proxy-helper: Use g_mkdir() Alex Bennée
2022-10-20 15:59 ` Philippe Mathieu-Daudé
2022-10-25 13:37 ` Christian Schoenebeck
2022-10-20 11:51 ` [PATCH v3 14/26] hw/usb: dev-mtp: " Alex Bennée
2022-10-20 16:00 ` Philippe Mathieu-Daudé
2022-10-20 11:51 ` [PATCH v3 15/26] MAINTAINERS: add entries for the key build bits Alex Bennée
2022-10-20 16:01 ` Philippe Mathieu-Daudé
2022-10-27 16:02 ` Thomas Huth
2022-10-20 11:51 ` [PATCH v3 16/26] MAINTAINERS: add features_to_c.sh to gdbstub files Alex Bennée
2022-10-20 22:16 ` Richard Henderson
2022-10-24 13:06 ` Philippe Mathieu-Daudé
2022-10-20 11:52 ` [PATCH v3 17/26] MAINTAINERS: fix-up for check-tcg Makefile changes Alex Bennée
2022-10-20 16:02 ` Philippe Mathieu-Daudé
2022-10-20 22:16 ` Richard Henderson
2022-10-20 11:52 ` [PATCH v3 18/26] tests/avocado: set -machine none for userfwd and vnc tests Alex Bennée
2022-10-20 16:03 ` Philippe Mathieu-Daudé
2022-10-20 11:52 ` [PATCH v3 19/26] tests/avocado: raspi2_initrd: Wait for guest shutdown message before stopping Alex Bennée
2022-10-20 15:48 ` Philippe Mathieu-Daudé
2022-10-27 16:03 ` Thomas Huth
2022-10-20 11:52 ` [PATCH v3 20/26] tests/avocado: disable sh4 rd2 tests on Gitlab Alex Bennée
2022-10-20 15:49 ` Philippe Mathieu-Daudé
2022-10-20 15:56 ` Alex Bennée
2022-10-21 11:59 ` Alex Bennée
2022-10-20 11:52 ` [PATCH v3 21/26] tests/tcg: re-enable linux-test for sh4 Alex Bennée
2022-10-20 15:50 ` Philippe Mathieu-Daudé
2022-10-20 11:52 ` [PATCH v3 22/26] tests/tcg: re-enable threadcount " Alex Bennée
2022-10-20 16:03 ` Philippe Mathieu-Daudé
2022-10-20 11:52 ` [PATCH v3 23/26] target/s390x: don't use ld_code2 to probe next pc Alex Bennée
2022-10-20 12:06 ` Richard Henderson
2022-10-20 13:22 ` David Hildenbrand
2022-10-21 10:35 ` Ilya Leoshkevich
2022-10-20 11:52 ` [PATCH v3 24/26] target/s390x: don't probe next pc for EXecuted insns Alex Bennée
2022-10-20 12:06 ` Richard Henderson
2022-10-20 13:22 ` David Hildenbrand
2022-10-21 10:37 ` Ilya Leoshkevich
2022-10-20 11:52 ` [PATCH v3 25/26] target/s390x: fake instruction loading when handling 'ex' Alex Bennée
2022-10-20 12:06 ` Richard Henderson
2022-10-20 13:24 ` David Hildenbrand
2022-10-21 10:56 ` Ilya Leoshkevich [this message]
2022-10-20 11:52 ` [PATCH v3 26/26] tests/tcg: include CONFIG_PLUGIN in config-host.mak Alex Bennée
2022-10-27 16:11 ` Thomas Huth
2022-10-27 15:06 ` [PATCH v3 00/26] testing/next (docker, avocado, s390x, MAINTAINERS) Bin Meng
2022-10-27 17:16 ` Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a7b39d519028801ccfb10898ad1ddcc47b02caef.camel@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=alex.bennee@linaro.org \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=cohuck@redhat.com \
--cc=crosa@redhat.com \
--cc=david@redhat.com \
--cc=f4bug@amsat.org \
--cc=fam@euphon.net \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).