WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] System Calls in x86_32

To: "Ahmed Moneeb Azab" <amazab@xxxxxxxx>
Subject: Re: [Xen-devel] System Calls in x86_32
From: "Grzegorz Miłoś" <gm281@xxxxxxxxx>
Date: Thu, 19 Jun 2008 14:42:37 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 19 Jun 2008 06:43:06 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=n4+tTJYfk3C4OtPlEskY5IT/ugIGg0x0eOjtJY/BPHg=; b=iDdc6Ai+T4buvmVW/CA8vxVtzDgoOA1iMRJyNfYQzbXmE0tLTgpSMIqAGOTZxK/nfq GcEY+lK9eLdGvaY35J/Kj3DmJpzNLnkyBhS3RZeZjnrdXy/JqRiepXiqULlBKM0Cii/U dnDCfoUVil78DrUik/7g+nR+MnBUYSmuYjGTM=
Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=o9Nv1JxLEuLSJbi9ux3TUOK8GNsGil+qwu8zDeQIKe64PWjk7I3qK2J/6i91tZswLL 3bMFAKzAlT8ZUboKgrY94fbWXikGpdfXbiP6PC/IgY7hwM8SiYgDnJbh3fqs3jMa5qra 09E3ZTiGO3lRHWAjPCDUWQ3lHmgOGScwnSpIM=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <48584135.9000301@xxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <48584135.9000301@xxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>  I need help understanding how the direct system calls work on the x86_32
> architecture.
>
>  What I understand is that when a guest is initialized, it uses the
> hypercall do_set_trap_table to initialize the trap table which calls
> init_int80_direct_trap for system call interrupts.

Correct.

>  The later updates the
> int80_desc structure in the VCPU of the guest so that the new address gets
> the callback directly.

Yes, on 32 bit arch (arch/x86/x86_32/traps.c). The definition is
different on 64 bit arch (arch/x86/x86_64/traps.c), int80_desc is not
used.

>  What I do not understand is where does the call back occur. Int80 is not
> handles in the x86_32's entry.S?!!!! So, where is the code that issues the
> callback?

Here is an explanation how things work on 32 bit arch:

During boot Interrupt Descriptor Table (IDT) is constructed and loaded
onto the CPU(s) (construct_percpu_idt() in arch/x86/smpboot.c). This
table contains description of various interrupt vectors.

When do_set_trap_table() hypercall is issued, vector 0x80 is reset to
point to the guest provided interrupt handler (by
init_int80_direct_trap() in include/asm-x86/processor.h).

Thanks to that, whenever INT 0x80 instruction is executed, the guest
provided handler will be invoked directly, without involving Xen.
That's how the callback happens: CPU encounters INT 0x80 intruction,
looks up the relevant, guest provided, interrupt handler in the IDT
and invokes it.

>
>  Why is architecture is different on x86_64. The entry.S contains an entry
> for int80. Does this affect the performance of the guests?

64 bit architecture is more complicated, because Xen will intercept
interrupt 0x80 (it therefore loads it's own interrupt handler into
IDT, specifically int80_direct_trap defined in
arch/x86/x86_64/entry.S). The reason why Xen wants to intercept the
interrupts is that we could be executing 32bit guest, or an HVM guest
etc (look through the definition of int80_direct_trap for details).

Hope this helps
Gr(z)egor(z)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>