diff mbox series

[PULL,37/43] target/hppa: Implement LDSID for system mode

Message ID 20180122034217.19593-38-richard.henderson@linaro.org
State Superseded
Headers show
Series Add hppa-softmmu | expand

Commit Message

Richard Henderson Jan. 22, 2018, 3:42 a.m. UTC
From: Helge Deller <deller@gmx.de>


Signed-off-by: Helge Deller <deller@gmx.de>

Message-Id: <20180102203145.GA17059@ls3530.fritz.box>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/hppa/translate.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

-- 
2.14.3
diff mbox series

Patch

diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index 965641f380..76ed7e1ad4 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -2200,8 +2200,20 @@  static DisasJumpType trans_ldsid(DisasContext *ctx, uint32_t insn,
     unsigned rt = extract32(insn, 0, 5);
     TCGv_reg dest = dest_gpr(ctx, rt);
 
-    /* Since we don't implement space registers, this returns zero.  */
+#ifdef CONFIG_USER_ONLY
+    /* We don't implement space registers in user mode. */
     tcg_gen_movi_reg(dest, 0);
+#else
+    unsigned rb = extract32(insn, 21, 5);
+    unsigned sp = extract32(insn, 14, 2);
+    TCGv_i64 t0 = tcg_temp_new_i64();
+
+    tcg_gen_mov_i64(t0, space_select(ctx, sp, load_gpr(ctx, rb)));
+    tcg_gen_shri_i64(t0, t0, 32);
+    tcg_gen_trunc_i64_reg(dest, t0);
+
+    tcg_temp_free_i64(t0);
+#endif
     save_gpr(ctx, rt, dest);
 
     cond_free(&ctx->null_cond);