~ubuntu-branches/ubuntu/saucy/qemu/saucy-proposed

« back to all changes in this revision

Viewing changes to target-ppc/int_helper.c

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-05-28 08:18:30 UTC
  • mfrom: (1.8.2) (10.1.37 sid)
  • Revision ID: package-import@ubuntu.com-20130528081830-87xl2z9fq516a814
Tags: 1.5.0+dfsg-2ubuntu1
* Merge 1.5.0+dfs-2 from debian unstable.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - Dropped patches:
    * 0001-fix-wrong-output-with-info-chardev-for-tcp-socket.patch
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * gridcentric patch - updated
    * linaro arm patches from qemu-linaro rebasing branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
/* Fixed point operations helpers */
26
26
#if defined(TARGET_PPC64)
27
27
 
28
 
/* multiply high word */
29
 
uint64_t helper_mulhd(uint64_t arg1, uint64_t arg2)
30
 
{
31
 
    uint64_t tl, th;
32
 
 
33
 
    muls64(&tl, &th, arg1, arg2);
34
 
    return th;
35
 
}
36
 
 
37
 
/* multiply high word unsigned */
38
 
uint64_t helper_mulhdu(uint64_t arg1, uint64_t arg2)
39
 
{
40
 
    uint64_t tl, th;
41
 
 
42
 
    mulu64(&tl, &th, arg1, arg2);
43
 
    return th;
44
 
}
45
 
 
46
28
uint64_t helper_mulldo(CPUPPCState *env, uint64_t arg1, uint64_t arg2)
47
29
{
48
30
    int64_t th;
51
33
    muls64(&tl, (uint64_t *)&th, arg1, arg2);
52
34
    /* If th != 0 && th != -1, then we had an overflow */
53
35
    if (likely((uint64_t)(th + 1) <= 1)) {
54
 
        env->xer &= ~(1 << XER_OV);
 
36
        env->ov = 0;
55
37
    } else {
56
 
        env->xer |= (1 << XER_OV) | (1 << XER_SO);
 
38
        env->so = env->ov = 1;
57
39
    }
58
40
    return (int64_t)tl;
59
41
}
71
53
}
72
54
#endif
73
55
 
 
56
target_ulong helper_cmpb(target_ulong rs, target_ulong rb)
 
57
{
 
58
    target_ulong mask = 0xff;
 
59
    target_ulong ra = 0;
 
60
    int i;
 
61
 
 
62
    for (i = 0; i < sizeof(target_ulong); i++) {
 
63
        if ((rs & mask) == (rb & mask)) {
 
64
            ra |= mask;
 
65
        }
 
66
        mask <<= 8;
 
67
    }
 
68
    return ra;
 
69
}
 
70
 
74
71
/* shift right arithmetic helper */
75
72
target_ulong helper_sraw(CPUPPCState *env, target_ulong value,
76
73
                         target_ulong shift)
82
79
            shift &= 0x1f;
83
80
            ret = (int32_t)value >> shift;
84
81
            if (likely(ret >= 0 || (value & ((1 << shift) - 1)) == 0)) {
85
 
                env->xer &= ~(1 << XER_CA);
 
82
                env->ca = 0;
86
83
            } else {
87
 
                env->xer |= (1 << XER_CA);
 
84
                env->ca = 1;
88
85
            }
89
86
        } else {
90
87
            ret = (int32_t)value;
91
 
            env->xer &= ~(1 << XER_CA);
 
88
            env->ca = 0;
92
89
        }
93
90
    } else {
94
91
        ret = (int32_t)value >> 31;
95
 
        if (ret) {
96
 
            env->xer |= (1 << XER_CA);
97
 
        } else {
98
 
            env->xer &= ~(1 << XER_CA);
99
 
        }
 
92
        env->ca = (ret != 0);
100
93
    }
101
94
    return (target_long)ret;
102
95
}
112
105
            shift &= 0x3f;
113
106
            ret = (int64_t)value >> shift;
114
107
            if (likely(ret >= 0 || (value & ((1 << shift) - 1)) == 0)) {
115
 
                env->xer &= ~(1 << XER_CA);
 
108
                env->ca = 0;
116
109
            } else {
117
 
                env->xer |= (1 << XER_CA);
 
110
                env->ca = 1;
118
111
            }
119
112
        } else {
120
113
            ret = (int64_t)value;
121
 
            env->xer &= ~(1 << XER_CA);
 
114
            env->ca = 0;
122
115
        }
123
116
    } else {
124
117
        ret = (int64_t)value >> 63;
125
 
        if (ret) {
126
 
            env->xer |= (1 << XER_CA);
127
 
        } else {
128
 
            env->xer &= ~(1 << XER_CA);
129
 
        }
 
118
        env->ca = (ret != 0);
130
119
    }
131
120
    return ret;
132
121
}
206
195
 
207
196
    if (((int32_t)tmp == INT32_MIN && (int32_t)arg2 == (int32_t)-1) ||
208
197
        (int32_t)arg2 == 0) {
209
 
        env->xer |= (1 << XER_OV) | (1 << XER_SO);
 
198
        env->so = env->ov = 1;
210
199
        env->spr[SPR_MQ] = 0;
211
200
        return INT32_MIN;
212
201
    } else {
213
202
        env->spr[SPR_MQ] = tmp % arg2;
214
203
        tmp /= (int32_t)arg2;
215
204
        if ((int32_t)tmp != tmp) {
216
 
            env->xer |= (1 << XER_OV) | (1 << XER_SO);
 
205
            env->so = env->ov = 1;
217
206
        } else {
218
 
            env->xer &= ~(1 << XER_OV);
 
207
            env->ov = 0;
219
208
        }
220
209
        return tmp;
221
210
    }
239
228
{
240
229
    if (((int32_t)arg1 == INT32_MIN && (int32_t)arg2 == (int32_t)-1) ||
241
230
        (int32_t)arg2 == 0) {
242
 
        env->xer |= (1 << XER_OV) | (1 << XER_SO);
 
231
        env->so = env->ov = 1;
243
232
        env->spr[SPR_MQ] = 0;
244
233
        return INT32_MIN;
245
234
    } else {
246
 
        env->xer &= ~(1 << XER_OV);
 
235
        env->ov = 0;
247
236
        env->spr[SPR_MQ] = (int32_t)arg1 % (int32_t)arg2;
248
237
        return (int32_t)arg1 / (int32_t)arg2;
249
238
    }