From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 18B6981EBB for ; Mon, 28 Nov 2016 23:17:20 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP; 28 Nov 2016 23:17:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,715,1473145200"; d="scan'208";a="36644729" Received: from jfan12-desk.ccr.corp.intel.com ([10.239.9.5]) by orsmga005.jf.intel.com with ESMTP; 28 Nov 2016 23:17:18 -0800 From: Jeff Fan To: edk2-devel@lists.01.org Cc: Ruiyu Ni , Jiewen Yao , Michael D Kinney Date: Tue, 29 Nov 2016 15:17:15 +0800 Message-Id: <20161129071715.29508-1-jeff.fan@intel.com> X-Mailer: git-send-email 2.9.3.windows.2 Subject: [PATCH] SourceLevelDebugPkg: Avoid to re-init IDT table again at SMI entry X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2016 07:17:20 -0000 Current SmmDebugAgentLib will initialize IDT table to support source debugging at each time SMI entry on SMM BSP. Actually, we only need to initialize IDT table at first time SMI entry. Add one flag to avoid re-initializing IDT table. Cc: Ruiyu Ni Cc: Jiewen Yao Cc: Michael D Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan --- .../Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c index 701c4be..6216142 100644 --- a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c +++ b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c @@ -19,6 +19,7 @@ DEBUG_AGENT_MAILBOX mLocalMailbox; UINTN mSavedDebugRegisters[6]; IA32_IDT_GATE_DESCRIPTOR mIdtEntryTable[33]; BOOLEAN mSkipBreakpoint = FALSE; +BOOLEAN mSmmDebugIdtInitFlag = FALSE; CHAR8 mWarningMsgIgnoreSmmEntryBreak[] = "Ignore smmentrybreak setting for SMI issued during DXE debugging!\r\n"; @@ -276,7 +277,14 @@ InitializeDebugAgent ( case DEBUG_AGENT_INIT_ENTER_SMI: SaveDebugRegister (); - InitializeDebugIdt (); + if (!mSmmDebugIdtInitFlag) { + // + // We only need to initialize Debug IDT table at first SMI entry + // after SMM relocation. + // + InitializeDebugIdt (); + mSmmDebugIdtInitFlag = TRUE; + } // // Check if CPU APIC Timer is working, otherwise initialize it. // -- 2.9.3.windows.2