Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew STUBBS <andrew.stubbs@st.com>
To: GDB Patches <gdb-patches@sourceware.org>
Subject: [patch][sh] mac.l insn endian issue
Date: Fri, 01 Feb 2008 10:26:00 -0000	[thread overview]
Message-ID: <47A2F3AF.4090009@st.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 151 bytes --]

Hi all,

The mac.l simulator implementation is broken on big endian hosts, such 
as Sparc Solaris.

The attached patch should fix the problem.

Andrew

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1208 bytes --]

2008-01-31  Antony King  <antony.king@st.com>

	Fix INSbl28170:
	* interp.c (macl): Fix non-portable implementation.

--- sim/sh/interp.c@@/main/INSIGHT-6.6-ST-1.0-int/1	2007-08-17 15:11:45.000000000 +0100
+++ sim/sh/interp.c	2008-01-31 18:33:16.000000000 +0000
@@ -1433,14 +1433,9 @@
      int m, n;
 {
   long tempm, tempn;
-  long prod, macl, mach, sum;
-  long long ans,ansl,ansh,t;
-  unsigned long long high,low,combine;
-  union mac64
-  {
-    long m[2]; /* mach and macl*/
-    long long m64; /* 64 bit MAC */
-  }mac64;
+  long macl, mach;
+  long long ans;
+  long long mac64;
 
   tempm = RSLAT (regs[m]);
   regs[m] += 4;
@@ -1451,15 +1446,15 @@
   mach = MACH;
   macl = MACL;
 
-  mac64.m[0] = macl;
-  mac64.m[1] = mach;
+  mac64 = ((long long) macl & 0xffffffff) |
+          ((long long) mach & 0xffffffff) << 32;
 
   ans = (long long) tempm * (long long) tempn; /* Multiply 32bit * 32bit */
 
-  mac64.m64 += ans; /* Accumulate   64bit + 64 bit */
+  mac64 += ans; /* Accumulate 64bit + 64 bit */
 
-  macl = mac64.m[0];
-  mach = mac64.m[1];
+  macl = (long) (mac64 & 0xffffffff);
+  mach = (long) ((mac64 >> 32) & 0xffffffff);
 
   if (S)  /* Store only 48 bits of the result */
     {

             reply	other threads:[~2008-02-01 10:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-01 10:26 Andrew STUBBS [this message]
2008-02-01 22:40 ` Jim Blandy
2008-02-04 11:54   ` Andrew STUBBS
2008-02-04 13:40     ` Daniel Jacobowitz
2008-02-04 17:27       ` Andrew STUBBS

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=47A2F3AF.4090009@st.com \
    --to=andrew.stubbs@st.com \
    --cc=gdb-patches@sourceware.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