Skip to contentSkip to conversation

Fix branch conditions

PATCH In review Aurelien Jarno 2 participants 2 messages Mar 21, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix branch conditions

Hi,

I have noticed that the condition table in target-sparc/translate.c is wrong wrt ba and bnr, they are reversed. The emulation is still correct as they are currently not used (do_branch() has two cases to handle them). However I think it is a good idea to fix that, as they may be used at some point.

Bye,
Aurelien

Index: target-sparc/translate.c
===================================================================
RCS file: /sources/qemu/qemu/target-sparc/translate.c,v retrieving revision 1.34

translate.c +4 -4
diff -u -d -p -r1.34 translate.c
@@ -681,7 +681,7 @@ static inline void gen_mov_pc_npc(DisasC
 
 static GenOpFunc * const gen_cond[2][16] = {
     {
-	gen_op_eval_ba,
+	gen_op_eval_bn,
 	gen_op_eval_be,
 	gen_op_eval_ble,
 	gen_op_eval_bl,
@@ -689,7 +689,7 @@ static GenOpFunc * const gen_cond[2][16]
 	gen_op_eval_bcs,
 	gen_op_eval_bneg,
 	gen_op_eval_bvs,
-	gen_op_eval_bn,
+	gen_op_eval_ba,
 	gen_op_eval_bne,
 	gen_op_eval_bg,
 	gen_op_eval_bge,
@@ -722,7 +722,7 @@ static GenOpFunc * const gen_cond[2][16]
 
 static GenOpFunc * const gen_fcond[4][16] = {
     {
-	gen_op_eval_ba,
+	gen_op_eval_bn,
 	gen_op_eval_fbne,
 	gen_op_eval_fblg,
 	gen_op_eval_fbul,
@@ -730,7 +730,7 @@ static GenOpFunc * const gen_fcond[4][16
 	gen_op_eval_fbug,
 	gen_op_eval_fbg,
 	gen_op_eval_fbu,
-	gen_op_eval_bn,
+	gen_op_eval_ba,
 	gen_op_eval_fbe,
 	gen_op_eval_fbue,
 	gen_op_eval_fbge,
Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#1 lore raw
Quoted 5 lines

I have noticed that the condition table in target-sparc/translate.c is wrong wrt ba and bnr, they are reversed. The emulation is still correct as they are currently not used (do_branch() has two cases to handle them). However I think it is a good idea to fix that, as they may be used at some point.

You're right. The same problem exists with FPU branches and Sparc64 as well.

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.com/