qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Bischoff <ebischoff@suse.com>
To: Richard Henderson <rth@twiddle.net>, Alexander Graf <agraf@suse.de>
Cc: Michal Marek <mmarek@suse.cz>, Miroslav Benes <mbenes@suse.cz>,
	QEmu developers <qemu-devel@nongnu.org>,
	Eric Bischoff <ebischoff@nerim.net>
Subject: [Qemu-devel] [PATCH] Adding support for LPD and LPDG instructions
Date: Tue, 28 Feb 2017 12:35:35 +0100	[thread overview]
Message-ID: <20170228113535.7099-2-ebischoff@suse.com> (raw)
In-Reply-To: <20170228113535.7099-1-ebischoff@suse.com>

From: Eric Bischoff <ebischoff@nerim.net>

LPD = LOAD PAIR DISJOINT
Third patch
---
 target/s390x/insn-data.def |  4 ++-
 target/s390x/translate.c   | 63 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index 075ff59..72d1017 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -504,7 +504,9 @@
     C(0xb9e2, LOCGR,   RRF_c, LOC, r1, r2, r1, 0, loc, 0)
     C(0xebf2, LOC,     RSY_b, LOC, r1, m2_32u, new, r1_32, loc, 0)
     C(0xebe2, LOCG,    RSY_b, LOC, r1, m2_64, r1, 0, loc, 0)
-/* LOAD PAIR DISJOINT TODO */
+/* LOAD PAIR DISJOINT */
+    C(0xc804, LPD,     SSF,   ILA, 0, 0, 0, r3_P32, lpd32, 0)
+    C(0xc805, LPDG,    SSF,   ILA, 0, 0, 0, r3_P64, lpd64, 0)
 /* LOAD POSITIVE */
     C(0x1000, LPR,     RR_a,  Z,   0, r2_32s, new, r1_32, abs, abs32)
     C(0xb900, LPGR,    RRE,   Z,   0, r2, r1, 0, abs, abs64)
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index 01c6217..28a53ec 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -2558,6 +2558,7 @@ static ExitStatus op_lctlg(DisasContext *s, DisasOps *o)
     tcg_temp_free_i32(r3);
     return NO_EXIT;
 }
+
 static ExitStatus op_lra(DisasContext *s, DisasOps *o)
 {
     check_privileged(s);
@@ -2750,6 +2751,52 @@ static ExitStatus op_lm64(DisasContext *s, DisasOps *o)
     return NO_EXIT;
 }
 
+static ExitStatus op_lpd32(DisasContext *s, DisasOps *o)
+{
+    TCGv_i64 a1, a2;
+
+    /* In a parallel context, stop the world and single step.  */
+      if (parallel_cpus) {
+           potential_page_fault(s);
+           gen_helper_exit_atomic(cpu_env);
+           return EXIT_NORETURN;
+      }
+
+    /* In a serial context, perform the two loads and indicate
+       that we performed them while interlocked.  */
+    a1 = get_address(s, 0, get_field(s->fields, b1), get_field(s->fields, d1));
+    a2 = get_address(s, 0, get_field(s->fields, b2), get_field(s->fields, d2));
+    o->out = tcg_temp_new_i64();
+    tcg_gen_qemu_ld32s(o->out, a1, get_mem_index(s));
+    o->out2 = tcg_temp_new_i64();
+    tcg_gen_qemu_ld32s(o->out2, a2, get_mem_index(s));
+    gen_op_movi_cc(s, 0);
+    return NO_EXIT;
+}
+
+static ExitStatus op_lpd64(DisasContext *s, DisasOps *o)
+{
+    TCGv_i64 a1, a2;
+
+    /* In a parallel context, stop the world and single step.  */
+    if (parallel_cpus) {
+         potential_page_fault(s);
+         gen_helper_exit_atomic(cpu_env);
+         return EXIT_NORETURN;
+    }
+
+    /* In a serial context, perform the two loads and indicate
+       that we performed them while interlocked.  */
+    a1 = get_address(s, 0, get_field(s->fields, b1), get_field(s->fields, d1));
+    a2 = get_address(s, 0, get_field(s->fields, b2), get_field(s->fields, d2));
+    o->out = tcg_temp_new_i64();
+    tcg_gen_qemu_ld64(o->out, a1, get_mem_index(s));
+    o->out2 = tcg_temp_new_i64();
+    tcg_gen_qemu_ld64(o->out2, a2, get_mem_index(s));
+    gen_op_movi_cc(s, 0);
+    return NO_EXIT;
+}
+
 #ifndef CONFIG_USER_ONLY
 static ExitStatus op_lura(DisasContext *s, DisasOps *o)
 {
@@ -4420,6 +4467,22 @@ static void wout_r1_D32(DisasContext *s, DisasFields *f, DisasOps *o)
 }
 #define SPEC_wout_r1_D32 SPEC_r1_even
 
+static void wout_r3_P32(DisasContext *s, DisasFields *f, DisasOps *o)
+{
+    int r3 = get_field(f, r3);
+    store_reg32_i64(r3, o->out);
+    store_reg32_i64(r3 + 1, o->out2);
+}
+#define SPEC_wout_r3_P32 SPEC_r3_even
+
+static void wout_r3_P64(DisasContext *s, DisasFields *f, DisasOps *o)
+{
+    int r3 = get_field(f, r3);
+    store_reg(r3, o->out);
+    store_reg(r3 + 1, o->out2);
+}
+#define SPEC_wout_r3_P64 SPEC_r3_even
+
 static void wout_e1(DisasContext *s, DisasFields *f, DisasOps *o)
 {
     store_freg32_i64(get_field(f, r1), o->out);
-- 
2.10.2

  reply	other threads:[~2017-02-28 11:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 11:35 [Qemu-devel] [PATCHv3] Adding support for LPD and LPDG instructions Eric Bischoff
2017-02-28 11:35 ` Eric Bischoff [this message]
2017-02-28 11:42   ` [Qemu-devel] [PATCH] " no-reply
  -- strict thread matches above, loose matches on Subject: below --
2017-02-28 12:01 Eric Bischoff
2017-02-28 17:57 ` Richard Henderson
2017-02-28 23:10 ` Richard Henderson
2017-02-27 11:22 [Qemu-devel] [PATCH v2] " Eric Bischoff
2017-02-27 11:22 ` [Qemu-devel] [PATCH] " Eric Bischoff
2017-02-27 19:10   ` Richard Henderson
2017-02-28  8:58     ` Éric Bischoff
     [not found] <20170223115805.16688-1-ebischoff@suse.com>
     [not found] ` <20170223115805.16688-2-ebischoff@suse.com>
     [not found]   ` <a26cf735-bbb6-5be7-7575-198ec55a3ecc@twiddle.net>
2017-02-26 16:10     ` Éric Bischoff
2017-02-27 10:48       ` Éric Bischoff
2017-02-24 13:19 [Qemu-devel] (no subject) Eric Bischoff
2017-02-24 13:19 ` [Qemu-devel] [PATCH] Adding support for LPD and LPDG instructions Eric Bischoff

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=20170228113535.7099-2-ebischoff@suse.com \
    --to=ebischoff@suse.com \
    --cc=agraf@suse.de \
    --cc=ebischoff@nerim.net \
    --cc=mbenes@suse.cz \
    --cc=mmarek@suse.cz \
    --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).