From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Cross vendor migration ideas Date: Sun, 16 Nov 2008 16:58:59 +0200 Message-ID: <49203533.2060209@redhat.com> References: <982D8D05B6407A49AD506E6C3AC8E7D6BEF936912A@caralain.haven.nynaeve.net> <7CCF7468C07AFF4B991DD1528058EC2F042C7283@SSVLEXMB1.amd.com> <878wrl16q5.fsf@basil.nowhere.org> <1FF5F416-082C-4FA2-8392-8552BFBEDA00@suse.de> <5d6222a80811150938r1ed70764s678bd5b7552b0fb5@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Alexander Graf , Andi Kleen , "Serebrin, Benjamin (Calendar)" , Skywing , Anthony Liguori , kvm@vger.kernel.org, Amit Shah , "Wahlig, Elsie" , "Nakajima, Jun" To: Glauber Costa Return-path: Received: from mx2.redhat.com ([66.187.237.31]:39630 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751945AbYKPO73 (ORCPT ); Sun, 16 Nov 2008 09:59:29 -0500 In-Reply-To: <5d6222a80811150938r1ed70764s678bd5b7552b0fb5@mail.gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Glauber Costa wrote: > We can possibly do it a little bit better by emulating in the guest directly. > So the deal would be emulation both in the host and the guest. If the > guest have it, > fine. Otherwise, we use host emulation, that is slower, but works. > If the guest is modifiable, this is easy. Include both syscall and sysenter paths in the vsyscall page, with a jmp to select between them. If we trap a #UD pointing at a syscall or sysenter, emulate it, and patch the jmp instruction to point at the other path. This way we have a self-adjusting syscall/sysenter entry point. We also need to tell kvm not to emulate the instruction, so that the #UD actually reaches the kernel. If the guest is not modifiable, this means patching. This is much harder than tpr patching since we don't have any space to hide our code in. Maybe we can reverse engineer the vsyscall page and hack it, but this may take a lot of work. -- error compiling committee.c: too many arguments to function