From: Stuart B. <zu...@us...> - 2007-03-12 18:01:08
|
Update of /cvsroot/hppaqemu/hppaqemu/target-hppa In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv22475 Modified Files: op.c translate.c Log Message: Beginnings of conditional branch support. Index: translate.c =================================================================== RCS file: /cvsroot/hppaqemu/hppaqemu/target-hppa/translate.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** translate.c 12 Mar 2007 15:54:19 -0000 1.19 --- translate.c 12 Mar 2007 18:01:01 -0000 1.20 *************** *** 639,642 **** --- 639,667 ---- } + static void gen_branch_cond(DisasContext *dc, long tb, target_ulong disp, int n) + { + int l1; + target_ulong target; + target = dc->iaoq[0] + disp + 8; + + l1 = gen_new_label(); + + gen_op_jz_T2_label(l1); + + /* taken branch */ + if (n && ((int32_t)disp >= 0)) + gen_goto_tb(dc, 0, target, target + 4); + else + gen_goto_tb(dc, 0, dc->iaoq[1], target); + + gen_set_label(l1); + + /* failed branch */ + if (n && ((int32_t)disp < 0)) + gen_goto_tb(dc, 1, dc->iaoq[1] + 4, dc->iaoq[1] + 8); + else + gen_goto_tb(dc, 1, dc->iaoq[1], dc->iaoq[1] + 4); + } + static void save_state(DisasContext *dc) { *************** *** 1527,1535 **** --- 1552,1579 ---- case 0x1b: /* STWM */ + /* FIXME */ + break; + case 0x20: /* COMBT */ case 0x21: /* COMIBT */ case 0x22: /* COMBF */ case 0x23: /* COMIBF */ + { + uint32_t r1, r2, c, w1, n, w, disp; + r2 = field(insn, 21, 5); + r1 = field(insn, 16, 5); + c = field(insn, 13, 3); + w1 = field_signext(insn, 2, 11); + n = field(insn, 1, 1); + w = field(insn, 0, 1); + disp = (((w1 << 1) | w) << 2); + + /* gen_cond(c); */ + gen_branch_cond(dc, (long)dc->tb, disp, n); + + /* FIXME */ + dc->is_br = 1; break; + } case 0x24: /* COMICLR */ Index: op.c =================================================================== RCS file: /cvsroot/hppaqemu/hppaqemu/target-hppa/op.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** op.c 12 Mar 2007 15:54:19 -0000 1.16 --- op.c 12 Mar 2007 18:01:01 -0000 1.17 *************** *** 783,784 **** --- 783,791 ---- env->iaoq[1] = env->iaoq[0] + 4; } + + void OPPROTO op_jz_T2_label(void) + { + if (!T2) + GOTO_LABEL_PARAM(1); + FORCE_RET(); + } |