From: "Mohammed Gamal" Subject: Re: [RFC][PATCH] VMX: Invalid guest state emulation Date: Mon, 4 Aug 2008 13:46:42 +0300 Message-ID: <52d4a3890808040346j618dcb46tdf89cbcd97a84c9a@mail.gmail.com> References: <20080803020826.GA20831@mohd-laptop> <20080803132601.GA9575@mohd-laptop> <20080804104841.4b3ed92e@frecb000711> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, avi@qumranet.com, riel@surriel.com, andrea@qumranet.com, laurent.vivier@bull.net To: "Guillaume Thouvenin" Return-path: Received: from an-out-0708.google.com ([209.85.132.251]:46026 "EHLO an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752529AbYHDKqn (ORCPT ); Mon, 4 Aug 2008 06:46:43 -0400 Received: by an-out-0708.google.com with SMTP id d40so307988and.103 for ; Mon, 04 Aug 2008 03:46:42 -0700 (PDT) In-Reply-To: <20080804104841.4b3ed92e@frecb000711> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Aug 4, 2008 at 11:48 AM, Guillaume Thouvenin wrote: > On Sun, 3 Aug 2008 16:26:01 +0300 > Mohammed Gamal wrote: > >> [This resend adds the sign-offs and fixes a typo that was in the previous patch] >> >> This patch aims to allow emulation whenever guest state is not valid for VMX operation, which occurs while trying to emulate big real mode on guests >> such as older versions of gfxboot and FreeDOS with HIMEM. > > I tried the patch with an openSUSE-10.3 and I got the following failure: > > [~/work/kvm.git/kvm]$ /home/guill/local/kvm-userspace.git/bin/qemu-system-x86_64 -hda /images/disk/hda_10G.qcow2 -cdrom /images/iso/openSUSE-10.3-GM-x86_64-mini.iso -boot d > unhandled vm exit: 0x80000021 vcpu_id 0 > rax 000000000000f002 rbx 000000000000d8d1 rcx 0000000000000000 rdx 0000000000000402 > rsi 00000000ffff0000 rdi 0000000000080000 rsp 000000000000fffc rbp 0000000000008271 > r8 0000000000000000 r9 0000000000000000 r10 0000000000000000 r11 0000000000000000 > r12 0000000000000000 r13 0000000000000000 r14 0000000000000000 r15 0000000000000000 > rip 000000000000b1ec rflags 00023046 > cs f000 (000f0000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) > ds 0000 (00000000/00000000 p 0 dpl 0 db 0 s 0 type 0 l 0 g 0 avl 0) > es 0000 (00000000/00000000 p 0 dpl 0 db 0 s 0 type 0 l 0 g 0 avl 0) > ss 0000 (00000000/00000000 p 0 dpl 0 db 0 s 0 type 0 l 0 g 0 avl 0) > fs 0000 (00000000/00000000 p 0 dpl 0 db 0 s 0 type 0 l 0 g 0 avl 0) > gs 0000 (00000000/00000000 p 0 dpl 0 db 0 s 0 type 0 l 0 g 0 avl 0) > tr 0000 (fffbd000/00002088 p 1 dpl 0 db 0 s 0 type b l 0 g 0 avl 0) > ldt 0000 (00000000/0000ffff p 1 dpl 0 db 0 s 0 type 2 l 0 g 0 avl 0) > gdt fb1f2/30 > idt 0/3ff > cr0 10 cr2 0 cr3 0 cr4 0 cr8 0 efer 0 > Aborted > > and also: > > [ 3379.569530] emulation failed (vmentry failure) rip fff0 c0 20 d4 8b > [ 3380.426135] emulation failed (vmentry failure) rip fb180 fc be 00 00 > [ 3380.495821] emulation failed (vmentry failure) rip b1e9 e6 92 c3 30 > > Best regards, > Guillaume > I'm getting the same here too. This is because the BIOS jumps between 16-bit protected mode and real mode, causing the VM to be in an invalid guest state and thereby invoking the emulator which will fail when encountering an instruction it doesn't include yet. What's needed to do is add these instructions causing the failure to the x86 emulator.