From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 D780B81EAC for ; Tue, 29 Nov 2016 18:48:19 -0800 (PST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP; 29 Nov 2016 18:48:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,719,1473145200"; d="scan'208";a="35699351" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 29 Nov 2016 18:48:18 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 29 Nov 2016 18:48:07 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.142]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.138]) with mapi id 14.03.0248.002; Wed, 30 Nov 2016 10:48:06 +0800 From: "Ni, Ruiyu" To: "Fan, Jeff" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" , "Kinney, Michael D" Thread-Topic: [PATCH] SourceLevelDebugPkg: Avoid to re-init IDT table again at SMI entry Thread-Index: AQHSShCoKSNcohW0UEKxr5MXfpBjMqDw1B0g Date: Wed, 30 Nov 2016 02:48:04 +0000 Deferred-Delivery: Wed, 30 Nov 2016 02:48:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D58E8E908@SHSMSX104.ccr.corp.intel.com> References: <20161129071715.29508-1-jeff.fan@intel.com> In-Reply-To: <20161129071715.29508-1-jeff.fan@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: Wed, 30 Nov 2016 02:48:19 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni Thanks/Ray > -----Original Message----- > From: Fan, Jeff > Sent: Tuesday, November 29, 2016 3:17 PM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu ; Yao, Jiewen ; > Kinney, Michael D > Subject: [PATCH] SourceLevelDebugPkg: Avoid to re-init IDT table again at > SMI entry >=20 > 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. >=20 > Add one flag to avoid re-initializing IDT table. >=20 > 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(-) >=20 > diff --git > a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebug > AgentLib.c > b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebu > gAgentLib.c > index 701c4be..6216142 100644 > --- > a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebug > AgentLib.c > +++ > b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebu > gAgent > +++ Lib.c > @@ -19,6 +19,7 @@ DEBUG_AGENT_MAILBOX mLocalMailbox; > UINTN mSavedDebugRegisters[6]; > IA32_IDT_GATE_DESCRIPTOR mIdtEntryTable[33]; > BOOLEAN mSkipBreakpoint =3D FALSE; > +BOOLEAN mSmmDebugIdtInitFlag =3D FALSE; >=20 > CHAR8 mWarningMsgIgnoreSmmEntryBreak[] =3D "Ignore smmentrybreak > setting for SMI issued during DXE debugging!\r\n"; >=20 > @@ -276,7 +277,14 @@ InitializeDebugAgent ( >=20 > 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 =3D TRUE; > + } > // > // Check if CPU APIC Timer is working, otherwise initialize it. > // > -- > 2.9.3.windows.2