From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: Question about the kvm emulator Date: Thu, 22 May 2014 13:42:06 +0200 Message-ID: <537DE28E.7040900@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit To: Jidong Xiao , KVM Return-path: Received: from mail-ee0-f43.google.com ([74.125.83.43]:42696 "EHLO mail-ee0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752584AbaEVLmL (ORCPT ); Thu, 22 May 2014 07:42:11 -0400 Received: by mail-ee0-f43.google.com with SMTP id d17so2591701eek.30 for ; Thu, 22 May 2014 04:42:10 -0700 (PDT) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Il 22/05/2014 05:55, Jidong Xiao ha scritto: > Hi, > > I noticed that there is a file call emulate.c, under the directory of > arch/x86/kvm/, in its header part, it says: > > "Generic x86 (32-bit and 64-bit) instruction decoder and emulator." > > I am confused about this, since qemu will be the emulator, why does > kvm itself also includes such an emulator? In particular, I added some > printk debug statement in x86_emulate_insn() and > emulate_instruction(), but I never see them being invoked. Can someone > kindly explain this, thank you! QEMU is providing the device model and interfaces with KVM. QEMU's CPU emulation functionality is not used when running with KVM. The KVM emulator is used: 1) to execute instructions that read or write to device memory; 2) to run "big real mode" programs on microprocessors that do not support it natively, for example Intel processors older than Westmere. Paolo