~ari-tczew/ubuntu/lucid/skyeye/sru-lp-464175

« back to all changes in this revision

Viewing changes to arch/bfin/common/bfin-dis.c

  • Committer: Bazaar Package Importer
  • Author(s): Yu Guanghui
  • Date: 2007-08-07 13:25:49 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20070807132549-96159k1obat1fxr0
Tags: 1.2.3-1
* New upstream release
* Added NO_BFD=1, don't require libbfd now. (Closes:Bug#423933) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#include <signal.h>
11
11
 
12
12
#include "opcode/bfin.h"
13
 
#include "mach.h"
14
13
 
15
14
#define M_S2RND 1
16
15
#define M_T     2
1159
1158
                //notethat ("RTI");
1160
1159
                //OUTS (outf, "RTI");
1161
1160
                /*0 is meaningless */
 
1161
                if(PCREG == 0x744a)
 
1162
                        ;
 
1163
                else
 
1164
                        fprintf(PF,"RTI instruction generated,pc=0x%x\n",PCREG);
1162
1165
                PCREG = RETIREG;
1163
1166
                /*clear global int bit in ipend */
1164
 
                saved_state.p_mach->enable_int ();
 
1167
                saved_state.enable_int ();
1165
1168
                /*clear the responding pending bit */
1166
 
                saved_state.p_mach->clear_int (0);
 
1169
                saved_state.clear_int (0);
1167
1170
 
1168
1171
                //did_jump = 1;
1169
 
                //printf("int generated,pc=%x\n",PCREG);
1170
1172
                return;
1171
1173
        }
1172
1174
        else if (prgfunc == 1 && poprnd == 2) {
1175
1177
                //unhandled_instruction ();
1176
1178
                //fprintf(PF,"RTX\n");
1177
1179
                /*clear global int bit in ipend */
1178
 
                saved_state.p_mach->enable_int ();
 
1180
                saved_state.enable_int ();
1179
1181
                /*clear the responding pending bit */
1180
 
                saved_state.p_mach->clear_int (0);
 
1182
                saved_state.clear_int (0);
1181
1183
 
1182
1184
                PCREG = RETXREG;
1183
1185
                return;
1230
1232
                // notethat ("CLI dregs");
1231
1233
                // OUTS (outf, "CLI  ");
1232
1234
                //OUTS (outf, dregs (poprnd));
1233
 
                saved_state.p_mach->cli (&DREG (poprnd));
 
1235
                saved_state.cli (&DREG (poprnd));
1234
1236
                PCREG += 2;
1235
1237
                return;
1236
1238
        }
1238
1240
                //notethat ("STI dregs");
1239
1241
                //  OUTS (outf, "STI");
1240
1242
                // OUTS (outf, dregs (poprnd));
1241
 
                saved_state.p_mach->sti (&DREG (poprnd));
 
1243
                saved_state.sti (&DREG (poprnd));
1242
1244
                PCREG += 2;
1243
1245
                return;
1244
1246
        }
1272
1274
                extern int raise_flag;
1273
1275
                notethat ("RAISE uimm4");
1274
1276
                //bfin_trap ();
1275
 
                /*for time sequence, we will not do io_do_cycle after raise instruction */
 
1277
                fprintf(PF,"KSDBG:raise %d, pc=0x%x\n", poprnd, PCREG);
 
1278
                saved_state.set_int (poprnd);
1276
1279
                raise_flag = 1;
1277
 
                saved_state.p_mach->set_int (poprnd);
1278
1280
                PCREG += 2;
1279
1281
                return;
1280
1282
        }
1290
1292
                        OUTS (outf, "EXCPT  ");
1291
1293
                        OUTS (outf, uimm4 (poprnd));
1292
1294
                        //fprintf(PF,"System call :pc=0x%x,oldpc=0x%x,olderpc=0x%x,EXCPT %x\n",PCREG,OLDPCREG,OLDERPCREG,uimm4 (poprnd));
1293
 
                        saved_state.p_mach->set_int (3);
 
1295
                        saved_state.set_int (3);
1294
1296
                        SEQSTATREG = SEQSTATREG & 0xffffffc0 + poprnd & 0x3f;
1295
1297
                        //unhandled_instruction ();
1296
1298
                        PCREG += 2;
1311
1313
                unhandled_instruction ();
1312
1314
}
1313
1315
 
1314
 
#define NOT_IMP fprintf(PF,"pc=0x%x,p0=0x%x,p1=0x%x,not implemented cache ops \n",PCREG,PREG(0),PREG(1));
 
1316
#define NOT_IMP {fprintf(PF,"pc=0x%x,p0=0x%x,p1=0x%x,not implemented cache ops \n",PCREG,PREG(0),PREG(1)); }
1315
1317
static void
1316
1318
decode_CaCTRL_0 (bu16 iw0)
1317
1319
{
1376
1378
                OUTS (outf, "++");
1377
1379
                OUTS (outf, "]");
1378
1380
                PREG (reg)++;
1379
 
                NOT_IMP;
 
1381
                //NOT_IMP;
1380
1382
                PCREG += 2;
1381
1383
                return;
1382
1384
        }
1388
1390
                OUTS (outf, "++");
1389
1391
                OUTS (outf, "]");
1390
1392
                PREG (reg)++;
1391
 
                NOT_IMP;
 
1393
                //NOT_IMP;
1392
1394
                PCREG += 2;
1393
1395
                return;
1394
1396
        }
1445
1447
                *whichreg = get_long (saved_state.memory, PREG (6));
1446
1448
                if (whichreg == &RETIREG) {
1447
1449
                        /*disable the global int bit,until RTI is executed!Or other int maybe overwrite reti */
1448
 
                        saved_state.p_mach->disable_int ();
 
1450
                        saved_state.disable_int ();
1449
1451
                }
1450
1452
                if (whichreg == &ASTATREG) {
1451
1453
                        /*at the same time,restore CCREG */
1464
1466
                PREG (6) -= 4;
1465
1467
                if (whichreg == &RETIREG) {
1466
1468
                        /*enable the global  int bit */
1467
 
                        saved_state.p_mach->enable_int ();
 
1469
                        saved_state.enable_int ();
1468
1470
                }
1469
1471
                if (whichreg == &ASTATREG) {
1470
1472
                        /*at the same time,save CCREG */
2815
2817
        }
2816
2818
        else
2817
2819
                notethat ("JUMP.L  pcrel24");
2818
 
        PCREG += pcrel24 (((msw) << 16) | (lsw));
 
2820
        /* fixme, workaround for bf537 instruction: call _real_start; */
 
2821
        if((msw == 0x0) && (lsw == 0x1f) && (PCREG == 0x113e))
 
2822
                PCREG += 4;
 
2823
        else
 
2824
                PCREG += pcrel24 (((msw) << 16) | (lsw));
2819
2825
        // printf("\ncall or jump is 0x%x\n",PCREG);
2820
2826
}
2821
2827
 
3097
3103
        int aopcde = ((iw0 >> 0) & 0x1f);
3098
3104
        int dst1 = ((iw1 >> 6) & 0x7);
3099
3105
        int M = ((iw0 >> 11) & 0x1);
3100
 
 
3101
 
        //printf("iw1=0x%x,iw0=0x%x\n",iw1,iw0);
 
3106
/*
 
3107
        if(M)
 
3108
                printf("KSDBG:iw1=0x%x,iw0=0x%x,pc=0x%x,insn@pc=0x%x\n",iw1,iw0,PCREG,get_long(saved_state.memory, PCREG));
 
3109
*/
3102
3110
 
3103
3111
        if (aop == 0 && aopcde == 9 && HL == 0 && s == 0) {
3104
3112
                notethat ("A0.L = dregs_lo");
4455
4463
                //unhandled_instruction();
4456
4464
                DREG(dst0) = (DREG(src0)&0xffff0000 + DREG(src1)&0xffff0000)&0xffff0000
4457
4465
                        + (DREG(src0)&0xffff + DREG(src1)&0xffff)&0xffff;       
4458
 
 
4459
4466
                amod0 (s, x, pc);
4460
4467
                PCREG += 4;
4461
4468
                return;