From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [PATCH kvm-unit-tests 2/3] x86/desc: allow multiple initializations Date: Tue, 6 Sep 2011 17:11:35 +0300 Message-ID: <1315318296-22815-3-git-send-email-avi@redhat.com> References: <1315318296-22815-1-git-send-email-avi@redhat.com> Cc: kvm@vger.kernel.org To: Marcelo Tosatti , Lucas Meneghel Rodrigues Return-path: Received: from mx1.redhat.com ([209.132.183.28]:28323 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754632Ab1IFOLj (ORCPT ); Tue, 6 Sep 2011 10:11:39 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p86EBd1L028517 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 6 Sep 2011 10:11:39 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p86EBc88032351 for ; Tue, 6 Sep 2011 10:11:39 -0400 In-Reply-To: <1315318296-22815-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: There are multiple callers, so be forgiving. Signed-off-by: Avi Kivity --- lib/x86/desc.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) 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); -- 1.7.6.1