qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: Charlie Baylis <charlie.baylis@fish.zetnet.co.uk>
Subject: Re: [Qemu-devel] Qemu arm emulation
Date: Fri, 3 Dec 2004 21:13:40 +0000	[thread overview]
Message-ID: <200412032113.41066.paul@codesourcery.com> (raw)
In-Reply-To: <20041203210758.GD21652@cray.fish.zetnet.co.uk>

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

On Friday 03 December 2004 21:07, Charlie Baylis wrote:
> Hi Fabrice
>
> I have had a look at some faults in the ARM port of Qemu. I have discovered
> a couple of bugs. To avoid difficulties with my employer I can't distribute
> my patch which contains the fixes, but they are fairly trivial so I am
> detailing the changes required here.
>
> 1. The RRX operand shift on data processing instructions is incorrectly
> decoded as a rotate right (ROR) of 0 bits.
> RRX should have the effect of an extended rotate right of 1 bit where the
> carry flag is shifted into the top bit of the result. If the S bit is set,
> then the carry flag is set to the bottom bit of the source value.

The attached patch fixes this.

I posted it a while back, but it never got into CVS and I never chased it.
Paul

[-- Attachment #2: patch.qemu_rrx --]
[-- Type: text/x-diff, Size: 1658 bytes --]

Index: target-arm/op.c
===================================================================
RCS file: /cvsroot/qemu/qemu/target-arm/op.c,v
retrieving revision 1.3
diff -u -p -r1.3 op.c
--- target-arm/op.c	30 Nov 2003 19:40:08 -0000	1.3
+++ target-arm/op.c	1 Aug 2004 21:43:22 -0000
@@ -485,6 +502,11 @@ void OPPROTO op_rorl_T1_im(void)
     T1 = ((uint32_t)T1 >> shift) | (T1 << (32 - shift));
 }
 
+void OPPROTO op_rrxl_T1(void)
+{
+    T1 = ((uint32_t)T1 >> 1) | ((uint32_t)env->CF << 31);
+}
+
 /* T1 based, set C flag */
 void OPPROTO op_shll_T1_im_cc(void)
 {
@@ -512,6 +534,14 @@ void OPPROTO op_rorl_T1_im_cc(void)
     T1 = ((uint32_t)T1 >> shift) | (T1 << (32 - shift));
 }
 
+void OPPROTO op_rrxl_T1_cc(void)
+{
+    uint32_t c;
+    c = T1 & 1;
+    T1 = ((uint32_t)T1 >> 1) | ((uint32_t)env->CF << 31);
+    env->CF = c;
+}
+
 /* T2 based */
 void OPPROTO op_shll_T2_im(void)
 {
Index: target-arm/translate.c
===================================================================
RCS file: /cvsroot/qemu/qemu/target-arm/translate.c,v
retrieving revision 1.10
diff -u -p -r1.10 translate.c
--- target-arm/translate.c	22 Jun 2004 10:55:49 -0000	1.10
+++ target-arm/translate.c	1 Aug 2004 21:43:22 -0000
@@ -365,6 +484,11 @@ static void disas_arm_insn(DisasContext 
                     } else {
                         gen_shift_T1_im[shiftop](shift);
                     }
+                } else if (shiftop == 3) {
+                    if (logic_cc)
+                        gen_op_rrxl_T1_cc();
+                    else
+                        gen_op_rrxl_T1();
                 }
             } else {
                 rs = (insn >> 8) & 0xf;

  reply	other threads:[~2004-12-03 21:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-03 21:07 [Qemu-devel] Qemu arm emulation Charlie Baylis
2004-12-03 21:13 ` Paul Brook [this message]
2004-12-08 22:33   ` Fabrice Bellard
2004-12-08 22:48     ` Paul Brook
2005-02-04 12:30 ` Ulrich Hecht
2005-02-04 14:19   ` Paul Brook
2005-02-05 12:45     ` Ulrich Hecht
  -- strict thread matches above, loose matches on Subject: below --
2005-11-30 19:48 [Qemu-devel] qemu & " Philippe BEAU

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=200412032113.41066.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=charlie.baylis@fish.zetnet.co.uk \
    --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).