From: Artyom Tarasenko <atar4qemu@gmail.com>
To: qemu-devel@nongnu.org
Cc: blauwirbel@gmail.com, Artyom Tarasenko <atar4qemu@gmail.com>
Subject: [Qemu-devel] [PATCH 1/4] Implement address masking for SPARC v9 CPUs
Date: Sat, 12 May 2012 11:15:20 +0200 [thread overview]
Message-ID: <61b3c5d5e8bf9b95f9a143f2cf65ef0bb60fe824.1336811825.git.atar4qemu@gmail.com> (raw)
In-Reply-To: <cover.1336811825.git.atar4qemu@gmail.com>
In-Reply-To: <cover.1336811825.git.atar4qemu@gmail.com>
According to UltraSPARC - IIi User's manual:
14.1.11 Address Masking (Impdep #125)
When PSTATE.AM=1, the CALL, JMPL, and RDPC instructions and all traps
transmit zero in the high-order 32-bits of the PC to their specified destination
registers.
Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
---
target-sparc/translate.c | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 4967152..b95f91c 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -1343,6 +1343,11 @@ static void do_branch(DisasContext *dc, int32_t offset, uint32_t insn, int cc,
unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29));
target_ulong target = dc->pc + offset;
+#ifdef TARGET_SPARC64
+ if (unlikely(AM_CHECK(dc))) {
+ target &= 0xffffffffULL;
+ }
+#endif
if (cond == 0x0) {
/* unconditional not taken */
if (a) {
@@ -1388,6 +1393,11 @@ static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc,
unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29));
target_ulong target = dc->pc + offset;
+#ifdef TARGET_SPARC64
+ if (unlikely(AM_CHECK(dc))) {
+ target &= 0xffffffffULL;
+ }
+#endif
if (cond == 0x0) {
/* unconditional not taken */
if (a) {
@@ -1434,6 +1444,9 @@ static void do_branch_reg(DisasContext *dc, int32_t offset, uint32_t insn,
unsigned int cond = GET_FIELD_SP(insn, 25, 27), a = (insn & (1 << 29));
target_ulong target = dc->pc + offset;
+ if (unlikely(AM_CHECK(dc))) {
+ target &= 0xffffffffULL;
+ }
flush_cond(dc, r_cond);
gen_cond_reg(r_cond, cond, r_reg);
if (a) {
@@ -2486,6 +2499,11 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
tcg_temp_free(r_const);
target += dc->pc;
gen_mov_pc_npc(dc, cpu_cond);
+#ifdef TARGET_SPARC64
+ if (unlikely(AM_CHECK(dc))) {
+ target &= 0xffffffffULL;
+ }
+#endif
dc->npc = target;
}
goto jmp_insn;
@@ -2610,7 +2628,11 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
{
TCGv r_const;
- r_const = tcg_const_tl(dc->pc);
+ if (unlikely(AM_CHECK(dc))) {
+ r_const = tcg_const_tl(dc->pc & 0xffffffffULL);
+ } else {
+ r_const = tcg_const_tl(dc->pc);
+ }
gen_movl_TN_reg(rd, r_const);
tcg_temp_free(r_const);
}
@@ -4579,6 +4601,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
r_const = tcg_const_i32(3);
gen_helper_check_align(cpu_env, cpu_dst, r_const);
tcg_temp_free_i32(r_const);
+ gen_address_mask(dc, cpu_dst);
tcg_gen_mov_tl(cpu_npc, cpu_dst);
dc->npc = DYNAMIC_PC;
}
--
1.7.1
next prev parent reply other threads:[~2012-05-12 9:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-12 9:15 [Qemu-devel] [PATCH 0/4, master+QEMU 1.1] sparc64: let's boot Linux! Artyom Tarasenko
2012-05-12 9:15 ` Artyom Tarasenko [this message]
2012-05-12 9:23 ` [Qemu-devel] [PATCH 1/4] Implement address masking for SPARC v9 CPUs Artyom Tarasenko
2012-05-12 9:15 ` [Qemu-devel] [PATCH 2/4, master+QEMU 1.1] fix block loads broken in commit 30038fd818 Artyom Tarasenko
2012-05-12 9:15 ` [Qemu-devel] [PATCH 3/4, master+QEMU 1.1] sun4u: initialize OBIO interrupt mappings Artyom Tarasenko
2012-05-12 9:15 ` [Qemu-devel] [PATCH 4/4, master+QEMU 1.1] sun4u: implement interrupt clearing registers Artyom Tarasenko
2012-05-12 11:56 ` Andreas Färber
2012-05-12 12:32 ` Blue Swirl
2012-05-12 12:38 ` Andreas Färber
2012-05-12 13:08 ` Blue Swirl
2012-05-12 13:57 ` Andreas Färber
2012-05-12 14:34 ` Artyom Tarasenko
2012-05-12 13:00 ` Artyom Tarasenko
2012-05-12 10:01 ` [Qemu-devel] [PATCH 0/4, master+QEMU 1.1] sparc64: let's boot Linux! Blue Swirl
2012-05-12 10:49 ` Artyom Tarasenko
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=61b3c5d5e8bf9b95f9a143f2cf65ef0bb60fe824.1336811825.git.atar4qemu@gmail.com \
--to=atar4qemu@gmail.com \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
/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).