qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
To: qemu-devel@nongnu.org
Cc: agraf@suse.de, rth@twiddle.net
Subject: [Qemu-devel] [PATCH] target-s390x: Add Extract PSW instruction
Date: Wed, 17 Dec 2014 16:17:45 +0000	[thread overview]
Message-ID: <1418833065-2109-1-git-send-email-kbastian@mail.uni-paderborn.de> (raw)

Never versions of the linux kernel need this instruction, so let's add it to
the tcg frontend.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target-s390x/insn-data.def |  3 ++-
 target-s390x/translate.c   | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/target-s390x/insn-data.def b/target-s390x/insn-data.def
index 4d2feb6..338d510 100644
--- a/target-s390x/insn-data.def
+++ b/target-s390x/insn-data.def
@@ -287,7 +287,8 @@
     C(0xb24f, EAR,     RRE,   Z,   0, 0, new, r1_32, ear, 0)
 /* EXTRACT FPC */
     C(0xb38c, EFPC,    RRE,   Z,   0, 0, new, r1_32, efpc, 0)
-
+/* EXTRACT PSW */
+    C(0xb98d, EPSW,    RRE,   Z,   0, 0, new, r1_32, epsw, 0)
 /* FIND LEFTMOST ONE */
     C(0xb983, FLOGR,   RRE,   EI,  0, r2_o, r1_P, 0, flogr, 0)
 
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index dbf1993..539a794 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -2051,6 +2051,25 @@ static ExitStatus op_efpc(DisasContext *s, DisasOps *o)
     return NO_EXIT;
 }
 
+static ExitStatus op_epsw(DisasContext *s, DisasOps *o)
+{
+   TCGv tmp = tcg_temp_new();
+    int r1 = get_field(s->fields, r1);
+    int r2 = get_field(s->fields, r2);
+
+    tcg_gen_shli_tl(tmp, psw_mask, 32);
+    tcg_gen_andi_tl(regs[r1], regs[r1], ~0xffffffffull);
+    tcg_gen_or_tl(regs[r1], regs[r1], tmp);
+
+    if (r2 != 0) {
+        tcg_gen_andi_tl(tmp, psw_mask, ~0xffffffffull);
+        tcg_gen_andi_tl(regs[r2], regs[r2], ~0xffffffffull);
+        tcg_gen_or_tl(regs[r2], regs[r2], tmp);
+    }
+    tcg_temp_free(tmp);
+    return NO_EXIT;
+}
+
 static ExitStatus op_ex(DisasContext *s, DisasOps *o)
 {
     /* ??? Perhaps a better way to implement EXECUTE is to set a bit in
-- 
2.1.3

             reply	other threads:[~2014-12-17 15:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 16:17 Bastian Koppelmann [this message]
2014-12-19 21:15 ` [Qemu-devel] [PATCH] target-s390x: Add Extract PSW instruction Richard Henderson
2014-12-20 21:11   ` Bastian Koppelmann

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=1418833065-2109-1-git-send-email-kbastian@mail.uni-paderborn.de \
    --to=kbastian@mail.uni-paderborn.de \
    --cc=agraf@suse.de \
    --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).