public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>,
	Lucas Meneghel Rodrigues <lmr@redhat.com>
Cc: kvm@vger.kernel.org
Subject: [PATCH kvm-unit-tests 1/3] x86/desc: switch to using boot_idt
Date: Tue,  6 Sep 2011 17:11:34 +0300	[thread overview]
Message-ID: <1315318296-22815-2-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1315318296-22815-1-git-send-email-avi@redhat.com>

boot_idt is set up an all cpus by the startup code, unlike
the idt local to desc.c.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 lib/x86/desc.c |   17 +++--------------
 1 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/lib/x86/desc.c b/lib/x86/desc.c
index 11bd2a2..0ed8c22 100644
--- a/lib/x86/desc.c
+++ b/lib/x86/desc.c
@@ -62,21 +62,11 @@ typedef struct {
 	u16 iomap_base;
 } tss32_t;
 
-static idt_entry_t idt[256] __attribute__((aligned(4096)));
-
-void load_lidt(idt_entry_t *idt, int nentries)
-{
-    struct descriptor_table_ptr dt;
-
-    dt.limit = nentries * sizeof(*idt) - 1;
-    dt.base = (unsigned long)idt;
-    lidt(&dt);
-    asm volatile ("lidt %0" : : "m"(dt));
-}
+extern idt_entry_t boot_idt[256];
 
 void set_idt_entry(int vec, void *addr, int dpl)
 {
-    idt_entry_t *e = &idt[vec];
+    idt_entry_t *e = &boot_idt[vec];
     memset(e, 0, sizeof *e);
     e->offset0 = (unsigned long)addr;
     e->selector = read_cs();
@@ -92,7 +82,7 @@ void set_idt_entry(int vec, void *addr, int dpl)
 
 void set_idt_sel(int vec, u16 sel)
 {
-    idt_entry_t *e = &idt[vec];
+    idt_entry_t *e = &boot_idt[vec];
     e->selector = sel;
 }
 
@@ -239,7 +229,6 @@ static void *idt_handlers[32] = {
 void setup_idt(void)
 {
     int i;
-    load_lidt(idt, 256);
     for (i = 0; i < 32; i++)
 	    if (idt_handlers[i])
 		    set_idt_entry(i, idt_handlers[i], 0);
-- 
1.7.6.1


  reply	other threads:[~2011-09-06 14:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-06 14:11 [PATCH kvm-unit-tests 0/3] Fix apic.flat Avi Kivity
2011-09-06 14:11 ` Avi Kivity [this message]
2011-09-06 14:11 ` [PATCH kvm-unit-tests 2/3] x86/desc: allow multiple initializations Avi Kivity
2011-09-06 14:11 ` [PATCH kvm-unit-tests 3/3] x86/smp: use desc.c for setting up IPI handler Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315318296-22815-2-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lmr@redhat.com \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox