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

[Xen-devel] Purpose of do_general_protection() in Xen

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Purpose of do_general_protection() in Xen
From: "Peter Teoh" <htmldeveloper@xxxxxxxxx>
Date: Wed, 10 Oct 2007 00:12:09 +0800
Delivery-date: Tue, 09 Oct 2007 09:12:51 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=hmxtsXi9vg7/aKy8JYR/vdfbC2B/RiFWXWxzpqj85Rw=; b=lR+4I9wG2DOUbUdw6iP8KuO3UTK6xWwYRc3wS172pdboICP8gzhjCJb86Kx9KbOGzC0SpScZzc9EL0zoXAt5Of89ATCjg3D2V60bwLaMwAzavRNfFOrvEKw71AKaQnjacW91rN/sENDyCZmfNbQxNTM18laMMZxNEuJZForQ0B8=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=NUkHTJf6U6ojMRMQ+z9UuPwT9OhbRxOr2lvPcfm98llHVBfqhC8cEkGr6U/N+B1QAyD8rE2f7Lz4OTO/A6I6QIXeLCNxz7Im+jaJVIssI6mJn8O0FlZ2VIk66gvYO0drqY0P3PYp+ETJN+S6wqp/KomyvHCID7z6T6z14NwrcfA=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
This part of the code puzzle me a lot:

in arch/x86/traps.c: do_general_protection():

asmlinkage int do_general_protection(struct cpu_user_regs *regs)
{

And reading through the remarks:

    /*
     * Cunning trick to allow arbitrary "INT n" handling.
     *
     * We set DPL == 0 on all vectors in the IDT. This prevents any INT <n>
     * instruction from trapping to the appropriate vector, when that might not
     * be expected by Xen or the guest OS. For example, that entry might be for
     * a fault handler (unlike traps, faults don't increment EIP), or might
     * expect an error code on the stack (which a software trap never
     * provides), or might be a hardware interrupt handler that doesn't like
     * being called spuriously.
     *
     * Instead, a GPF occurs with the faulting IDT vector in the error code.
     * Bit 1 is set to indicate that an IDT entry caused the fault. Bit 0 is
     * clear to indicate that it's a software fault, not hardware.
       */

Now question is:

The code in Xen hypervisor is running at CPL 0, and so if the DPL of
IDT is set to 0, upon encountering interrupt condition, the
corresponding entries in IDT will still be executed, and not
triggering a GPF (triggered only if DPL of IDT entries is >0, right?).

Where is the code that set the DPL of IDT to zero?

And why do we need to handle this "cunning trick"?   Can't we just the
normal interrupt table?

Thank you very much for your help.

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] Purpose of do_general_protection() in Xen, Peter Teoh <=