From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M4Shx-00039I-7c for qemu-devel@nongnu.org; Thu, 14 May 2009 00:38:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M4Shs-00037g-FE for qemu-devel@nongnu.org; Thu, 14 May 2009 00:38:12 -0400 Received: from [199.232.76.173] (port=52939 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M4Shs-00037d-Ay for qemu-devel@nongnu.org; Thu, 14 May 2009 00:38:08 -0400 Received: from rv-out-0708.google.com ([209.85.198.248]:29158) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M4Shr-0001n3-UC for qemu-devel@nongnu.org; Thu, 14 May 2009 00:38:08 -0400 Received: by rv-out-0708.google.com with SMTP id f25so2674742rvb.2 for ; Wed, 13 May 2009 21:38:06 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <851.61304.qm@web28606.mail.ukl.yahoo.com> References: <851.61304.qm@web28606.mail.ukl.yahoo.com> Date: Thu, 14 May 2009 11:38:06 +0700 Message-ID: Subject: Re: [Qemu-devel] How does a system call work on QEMU? From: Mulyadi Santosa Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: helicoterus-elih@yahoo.it Cc: qemu-devel@nongnu.org On 5/14/09, helicoterus-elih@yahoo.it wrote: > > Paravirtualized Xen guest kernel is on ring1 so Xen must forward system > calls to it and then guest kernel replies with a hypercall to Xen. > How does a system call work on QEMU? > When a guest kernel wants to directly access to device or perform a > sensitive but not privilege instruction, what's happened? Which mode of Qemu operations do you refer to? if you refer to full MMU emulation (no KVM or kqemu involved then), then intercepting syscall is basically intercepting interrupt 80 hex or SYSENTER/SYSCALL into host user mode instruction during code translation. Using KVM, it behaves more or less the same like Xen. KVM hypervisor sits in ring zero root mode (sometimes I am confused about root and non root mode, so guys CMIIW), while guest kernel sits in ring 0 non root mode. Non privileged instruction is directly handled by CPU, while privileged one make CPU exits to root mode. CPU will trap such instructions and redirect them to KVM entry points. And last, if you're refererring linux-user mode, it's using same code translation. It just don't produce user mode code, but instead calling syscall() C function. That's all I can recall, CMIIW people. regards, Mulyadi.