From: malc <av1474@comtv.ru>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5670] Fix alignment problem with some 64bit load/store instructions
Date: Tue, 11 Nov 2008 03:04:57 +0000 [thread overview]
Message-ID: <E1KzjYn-0003cp-Od@cvs.savannah.gnu.org> (raw)
Revision: 5670
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5670
Author: malc
Date: 2008-11-11 03:04:57 +0000 (Tue, 11 Nov 2008)
Log Message:
-----------
Fix alignment problem with some 64bit load/store instructions
LD/STD/LWA require displacement to be multiple of 4, provide
tcg_out_ldsta which checks the supplied displacement and falls
back on indexed variant when the check fails. All uses of
LD/STD/LWA outside of tcg_out_ldst appear to be safe.
Modified Paths:
--------------
trunk/tcg/ppc64/tcg-target.c
Modified: trunk/tcg/ppc64/tcg-target.c
===================================================================
--- trunk/tcg/ppc64/tcg-target.c 2008-11-10 15:55:14 UTC (rev 5669)
+++ trunk/tcg/ppc64/tcg-target.c 2008-11-11 03:04:57 UTC (rev 5670)
@@ -497,6 +497,17 @@
}
}
+static void tcg_out_ldsta (TCGContext *s, int ret, int addr,
+ int offset, int op1, int op2)
+{
+ if (offset == (int16_t) (offset & ~3))
+ tcg_out32 (s, op1 | RT (ret) | RA (addr) | (offset & 0xffff));
+ else {
+ tcg_out_movi (s, TCG_TYPE_I64, 0, offset);
+ tcg_out32 (s, op2 | RT (ret) | RA (addr) | RB (0));
+ }
+}
+
static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target)
{
tcg_target_long disp;
@@ -860,7 +871,7 @@
if (type == TCG_TYPE_I32)
tcg_out_ldst (s, ret, arg1, arg2, LWZ, LWZX);
else
- tcg_out_ldst (s, ret, arg1, arg2, LD, LDX);
+ tcg_out_ldsta (s, ret, arg1, arg2, LD, LDX);
}
static void tcg_out_st (TCGContext *s, TCGType type, int arg, int arg1,
@@ -869,7 +880,7 @@
if (type == TCG_TYPE_I32)
tcg_out_ldst (s, arg, arg1, arg2, STW, STWX);
else
- tcg_out_ldst (s, arg, arg1, arg2, STD, STDX);
+ tcg_out_ldsta (s, arg, arg1, arg2, STD, STDX);
}
static void ppc_addi32 (TCGContext *s, int rt, int ra, tcg_target_long si)
@@ -1088,10 +1099,10 @@
tcg_out_ldst (s, args[0], args[1], args[2], LWZ, LWZX);
break;
case INDEX_op_ld32s_i64:
- tcg_out_ldst (s, args[0], args[1], args[2], LWA, LWAX);
+ tcg_out_ldsta (s, args[0], args[1], args[2], LWA, LWAX);
break;
case INDEX_op_ld_i64:
- tcg_out_ldst (s, args[0], args[1], args[2], LD, LDX);
+ tcg_out_ldsta (s, args[0], args[1], args[2], LD, LDX);
break;
case INDEX_op_st8_i32:
case INDEX_op_st8_i64:
@@ -1106,7 +1117,7 @@
tcg_out_ldst (s, args[0], args[1], args[2], STW, STWX);
break;
case INDEX_op_st_i64:
- tcg_out_ldst (s, args[0], args[1], args[2], STD, STDX);
+ tcg_out_ldsta (s, args[0], args[1], args[2], STD, STDX);
break;
case INDEX_op_add_i32:
reply other threads:[~2008-11-11 3:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=E1KzjYn-0003cp-Od@cvs.savannah.gnu.org \
--to=av1474@comtv.ru \
--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).