Skip to contentSkip to conversation

Fix C-flag for ASR <reg> when shift==0

PATCH In review Matthew Howkins 2 participants 3 messages Feb 11, 2007 – May 19, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix C-flag for ASR <reg> when shift==0

There is a bug in the ARM emulation of data-processing instructions with ASR <reg> when the shift==0. The current QEMU CVS incorrectly modifies the C-flag, when it should be preserved.

The attached patch corrects this.

Matthew

Index: target-arm/op.c
===================================================================
RCS file: /sources/qemu/qemu/target-arm/op.c,v
retrieving revision 1.21

op.c +1 -1
diff -u -r1.21 op.c
@@ -667,7 +667,7 @@
     if (shift >= 32) {
         env->CF = (T1 >> 31) & 1;
         T1 = (int32_t)T1 >> 31;
-    } else {
+    } else if (shift != 0) {
         env->CF = (T1 >> (shift - 1)) & 1;
         T1 = (int32_t)T1 >> shift;
     }
#1 lore raw
Quoted 6 lines · Matthew Howkins

There is a bug in the ARM emulation of data-processing instructions with ASR <reg> when the shift==0. The current QEMU CVS incorrectly modifies the C-flag, when it should be preserved.

The attached patch corrects this.

This patch is consistent with the reference manual, I think it should be applied. Has it been lost?

Quoted 26 lines

------------------------------------------------------------------------

Index: target-arm/op.c
===================================================================
RCS file: /sources/qemu/qemu/target-arm/op.c,v
retrieving revision 1.21
diff -u -r1.21 op.c

op.c +1 -2
@@ -667,7 +667,7 @@
     if (shift >= 32) {
         env->CF = (T1 >> 31) & 1;
         T1 = (int32_t)T1 >> 31;
-    } else {
+    } else if (shift != 0) {
         env->CF = (T1 >> (shift - 1)) & 1;
         T1 = (int32_t)T1 >> shift;
     }
 
 
------------------------------------------------------------------------

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#2 lore raw
Quoted 10 lines · Aurelien Jarno
Quoted 6 lines · Matthew Howkins

There is a bug in the ARM emulation of data-processing instructions with ASR <reg> when the shift==0. The current QEMU CVS incorrectly modifies the C-flag, when it should be preserved.

The attached patch corrects this.

This patch is consistent with the reference manual, I think it should be applied. Has it been lost?

Still no news about this patch...

Quoted 28 lines
Quoted 26 lines

------------------------------------------------------------------------

Index: target-arm/op.c
===================================================================
RCS file: /sources/qemu/qemu/target-arm/op.c,v
retrieving revision 1.21
diff -u -r1.21 op.c

op.c +1 -2
@@ -667,7 +667,7 @@
     if (shift >= 32) {
         env->CF = (T1 >> 31) & 1;
         T1 = (int32_t)T1 >> 31;
-    } else {
+    } else if (shift != 0) {
         env->CF = (T1 >> (shift - 1)) & 1;
         T1 = (int32_t)T1 >> shift;
     }
 
 
------------------------------------------------------------------------

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net