diff options
author | Mark McLoughlin <markmc@redhat.com> | 2009-10-28 10:55:42 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2009-10-28 10:55:42 +0000 |
commit | 3deaf5aa6ab23d2f8b0250ea63908a30ff2726af (patch) | |
tree | 5109988bec768a066a9b7b39f4411f422b3f67b3 /target-i386 | |
parent | Update bios.bin (vapic removal) (diff) | |
parent | ne2k_isa: use qdev properties for configuration. (diff) | |
download | qemu-kvm-3deaf5aa6ab23d2f8b0250ea63908a30ff2726af.tar.gz qemu-kvm-3deaf5aa6ab23d2f8b0250ea63908a30ff2726af.tar.bz2 qemu-kvm-3deaf5aa6ab23d2f8b0250ea63908a30ff2726af.zip |
Merge commit '93db66850d99fd9885edeff6af5679be51e1c610' into upstream-merge
* commit '93db66850d99fd9885edeff6af5679be51e1c610': (81 commits)
ne2k_isa: use qdev properties for configuration.
qdev/net: common nic property bits
qdev: add vlan property
qdev: add netdev property
qdev: mac addr property fixups
net: add macaddr type.
Send a RARP packet after migration.
multiboot.S patch for old as(1) (was: Re: [Qemu-devel] Some OpenBSD/amd64 build fixes)
raw/linux-aio: Also initialize POSIX AIO
qcow2: Fix grow_refcount_table error handling
usb-linux: return USB_RET_STALL on -EPIPE
Makefile: Change make to be quiet again when doing nothing
eepro100: Restructure code
target-arm: use native tcg-ops for ror/bic/vorn
target-arm: fix neon shift helper functions
target-arm: fix neon vsri, vshl and vsli ops
target-arm: allow modifying vfp fpexc en bit only
target-arm: add support for neon vld1.64/vst1.64 instructions
target-arm: fix neon vshrn/vrshrn ops
target-arm: fix incorrect temporary variable freeing
...
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Diffstat (limited to 'target-i386')
-rw-r--r-- | target-i386/helper.h | 1 | ||||
-rw-r--r-- | target-i386/machine.c | 10 | ||||
-rw-r--r-- | target-i386/op_helper.c | 14 | ||||
-rw-r--r-- | target-i386/translate.c | 37 |
4 files changed, 43 insertions, 19 deletions
diff --git a/target-i386/helper.h b/target-i386/helper.h index ca953f47d..6b518ad89 100644 --- a/target-i386/helper.h +++ b/target-i386/helper.h @@ -193,6 +193,7 @@ DEF_HELPER_2(fxsave, void, tl, int) DEF_HELPER_2(fxrstor, void, tl, int) DEF_HELPER_1(bsf, tl, tl) DEF_HELPER_1(bsr, tl, tl) +DEF_HELPER_2(lzcnt, tl, tl, int) /* MMX/SSE */ diff --git a/target-i386/machine.c b/target-i386/machine.c index b364936eb..f6fdc9ddd 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -117,7 +117,7 @@ static void put_fpreg(QEMUFile *f, void *opaque, size_t size) qemu_put_be16s(f, &exp); } -const VMStateInfo vmstate_fpreg = { +static const VMStateInfo vmstate_fpreg = { .name = "fpreg", .get = get_fpreg, .put = put_fpreg, @@ -134,7 +134,7 @@ static int get_fpreg_1_mmx(QEMUFile *f, void *opaque, size_t size) return 0; } -const VMStateInfo vmstate_fpreg_1_mmx = { +static const VMStateInfo vmstate_fpreg_1_mmx = { .name = "fpreg_1_mmx", .get = get_fpreg_1_mmx, .put = put_fpreg_error, @@ -150,7 +150,7 @@ static int get_fpreg_1_no_mmx(QEMUFile *f, void *opaque, size_t size) return 0; } -const VMStateInfo vmstate_fpreg_1_no_mmx = { +static const VMStateInfo vmstate_fpreg_1_no_mmx = { .name = "fpreg_1_no_mmx", .get = get_fpreg_1_no_mmx, .put = put_fpreg_error, @@ -308,7 +308,7 @@ static void put_uint64_as_uint32(QEMUFile *f, void *pv, size_t size) qemu_put_be32(f, *v); } -const VMStateInfo vmstate_hack_uint64_as_uint32 = { +static const VMStateInfo vmstate_hack_uint64_as_uint32 = { .name = "uint64_as_uint32", .get = get_uint64_as_uint32, .put = put_uint64_as_uint32, @@ -391,7 +391,7 @@ static int cpu_post_load(void *opaque, int version_id) return 0; } -const VMStateDescription vmstate_cpu = { +static const VMStateDescription vmstate_cpu = { .name = "cpu", .version_id = CPU_SAVE_VERSION, .minimum_version_id = 3, diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index 26fe61204..5eea3221b 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -5479,11 +5479,14 @@ target_ulong helper_bsf(target_ulong t0) return count; } -target_ulong helper_bsr(target_ulong t0) +target_ulong helper_lzcnt(target_ulong t0, int wordsize) { int count; target_ulong res, mask; - + + if (wordsize > 0 && t0 == 0) { + return wordsize; + } res = t0; count = TARGET_LONG_BITS - 1; mask = (target_ulong)1 << (TARGET_LONG_BITS - 1); @@ -5491,9 +5494,16 @@ target_ulong helper_bsr(target_ulong t0) count--; res <<= 1; } + if (wordsize > 0) { + return wordsize - 1 - count; + } return count; } +target_ulong helper_bsr(target_ulong t0) +{ + return helper_lzcnt(t0, 0); +} static int compute_all_eflags(void) { diff --git a/target-i386/translate.c b/target-i386/translate.c index 251194394..64bc0a3f3 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -6573,23 +6573,36 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) ot = dflag + OT_WORD; modrm = ldub_code(s->pc++); reg = ((modrm >> 3) & 7) | rex_r; - gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); + gen_ldst_modrm(s,modrm, ot, OR_TMP0, 0); gen_extu(ot, cpu_T[0]); - label1 = gen_new_label(); - tcg_gen_movi_tl(cpu_cc_dst, 0); t0 = tcg_temp_local_new(); tcg_gen_mov_tl(t0, cpu_T[0]); - tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, label1); - if (b & 1) { - gen_helper_bsr(cpu_T[0], t0); + if ((b & 1) && (prefixes & PREFIX_REPZ) && + (s->cpuid_ext3_features & CPUID_EXT3_ABM)) { + switch(ot) { + case OT_WORD: gen_helper_lzcnt(cpu_T[0], t0, + tcg_const_i32(16)); break; + case OT_LONG: gen_helper_lzcnt(cpu_T[0], t0, + tcg_const_i32(32)); break; + case OT_QUAD: gen_helper_lzcnt(cpu_T[0], t0, + tcg_const_i32(64)); break; + } + gen_op_mov_reg_T0(ot, reg); } else { - gen_helper_bsf(cpu_T[0], t0); + label1 = gen_new_label(); + tcg_gen_movi_tl(cpu_cc_dst, 0); + tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, label1); + if (b & 1) { + gen_helper_bsr(cpu_T[0], t0); + } else { + gen_helper_bsf(cpu_T[0], t0); + } + gen_op_mov_reg_T0(ot, reg); + tcg_gen_movi_tl(cpu_cc_dst, 1); + gen_set_label(label1); + tcg_gen_discard_tl(cpu_cc_src); + s->cc_op = CC_OP_LOGICB + ot; } - gen_op_mov_reg_T0(ot, reg); - tcg_gen_movi_tl(cpu_cc_dst, 1); - gen_set_label(label1); - tcg_gen_discard_tl(cpu_cc_src); - s->cc_op = CC_OP_LOGICB + ot; tcg_temp_free(t0); } break; |