Revision 2cade6a3 target-sparc/op_helper.c

b/target-sparc/op_helper.c
32 32
#define DPRINTF_ASI(fmt, args...) do {} while (0)
33 33
#endif
34 34

  
35
#ifdef TARGET_ABI32
36
#define ABI32_MASK(addr) do { (addr) &= 0xffffffffULL; } while (0)
35
#ifdef TARGET_SPARC64
36
#ifndef TARGET_ABI32
37
#define AM_CHECK(env1) ((env1)->pstate & PS_AM)
37 38
#else
38
#define ABI32_MASK(addr) do {} while (0)
39
#define AM_CHECK(env1) (1)
40
#endif
39 41
#endif
40 42

  
43
static inline void address_mask(CPUState *env1, target_ulong *addr)
44
{
45
#ifdef TARGET_SPARC64
46
    if (AM_CHECK(env1))
47
        *addr &= 0xffffffffULL;
48
#endif
49
}
50

  
41 51
void raise_exception(int tt)
42 52
{
43 53
    env->exception_index = tt;
......
1381 1391
        raise_exception(TT_PRIV_ACT);
1382 1392

  
1383 1393
    helper_check_align(addr, size - 1);
1384
    ABI32_MASK(addr);
1394
    address_mask(env, &addr);
1385 1395

  
1386 1396
    switch (asi) {
1387 1397
    case 0x80: // Primary
......
1470 1480
        raise_exception(TT_PRIV_ACT);
1471 1481

  
1472 1482
    helper_check_align(addr, size - 1);
1473
    ABI32_MASK(addr);
1483
    address_mask(env, &addr);
1474 1484

  
1475 1485
    /* Convert to little endian */
1476 1486
    switch (asi) {
......
2330 2340
        break;
2331 2341
    }
2332 2342
#else
2333
    ABI32_MASK(addr);
2343
    address_mask(env, &addr);
2334 2344
    stfq_raw(addr, DT0);
2335 2345
#endif
2336 2346
}
......
2355 2365
        break;
2356 2366
    }
2357 2367
#else
2358
    ABI32_MASK(addr);
2368
    address_mask(env, &addr);
2359 2369
    DT0 = ldfq_raw(addr);
2360 2370
#endif
2361 2371
}
......
2389 2399
        break;
2390 2400
    }
2391 2401
#else
2392
    ABI32_MASK(addr);
2402
    address_mask(env, &addr);
2393 2403
    u.ll.upper = ldq_raw(addr);
2394 2404
    u.ll.lower = ldq_raw((addr + 8) & 0xffffffffULL);
2395 2405
    QT0 = u.q;
......
2426 2436
    }
2427 2437
#else
2428 2438
    u.q = QT0;
2429
    ABI32_MASK(addr);
2439
    address_mask(env, &addr);
2430 2440
    stq_raw(addr, u.ll.upper);
2431 2441
    stq_raw((addr + 8) & 0xffffffffULL, u.ll.lower);
2432 2442
#endif

Also available in: Unified diff