From patchwork Tue Sep 6 14:11:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 1126462 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p86EBlV5007108 for ; Tue, 6 Sep 2011 14:11:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754665Ab1IFOLo (ORCPT ); Tue, 6 Sep 2011 10:11:44 -0400 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 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 79628250B59; Tue, 6 Sep 2011 17:11:38 +0300 (IDT) From: Avi Kivity To: Marcelo Tosatti , Lucas Meneghel Rodrigues Cc: kvm@vger.kernel.org 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> In-Reply-To: <1315318296-22815-1-git-send-email-avi@redhat.com> References: <1315318296-22815-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 06 Sep 2011 14:11:48 +0000 (UTC) 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);