[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/25] target-i386: fix typo in xsetbv implementation
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 09/25] target-i386: fix typo in xsetbv implementation |
Date: |
Tue, 2 Aug 2016 21:39:19 +0200 |
From: Dave Hansen <address@hidden>
QEMU 2.6 added support for the XSAVE family of instructions, which
includes the XSETBV instruction which allows setting the XCR0
register.
But, when booting Linux kernels with XSAVE support enabled, I was
getting very early crashes where the instruction pointer was set
to 0x3. I tracked it down to a jump instruction generated by this:
gen_jmp_im(s->pc - pc_start);
where s->pc is pointing to the instruction after XSETBV and pc_start
is pointing _at_ XSETBV. Subtract the two and you get 0x3. Whoops.
The fix is to replace this typo with the pattern found everywhere
else in the file when folks want to end the translation buffer.
Richard Henderson confirmed that this is a bug and that this is the
correct fix.
Signed-off-by: Dave Hansen <address@hidden>
Cc: address@hidden
Cc: Eduardo Habkost <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
target-i386/translate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target-i386/translate.c b/target-i386/translate.c
index e81fce7..fa2ac48 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -7176,7 +7176,7 @@ static target_ulong disas_insn(CPUX86State *env,
DisasContext *s,
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[R_ECX]);
gen_helper_xsetbv(cpu_env, cpu_tmp2_i32, cpu_tmp1_i64);
/* End TB because translation flags may change. */
- gen_jmp_im(s->pc - pc_start);
+ gen_jmp_im(s->pc - s->cs_base);
gen_eob(s);
break;
--
2.7.4
- [Qemu-devel] [PULL 00/25] Misc QEMU fixes for 2016-08-02, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 01/25] util/qht: Document memory ordering assumptions, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 02/25] numa: set the memory backend "is_mapped" field, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 03/25] fix qemu exit on memory hotplug when allocation fails at prealloc time, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 04/25] checkpatch: add check for bzero, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 06/25] util: drop unix_nonblocking_connect(), Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 05/25] util: drop inet_nonblocking_connect(), Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 08/25] qht: do not segfault when gathering stats from an uninitialized qht, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 09/25] target-i386: fix typo in xsetbv implementation,
Paolo Bonzini <=
- [Qemu-devel] [PULL 10/25] qdist: fix memory leak during binning, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 07/25] util: Drop inet_listen(), Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 11/25] qdist: use g_realloc_n instead of g_realloc, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 12/25] qdist: return "(empty)" instead of NULL when printing an empty dist, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 13/25] mptsas: really fix migration compatibility, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 14/25] i2c: fix migration regression introduced by broadcast support, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 15/25] nbd: Fix bad flag detection on server, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 19/25] fw_cfg: Make base type "fw_cfg" abstract, Paolo Bonzini, 2016/08/02
- [Qemu-devel] [PULL 18/25] block: Cater to iscsi with non-power-of-2 discard, Paolo Bonzini, 2016/08/02