diff mbox

[kvm-unit-tests,2/3] x86/desc: allow multiple initializations

Message ID 1315318296-22815-3-git-send-email-avi@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Avi Kivity Sept. 6, 2011, 2:11 p.m. UTC
There are multiple callers, so be forgiving.

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

Patch

diff --git a/lib/x86/desc.c b/lib/x86/desc.c
index 0ed8c22..c268955 100644
--- a/lib/x86/desc.c
+++ b/lib/x86/desc.c
@@ -229,6 +229,12 @@  static void *idt_handlers[32] = {
 void setup_idt(void)
 {
     int i;
+    static bool idt_initialized = false;
+
+    if (idt_initialized) {
+        return;
+    }
+    idt_initialized = true;
     for (i = 0; i < 32; i++)
 	    if (idt_handlers[i])
 		    set_idt_entry(i, idt_handlers[i], 0);