From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexander Graf <agraf@suse.de>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, rth@twiddle.net,
Aurelien Jarno <aurelien@aurel32.net>,
aurel@aurel32.net
Subject: Re: [Qemu-devel] [PULL 24/34] target-s390x: implement TRANSLATE AND TEST instruction
Date: Sat, 20 Jun 2015 23:06:07 +0200 [thread overview]
Message-ID: <5585D5BF.8020408@redhat.com> (raw)
In-Reply-To: <1433461324-23584-25-git-send-email-agraf@suse.de>
On 05/06/2015 01:41, Alexander Graf wrote:
> From: Aurelien Jarno <aurelien@aurel32.net>
>
> It is part of the basic zArchitecture instructions. Allow it to be call
> from EXECUTE.
>
> Reviewed-by: Richard Henderson <rth@twiddle.net>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
> target-s390x/helper.h | 1 +
> target-s390x/insn-data.def | 2 ++
> target-s390x/mem_helper.c | 24 ++++++++++++++++++++++++
> target-s390x/translate.c | 10 ++++++++++
> 4 files changed, 37 insertions(+)
>
> diff --git a/target-s390x/helper.h b/target-s390x/helper.h
> index cb0b421..48b015e 100644
> --- a/target-s390x/helper.h
> +++ b/target-s390x/helper.h
> @@ -77,6 +77,7 @@ DEF_HELPER_FLAGS_3(sqxb, TCG_CALL_NO_WG, i64, env, i64, i64)
> DEF_HELPER_FLAGS_1(cvd, TCG_CALL_NO_RWG_SE, i64, s32)
> DEF_HELPER_FLAGS_4(unpk, TCG_CALL_NO_WG, void, env, i32, i64, i64)
> DEF_HELPER_FLAGS_4(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64)
> +DEF_HELPER_4(trt, i32, env, i32, i64, i64)
> DEF_HELPER_4(cksm, i64, env, i64, i64, i64)
> DEF_HELPER_FLAGS_5(calc_cc, TCG_CALL_NO_RWG_SE, i32, env, i32, i64, i64, i64)
> DEF_HELPER_FLAGS_2(sfpc, TCG_CALL_NO_RWG, void, env, i64)
> diff --git a/target-s390x/insn-data.def b/target-s390x/insn-data.def
> index a12939d..e401754 100644
> --- a/target-s390x/insn-data.def
> +++ b/target-s390x/insn-data.def
> @@ -759,6 +759,8 @@
>
> /* TRANSLATE */
> C(0xdc00, TR, SS_a, Z, la1, a2, 0, 0, tr, 0)
> +/* TRANSLATE AND TEST */
> + C(0xdd00, TRT, SS_a, Z, la1, a2, 0, 0, trt, 0)
>
> /* UNPACK */
> /* Really format SS_b, but we pack both lengths into one argument
> diff --git a/target-s390x/mem_helper.c b/target-s390x/mem_helper.c
> index 0e8cd0f..e19e1aa 100644
> --- a/target-s390x/mem_helper.c
> +++ b/target-s390x/mem_helper.c
> @@ -509,6 +509,9 @@ uint32_t HELPER(ex)(CPUS390XState *env, uint32_t cc, uint64_t v1,
> case 0xc00:
> helper_tr(env, l, get_address(env, 0, b1, d1),
> get_address(env, 0, b2, d2));
Missing break here.
Paolo
> + case 0xd00:
> + cc = helper_trt(env, l, get_address(env, 0, b1, d1),
> + get_address(env, 0, b2, d2));
> break;
> default:
> goto abort;
> @@ -801,6 +804,27 @@ void HELPER(tr)(CPUS390XState *env, uint32_t len, uint64_t array,
> }
> }
>
> +uint32_t HELPER(trt)(CPUS390XState *env, uint32_t len, uint64_t array,
> + uint64_t trans)
> +{
> + uint32_t cc = 0;
> + int i;
> +
> + for (i = 0; i <= len; i++) {
> + uint8_t byte = cpu_ldub_data(env, array + i);
> + uint8_t sbyte = cpu_ldub_data(env, trans + byte);
> +
> + if (sbyte != 0) {
> + env->regs[1] = array + i;
> + env->regs[2] = (env->regs[2] & ~0xff) | sbyte;
> + cc = (i == len) ? 2 : 1;
> + break;
> + }
> + }
> +
> + return cc;
> +}
> +
> #if !defined(CONFIG_USER_ONLY)
> void HELPER(lctlg)(CPUS390XState *env, uint32_t r1, uint64_t a2, uint32_t r3)
> {
> diff --git a/target-s390x/translate.c b/target-s390x/translate.c
> index b0dbfe8..003598d 100644
> --- a/target-s390x/translate.c
> +++ b/target-s390x/translate.c
> @@ -3787,6 +3787,16 @@ static ExitStatus op_tr(DisasContext *s, DisasOps *o)
> return NO_EXIT;
> }
>
> +static ExitStatus op_trt(DisasContext *s, DisasOps *o)
> +{
> + TCGv_i32 l = tcg_const_i32(get_field(s->fields, l1));
> + potential_page_fault(s);
> + gen_helper_trt(cc_op, cpu_env, l, o->addr1, o->in2);
> + tcg_temp_free_i32(l);
> + set_cc_static(s);
> + return NO_EXIT;
> +}
> +
> static ExitStatus op_unpk(DisasContext *s, DisasOps *o)
> {
> TCGv_i32 l = tcg_const_i32(get_field(s->fields, l1));
>
next prev parent reply other threads:[~2015-06-20 21:06 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-04 23:41 [Qemu-devel] [PULL 00/34] s390 patch queue 2015-06-05 Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 01/34] target-s390x: fix CC computation for EX instruction Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 02/34] target-s390x: fix CC computation for LOAD POSITIVE instructions Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 03/34] target-s390x: optimize (negative-) abs computation Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 04/34] target-s390x: remove unused helpers Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 05/34] target-s390x: add a tod2time function Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 06/34] target-s390x: simplify SCKC helper Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 07/34] target-s390x: streamline STCK helper Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 08/34] target-s390x: implement STCKC helper Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 09/34] target-s390x: implement STPT helper Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 10/34] target-s390x: fix LOAD MULTIPLE instruction on page boundary Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 11/34] target-s390x: fix PSW value on dynamical exception from helpers Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 12/34] target-s390x: fix MMU index computation Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 13/34] target-s390x: define default NaN values Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 14/34] target-s390x: silence NaNs for LOAD LENGTHENED and LOAD ROUNDED Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 15/34] target-s390x: detect tininess before rounding for FP operations Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 16/34] target-s390x: move a few instructions to the correct facility Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 17/34] target-s390x: implement LAY and LAEY instructions Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 18/34] target-s390x: fix exception for invalid operation code Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 19/34] target-s390x: fix CLGIT instruction Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 20/34] target-s390x: change CHRL and CGHRL format to RIL-b Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 21/34] target-s390x: move STORE CLOCK FAST to the correct facility Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 22/34] target-s390x: move SET DFP ROUNDING MODE " Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 23/34] target-s390x: implement LOAD FP INTEGER instructions Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 24/34] target-s390x: implement TRANSLATE AND TEST instruction Alexander Graf
2015-06-20 21:06 ` Paolo Bonzini [this message]
2015-06-21 14:24 ` Aurelien Jarno
2015-06-04 23:41 ` [Qemu-devel] [PULL 25/34] target-s390x: implement TRANSLATE EXTENDED instruction Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 26/34] target-s390x: implement LPDFR and LNDFR instructions Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 27/34] target-s390x: implement miscellaneous-instruction-extensions facility Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 28/34] target-s390x: implement load-and-trap facility Alexander Graf
2015-06-04 23:41 ` [Qemu-devel] [PULL 29/34] target-s390x: implement high-word facility Alexander Graf
2015-06-04 23:42 ` [Qemu-devel] [PULL 30/34] target-s390x: add a cpu_mmu_idx_to_asc function Alexander Graf
2015-06-04 23:42 ` [Qemu-devel] [PULL 31/34] target-s390x: support non current ASC in s390_cpu_handle_mmu_fault Alexander Graf
2015-06-04 23:42 ` [Qemu-devel] [PULL 32/34] target-s390x: use softmmu functions for mvcp/mvcs Alexander Graf
2015-06-04 23:42 ` [Qemu-devel] [PULL 33/34] target-s390x: fix MVC instruction when areas overlap Alexander Graf
2015-06-04 23:42 ` [Qemu-devel] [PULL 34/34] target-s390x: Only access allocated storage keys Alexander Graf
2015-06-05 12:01 ` [Qemu-devel] [PULL 00/34] s390 patch queue 2015-06-05 Peter Maydell
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=5585D5BF.8020408@redhat.com \
--to=pbonzini@redhat.com \
--cc=agraf@suse.de \
--cc=aurel@aurel32.net \
--cc=aurelien@aurel32.net \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).