Revision 426613db target-ppc/translate.c

b/target-ppc/translate.c
1584 1584
GEN_FLOAT_B(ctiwz, 0x0F, 0x00);
1585 1585
/* frsp */
1586 1586
GEN_FLOAT_B(rsp, 0x0C, 0x00);
1587
#if defined(TARGET_PPC64)
1588
/* fcfid */
1589
GEN_FLOAT_B(cfid, 0x0E, 0x1A);
1590
/* fctid */
1591
GEN_FLOAT_B(ctid, 0x0E, 0x19);
1592
/* fctidz */
1593
GEN_FLOAT_B(ctidz, 0x0F, 0x19);
1594
#endif
1587 1595

  
1588 1596
/***                         Floating-Point compare                        ***/
1589 1597
/* fcmpo */
......
1996 2004
GEN_STS(w, 0x04, PPC_INTEGER);
1997 2005
#if defined(TARGET_PPC64)
1998 2006
OP_ST_TABLE(d);
1999
GEN_STUX(d, 0x15, 0x01, PPC_64B);
2000
GEN_STX(d, 0x15, 0x00, PPC_64B);
2007
GEN_STUX(d, 0x15, 0x05, PPC_64B);
2008
GEN_STX(d, 0x15, 0x04, PPC_64B);
2001 2009
GEN_HANDLER(std, 0x3E, 0xFF, 0xFF, 0x00000002, PPC_64B)
2002 2010
{
2003 2011
    if (Rc(ctx->opcode)) {
......
2358 2366
    op_stwcx();
2359 2367
}
2360 2368

  
2369
#if defined(TARGET_PPC64)
2370
#define op_ldarx() (*gen_op_ldarx[ctx->mem_idx])()
2371
#define op_stdcx() (*gen_op_stdcx[ctx->mem_idx])()
2372
#if defined(CONFIG_USER_ONLY)
2373
static GenOpFunc *gen_op_ldarx[] = {
2374
    &gen_op_ldarx_raw,
2375
    &gen_op_ldarx_le_raw,
2376
    &gen_op_ldarx_64_raw,
2377
    &gen_op_ldarx_le_64_raw,
2378
};
2379
static GenOpFunc *gen_op_stdcx[] = {
2380
    &gen_op_stdcx_raw,
2381
    &gen_op_stdcx_le_raw,
2382
    &gen_op_stdcx_64_raw,
2383
    &gen_op_stdcx_le_64_raw,
2384
};
2385
#else
2386
static GenOpFunc *gen_op_ldarx[] = {
2387
    &gen_op_ldarx_user,
2388
    &gen_op_ldarx_le_user,
2389
    &gen_op_ldarx_kernel,
2390
    &gen_op_ldarx_le_kernel,
2391
    &gen_op_ldarx_64_user,
2392
    &gen_op_ldarx_le_64_user,
2393
    &gen_op_ldarx_64_kernel,
2394
    &gen_op_ldarx_le_64_kernel,
2395
};
2396
static GenOpFunc *gen_op_stdcx[] = {
2397
    &gen_op_stdcx_user,
2398
    &gen_op_stdcx_le_user,
2399
    &gen_op_stdcx_kernel,
2400
    &gen_op_stdcx_le_kernel,
2401
    &gen_op_stdcx_64_user,
2402
    &gen_op_stdcx_le_64_user,
2403
    &gen_op_stdcx_64_kernel,
2404
    &gen_op_stdcx_le_64_kernel,
2405
};
2406
#endif
2407

  
2408
/* ldarx */
2409
GEN_HANDLER(ldarx, 0x1F, 0x14, 0x02, 0x00000001, PPC_RES)
2410
{
2411
    gen_addr_reg_index(ctx);
2412
    op_ldarx();
2413
    gen_op_store_T1_gpr(rD(ctx->opcode));
2414
}
2415

  
2416
/* stdcx. */
2417
GEN_HANDLER(stdcx_, 0x1F, 0x16, 0x06, 0x00000000, PPC_RES)
2418
{
2419
    gen_addr_reg_index(ctx);
2420
    gen_op_load_gpr_T1(rS(ctx->opcode));
2421
    op_stdcx();
2422
}
2423
#endif /* defined(TARGET_PPC64) */
2424

  
2361 2425
/* sync */
2362 2426
GEN_HANDLER(sync, 0x1F, 0x16, 0x12, 0x03FF0801, PPC_MEM_SYNC)
2363 2427
{
......
2807 2871
#endif
2808 2872
}
2809 2873

  
2874
#if defined(TARGET_PPC64)
2875
GEN_HANDLER(rfid, 0x13, 0x12, 0x00, 0x03FF8001, PPC_FLOW)
2876
{
2877
#if defined(CONFIG_USER_ONLY)
2878
    RET_PRIVOPC(ctx);
2879
#else
2880
    /* Restore CPU state */
2881
    if (unlikely(!ctx->supervisor)) {
2882
        RET_PRIVOPC(ctx);
2883
        return;
2884
    }
2885
    if (!ctx->sf_mode)
2886
        gen_op_rfid_32();
2887
    else
2888
        gen_op_rfid();
2889
    RET_CHG_FLOW(ctx);
2890
#endif
2891
}
2892
#endif
2893

  
2810 2894
/* sc */
2811 2895
GEN_HANDLER(sc, 0x11, 0xFF, 0xFF, 0x03FFFFFD, PPC_FLOW)
2812 2896
{
......
2978 3062
}
2979 3063

  
2980 3064
/* mtmsr */
3065
#if defined(TARGET_PPC64)
3066
GEN_HANDLER(mtmsrd, 0x1F, 0x12, 0x05, 0x001FF801, PPC_MISC)
3067
{
3068
#if defined(CONFIG_USER_ONLY)
3069
    RET_PRIVREG(ctx);
3070
#else
3071
    if (unlikely(!ctx->supervisor)) {
3072
        RET_PRIVREG(ctx);
3073
        return;
3074
    }
3075
    gen_update_nip(ctx, ctx->nip);
3076
    gen_op_load_gpr_T0(rS(ctx->opcode));
3077
    gen_op_store_msr();
3078
    /* Must stop the translation as machine state (may have) changed */
3079
    RET_CHG_FLOW(ctx);
3080
#endif
3081
}
3082
#endif
3083

  
2981 3084
GEN_HANDLER(mtmsr, 0x1F, 0x12, 0x04, 0x001FF801, PPC_MISC)
2982 3085
{
2983 3086
#if defined(CONFIG_USER_ONLY)
......
3313 3416
#endif
3314 3417
}
3315 3418

  
3419
#if defined(TARGET_PPC64)
3420
/* slbia */
3421
GEN_HANDLER(slbia, 0x1F, 0x12, 0x0F, 0x03FFFC01, PPC_SLBI)
3422
{
3423
#if defined(CONFIG_USER_ONLY)
3424
    RET_PRIVOPC(ctx);
3425
#else
3426
    if (unlikely(!ctx->supervisor)) {
3427
        if (loglevel)
3428
            fprintf(logfile, "%s: ! supervisor\n", __func__);
3429
        RET_PRIVOPC(ctx);
3430
        return;
3431
    }
3432
    gen_op_slbia();
3433
    RET_STOP(ctx);
3434
#endif
3435
}
3436

  
3437
/* slbie */
3438
GEN_HANDLER(slbie, 0x1F, 0x12, 0x0D, 0x03FF0001, PPC_SLBI)
3439
{
3440
#if defined(CONFIG_USER_ONLY)
3441
    RET_PRIVOPC(ctx);
3442
#else
3443
    if (unlikely(!ctx->supervisor)) {
3444
        RET_PRIVOPC(ctx);
3445
        return;
3446
    }
3447
    gen_op_load_gpr_T0(rB(ctx->opcode));
3448
    gen_op_slbie();
3449
    RET_STOP(ctx);
3450
#endif
3451
}
3452
#endif
3453

  
3316 3454
/***                              External control                         ***/
3317 3455
/* Optional: */
3318 3456
#define op_eciwx() (*gen_op_eciwx[ctx->mem_idx])()

Also available in: Unified diff