~ubuntu-branches/ubuntu/hardy/kvm/hardy-backports

« back to all changes in this revision

Viewing changes to qemu/target-mips/translate.c

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2008-01-03 10:39:25 UTC
  • mfrom: (1.1.16 upstream)
  • Revision ID: james.westby@ubuntu.com-20080103103925-8480u7sq2646hvbh
Tags: 1:59+dfsg-0ubuntu1
* New upstream release
* Build with alsa support (cherry pick from 57+dfsg-2)

Show diffs side-by-side

added added

removed removed

Lines of Context:
214
214
    OPC_SPECIAL3D_RESERVED = 0x3D | OPC_SPECIAL,
215
215
};
216
216
 
 
217
/* Multiplication variants of the vr54xx. */
 
218
#define MASK_MUL_VR54XX(op)   MASK_SPECIAL(op) | (op & (0x1F << 6))
 
219
 
 
220
enum {
 
221
    OPC_VR54XX_MULS    = (0x03 << 6) | OPC_MULT,
 
222
    OPC_VR54XX_MULSU   = (0x03 << 6) | OPC_MULTU,
 
223
    OPC_VR54XX_MACC    = (0x05 << 6) | OPC_MULT,
 
224
    OPC_VR54XX_MACCU   = (0x05 << 6) | OPC_MULTU,
 
225
    OPC_VR54XX_MSAC    = (0x07 << 6) | OPC_MULT,
 
226
    OPC_VR54XX_MSACU   = (0x07 << 6) | OPC_MULTU,
 
227
    OPC_VR54XX_MULHI   = (0x09 << 6) | OPC_MULT,
 
228
    OPC_VR54XX_MULHIU  = (0x09 << 6) | OPC_MULTU,
 
229
    OPC_VR54XX_MULSHI  = (0x0B << 6) | OPC_MULT,
 
230
    OPC_VR54XX_MULSHIU = (0x0B << 6) | OPC_MULTU,
 
231
    OPC_VR54XX_MACCHI  = (0x0D << 6) | OPC_MULT,
 
232
    OPC_VR54XX_MACCHIU = (0x0D << 6) | OPC_MULTU,
 
233
    OPC_VR54XX_MSACHI  = (0x0F << 6) | OPC_MULT,
 
234
    OPC_VR54XX_MSACHIU = (0x0F << 6) | OPC_MULTU,
 
235
};
 
236
 
217
237
/* REGIMM (rt field) opcodes */
218
238
#define MASK_REGIMM(op)    MASK_OP_MAJOR(op) | (op & (0x1F << 16))
219
239
 
1530
1550
    MIPS_DEBUG("%s %s %s", opn, regnames[rs], regnames[rt]);
1531
1551
}
1532
1552
 
 
1553
static void gen_mul_vr54xx (DisasContext *ctx, uint32_t opc,
 
1554
                            int rd, int rs, int rt)
 
1555
{
 
1556
    const char *opn = "mul vr54xx";
 
1557
 
 
1558
    GEN_LOAD_REG_T0(rs);
 
1559
    GEN_LOAD_REG_T1(rt);
 
1560
 
 
1561
    switch (opc) {
 
1562
    case OPC_VR54XX_MULS:
 
1563
        gen_op_muls();
 
1564
        opn = "muls";
 
1565
        break;
 
1566
    case OPC_VR54XX_MULSU:
 
1567
        gen_op_mulsu();
 
1568
        opn = "mulsu";
 
1569
        break;
 
1570
    case OPC_VR54XX_MACC:
 
1571
        gen_op_macc();
 
1572
        opn = "macc";
 
1573
        break;
 
1574
    case OPC_VR54XX_MACCU:
 
1575
        gen_op_maccu();
 
1576
        opn = "maccu";
 
1577
        break;
 
1578
    case OPC_VR54XX_MSAC:
 
1579
        gen_op_msac();
 
1580
        opn = "msac";
 
1581
        break;
 
1582
    case OPC_VR54XX_MSACU:
 
1583
        gen_op_msacu();
 
1584
        opn = "msacu";
 
1585
        break;
 
1586
    case OPC_VR54XX_MULHI:
 
1587
        gen_op_mulhi();
 
1588
        opn = "mulhi";
 
1589
        break;
 
1590
    case OPC_VR54XX_MULHIU:
 
1591
        gen_op_mulhiu();
 
1592
        opn = "mulhiu";
 
1593
        break;
 
1594
    case OPC_VR54XX_MULSHI:
 
1595
        gen_op_mulshi();
 
1596
        opn = "mulshi";
 
1597
        break;
 
1598
    case OPC_VR54XX_MULSHIU:
 
1599
        gen_op_mulshiu();
 
1600
        opn = "mulshiu";
 
1601
        break;
 
1602
    case OPC_VR54XX_MACCHI:
 
1603
        gen_op_macchi();
 
1604
        opn = "macchi";
 
1605
        break;
 
1606
    case OPC_VR54XX_MACCHIU:
 
1607
        gen_op_macchiu();
 
1608
        opn = "macchiu";
 
1609
        break;
 
1610
    case OPC_VR54XX_MSACHI:
 
1611
        gen_op_msachi();
 
1612
        opn = "msachi";
 
1613
        break;
 
1614
    case OPC_VR54XX_MSACHIU:
 
1615
        gen_op_msachiu();
 
1616
        opn = "msachiu";
 
1617
        break;
 
1618
    default:
 
1619
        MIPS_INVAL("mul vr54xx");
 
1620
        generate_exception(ctx, EXCP_RI);
 
1621
        return;
 
1622
    }
 
1623
    GEN_STORE_T0_REG(rd);
 
1624
    MIPS_DEBUG("%s %s, %s, %s", opn, regnames[rd], regnames[rs], regnames[rt]);
 
1625
}
 
1626
 
1533
1627
static void gen_cl (DisasContext *ctx, uint32_t opc,
1534
1628
                    int rd, int rs)
1535
1629
{
5973
6067
            gen_arith(env, ctx, op1, rd, rs, rt);
5974
6068
            break;
5975
6069
        case OPC_MULT ... OPC_DIVU:
5976
 
            gen_muldiv(ctx, op1, rs, rt);
 
6070
            if (sa) {
 
6071
                check_insn(env, ctx, INSN_VR54XX);
 
6072
                op1 = MASK_MUL_VR54XX(ctx->opcode);
 
6073
                gen_mul_vr54xx(ctx, op1, rd, rs, rt);
 
6074
            } else
 
6075
                gen_muldiv(ctx, op1, rs, rt);
5977
6076
            break;
5978
6077
        case OPC_JR ... OPC_JALR:
5979
6078
            gen_compute_branch(ctx, op1, rs, rd, sa);
6724
6823
 
6725
6824
    if (!SIGN_EXT_P(env->PC[env->current_tc]))
6726
6825
        cpu_fprintf(f, "BROKEN: pc=0x" TARGET_FMT_lx "\n", env->PC[env->current_tc]);
6727
 
    if (!SIGN_EXT_P(env->HI[env->current_tc]))
6728
 
        cpu_fprintf(f, "BROKEN: HI=0x" TARGET_FMT_lx "\n", env->HI[env->current_tc]);
6729
 
    if (!SIGN_EXT_P(env->LO[env->current_tc]))
6730
 
        cpu_fprintf(f, "BROKEN: LO=0x" TARGET_FMT_lx "\n", env->LO[env->current_tc]);
 
6826
    if (!SIGN_EXT_P(env->HI[0][env->current_tc]))
 
6827
        cpu_fprintf(f, "BROKEN: HI=0x" TARGET_FMT_lx "\n", env->HI[0][env->current_tc]);
 
6828
    if (!SIGN_EXT_P(env->LO[0][env->current_tc]))
 
6829
        cpu_fprintf(f, "BROKEN: LO=0x" TARGET_FMT_lx "\n", env->LO[0][env->current_tc]);
6731
6830
    if (!SIGN_EXT_P(env->btarget))
6732
6831
        cpu_fprintf(f, "BROKEN: btarget=0x" TARGET_FMT_lx "\n", env->btarget);
6733
6832