From: "Igor V. Kovalenko" <igor.v.kovalenko@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/8] sparc64: fix missing address masking
Date: Wed, 02 Jun 2010 00:12:27 +0400 [thread overview]
Message-ID: <20100601201227.5908.12931.stgit@skyserv> (raw)
In-Reply-To: <20100601200434.5908.19495.stgit@skyserv>
From: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
- address masking for ldqf and stqf insns
- address masking for lddf and stdf insns
- address masking for translating ASI (Ultrasparc IIi)
Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
---
target-sparc/op_helper.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++
target-sparc/translate.c | 4 ++++
2 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
index ef3504f..f5e153d 100644
--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -2315,6 +2315,25 @@ void helper_st_asi(target_ulong addr, target_ulong val, int asi, int size)
#else /* CONFIG_USER_ONLY */
+/* Ultrasparc IIi translating asi
+ - note this list is defined by cpu implementation
+ */
+static inline int is_translating_asi(int asi)
+{
+ switch (asi) {
+ case 0x04 ... 0x11:
+ case 0x18 ... 0x19:
+ case 0x24 ... 0x2C:
+ case 0x70 ... 0x73:
+ case 0x78 ... 0x79:
+ case 0x80 ... 0xFF:
+ return 1;
+
+ default:
+ return 0;
+ }
+}
+
uint64_t helper_ld_asi(target_ulong addr, int asi, int size, int sign)
{
uint64_t ret = 0;
@@ -2330,7 +2349,12 @@ uint64_t helper_ld_asi(target_ulong addr, int asi, int size, int sign)
&& !(env->hpstate & HS_PRIV)))
raise_exception(TT_PRIV_ACT);
+ if ((env->pstate & PS_AM) && is_translating_asi(asi)) {
+ addr &= 0xffffffffULL;
+ }
+
helper_check_align(addr, size - 1);
+
switch (asi) {
case 0x82: // Primary no-fault
case 0x8a: // Primary no-fault LE
@@ -2681,7 +2705,12 @@ void helper_st_asi(target_ulong addr, target_ulong val, int asi, int size)
&& !(env->hpstate & HS_PRIV)))
raise_exception(TT_PRIV_ACT);
+ if ((env->pstate & PS_AM) && is_translating_asi(asi)) {
+ addr &= 0xffffffffULL;
+ }
+
helper_check_align(addr, size - 1);
+
/* Convert to little endian */
switch (asi) {
case 0x0c: // Nucleus Little Endian (LE)
@@ -3056,6 +3085,12 @@ void helper_ldda_asi(target_ulong addr, int asi, int rd)
&& !(env->hpstate & HS_PRIV)))
raise_exception(TT_PRIV_ACT);
+#if defined (CONFIG_SPARC64)
+ if ((env->pstate & PS_AM) && is_translating_asi(asi)) {
+ addr &= 0xffffffffULL;
+ }
+#endif
+
switch (asi) {
#if !defined(CONFIG_USER_ONLY)
case 0x24: // Nucleus quad LDD 128 bit atomic
@@ -3102,6 +3137,12 @@ void helper_ldf_asi(target_ulong addr, int asi, int size, int rd)
unsigned int i;
target_ulong val;
+#if defined (CONFIG_SPARC64)
+ if ((env->pstate & PS_AM) && is_translating_asi(asi)) {
+ addr &= 0xffffffffULL;
+ }
+#endif
+
helper_check_align(addr, 3);
switch (asi) {
case 0xf0: // Block load primary
@@ -3144,6 +3185,12 @@ void helper_stf_asi(target_ulong addr, int asi, int size, int rd)
unsigned int i;
target_ulong val = 0;
+#if defined (CONFIG_SPARC64)
+ if ((env->pstate & PS_AM) && is_translating_asi(asi)) {
+ addr &= 0xffffffffULL;
+ }
+#endif
+
helper_check_align(addr, 3);
switch (asi) {
case 0xe0: // UA2007 Block commit store primary (cache flush)
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 72ca0b4..eff64d4 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -4490,6 +4490,7 @@ static void disas_sparc_insn(DisasContext * dc)
CHECK_FPU_FEATURE(dc, FLOAT128);
r_const = tcg_const_i32(dc->mem_idx);
+ gen_address_mask(dc, cpu_addr);
gen_helper_ldqf(cpu_addr, r_const);
tcg_temp_free_i32(r_const);
gen_op_store_QT0_fpr(QFPREG(rd));
@@ -4500,6 +4501,7 @@ static void disas_sparc_insn(DisasContext * dc)
TCGv_i32 r_const;
r_const = tcg_const_i32(dc->mem_idx);
+ gen_address_mask(dc, cpu_addr);
gen_helper_lddf(cpu_addr, r_const);
tcg_temp_free_i32(r_const);
gen_op_store_DT0_fpr(DFPREG(rd));
@@ -4635,6 +4637,7 @@ static void disas_sparc_insn(DisasContext * dc)
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_op_load_fpr_QT0(QFPREG(rd));
r_const = tcg_const_i32(dc->mem_idx);
+ gen_address_mask(dc, cpu_addr);
gen_helper_stqf(cpu_addr, r_const);
tcg_temp_free_i32(r_const);
}
@@ -4657,6 +4660,7 @@ static void disas_sparc_insn(DisasContext * dc)
gen_op_load_fpr_DT0(DFPREG(rd));
r_const = tcg_const_i32(dc->mem_idx);
+ gen_address_mask(dc, cpu_addr);
gen_helper_stdf(cpu_addr, r_const);
tcg_temp_free_i32(r_const);
}
next prev parent reply other threads:[~2010-06-01 20:12 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-01 20:12 [Qemu-devel] [PATCH 0/8] sparc64 fixes Igor V. Kovalenko
2010-06-01 20:12 ` [Qemu-devel] [PATCH 1/8] sparc64: fix tag access register on mmu traps Igor V. Kovalenko
2010-06-01 20:12 ` Igor V. Kovalenko [this message]
2010-06-01 20:44 ` [Qemu-devel] [PATCH 2/8] sparc64: fix missing address masking Richard Henderson
2010-06-02 4:29 ` Igor Kovalenko
2010-06-02 13:47 ` Richard Henderson
2010-06-02 16:10 ` Blue Swirl
2010-06-02 16:46 ` Andreas Färber
2010-06-02 18:21 ` Igor Kovalenko
2010-06-02 19:20 ` Igor Kovalenko
2010-06-01 20:12 ` [Qemu-devel] [PATCH 3/8] sparc64: fix 32bit load sign extension Igor V. Kovalenko
2010-06-03 13:18 ` [Qemu-devel] " Paolo Bonzini
2010-06-03 15:25 ` Alexander Graf
2010-06-03 15:42 ` Paolo Bonzini
2010-06-03 19:59 ` Igor Kovalenko
2010-06-04 7:53 ` Paolo Bonzini
2010-06-04 10:18 ` Paolo Bonzini
2010-06-04 14:27 ` [Qemu-devel] [PATCH] target-i386: fix decoding of negative 4-byte displacements Paolo Bonzini
2010-06-04 16:23 ` Richard Henderson
2010-06-04 20:03 ` Blue Swirl
2010-06-01 20:12 ` [Qemu-devel] [PATCH 4/8] sparc64: fix ldxfsr insn Igor V. Kovalenko
2010-06-01 20:12 ` [Qemu-devel] [PATCH 5/8] sparc64: use symbolic name for MMU index Igor V. Kovalenko
2010-06-02 16:16 ` Blue Swirl
2010-06-02 18:45 ` Igor Kovalenko
2010-06-01 20:12 ` [Qemu-devel] [PATCH 6/8] sparc64: improve ldf and stf insns Igor V. Kovalenko
2010-06-01 20:12 ` [Qemu-devel] [PATCH 7/8] sparc64: fix udiv and sdiv insns Igor V. Kovalenko
2010-06-01 20:12 ` [Qemu-devel] [PATCH 8/8] sparc64: fix umul and smul insns Igor V. Kovalenko
2010-06-02 20:27 ` [Qemu-devel] [PATCH 0/8] sparc64 fixes Blue Swirl
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=20100601201227.5908.12931.stgit@skyserv \
--to=igor.v.kovalenko@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).