From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web12.4170.1665728272399587748 for ; Thu, 13 Oct 2022 23:17:52 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=a4EUhWAN; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: dun.tan@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665728272; x=1697264272; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=1WP7+aupT2xodeyx75h5O+3joP+KXouC0Nelh6UyAtA=; b=a4EUhWANP09BKXlx4gGFYimrftFXkbFFw4hAJ8WoLtlCvxW1As/iDgty kxHyjYJwBEpD3mdEvGkfYNiHalEHQ1YCxHOpFQFNgvlXxUCtCyl/3Y6/e 3Sa+BeRXOyBKRDRmP8RxhnemAN5Un8dqTtFafAPZQg9zyqFcAX7oC9nkW Eow2tamFAps43IJlJ1ATqAyJCTC/TyFqxDIlWvH5Eis1e+/gt3gYnrLod RtS4x5n0tN5l5GeuDz6zlfcspZ47lAKFvqVtmnqPYmYEIjptgpEJBT3VN tSzz3sdThsmzJeHqiVdB6bqPn5i+qpuGC31htYAG48omWFGoNzLGPTtOw g==; X-IronPort-AV: E=McAfee;i="6500,9779,10499"; a="304038296" X-IronPort-AV: E=Sophos;i="5.95,182,1661842800"; d="scan'208";a="304038296" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2022 23:17:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10499"; a="660621939" X-IronPort-AV: E=Sophos;i="5.95,182,1661842800"; d="scan'208";a="660621939" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga001.jf.intel.com with ESMTP; 13 Oct 2022 23:17:51 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 13 Oct 2022 23:17:50 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 13 Oct 2022 23:17:50 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Thu, 13 Oct 2022 23:17:50 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Thu, 13 Oct 2022 23:17:20 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k0mgSVyiexsugxQ1Ex/PmhtkVgr8qBwrkbJNOoMB8UBIZWxCvf9NpdIhIwQlKq9k8Mj/GwhnjfqgNUrH6ADVamf5pnKctuf8ZodMYwiHU2eic2Z0ZOlJ4Bh82DuJInYWaeM5M3DTPYo4vP8THa0NlYkeEDKf9cbIEbsRcvGRlJiQnhQahrHoD8G3U+Yw36uWkMpFKo7rdgqZ/a2MO8MGOqZrbCxDg1EXOlEw/pkiov5p1oCZ/2l2qUJnZDOSpDACY0kmozi7Om7FVcdWRdseXKAXglzz6NAS9MPRcrwpq7yO6LzaC53c39TEUZ5gQ+6+Fi6pJMIzJWUP324zSxJQcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3UD9cLXM8VLKP+G21jjfGSLY8Pbf/JfQe0ejDvgVMBA=; b=oZwrNwrMtOvdN3gPy5eyYCBcqqMoJVRfgNKbYEoKaJKAWn8TOXBWpmvaAodYjXX6cKXj8pzH6v3IZqOToVUtjo3f11P2ybLe5Ayq6F+LIT1Klkt8Wk3i8MM6p0evtn0xdRROyFo8iDoGgjNOZ6XNWB9i4elHjlKkk0Nb5n5OIAeVaEI4Dn+ChwdueHoR/UjShlyGXK76iqVoHXRieMSwP8CtSlsRjmpy4D0XvEx81/kSufmSpxLfnBOnRKH5bjuZMQjd+LsMlERWVsJqnDnwWoYD5C4V1ndwyV/ZU0mPNwDms308tfoLUOaIuceaepo2lXDir2sla0LIaWBYy33Cjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by SJ0PR11MB6766.namprd11.prod.outlook.com (2603:10b6:a03:47c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Fri, 14 Oct 2022 06:17:19 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::74ca:2692:fcb:1664]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::74ca:2692:fcb:1664%7]) with mapi id 15.20.5723.026; Fri, 14 Oct 2022 06:17:19 +0000 From: "duntan" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" Subject: Re: [Patch V2 1/3] UefiCpuPkg: Add Unit tests for DxeCpuExceptionHandlerLib Thread-Topic: [Patch V2 1/3] UefiCpuPkg: Add Unit tests for DxeCpuExceptionHandlerLib Thread-Index: AQHY33DIu2oI+K85w0ewOY1E/GtCAK4NXznQgAAEVRA= Date: Fri, 14 Oct 2022 06:17:18 +0000 Message-ID: References: <20221014015400.440-1-dun.tan@intel.com> <20221014015400.440-2-dun.tan@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.500.17 dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN9PR11MB5483:EE_|SJ0PR11MB6766:EE_ x-ms-office365-filtering-correlation-id: 66018164-fa7a-431b-6d3c-08daadabbf77 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Y52tyrnHSiZoSdR9e0i+uwwzRfX1nn+8CNmotzzmSmbmmtflqbvpJcZSj35W2lCm+U3pa01FnFt318WzQEi3u/fQ5UYpbQS4WlXkprPocACxyCfV/9AVnT+I8f2I89Uo6RXIvEqwf7bdFZa8heNIV779izCBMIwEUbczrEksKsaniZr2R4t9SevpyU7KbY/8iCLqX3riu8sFF3lsrj+AqoOSwrM/WPMaxq2xm24UKdXOHq4qz0QW5K88H6HOYeb3UVshsXeFyNJabf2ZgTj2HcBBnKSX4KmqF+QW4NFkcTmPca2FkOqA0EqTHladN9OcTWeq6rYPsiD6cnghRAKk+gjB9jX0xnTUy0vwph5AlVf8z4FWe801y8iBpUCLm82GA9+kwxHTPa+b8Gkyx1hWQOq+0i96gnC18itLJG82YwxybZzhFE2bjiuuVa2zSyE2BbvG1rLgTf03DyRD8V/I8JNnvl9y5Sysl1KPW1rb/io4qfvmmixIpzZRWWN2bqfa0HMJd9MEMBNrovXcjVjxdoGCENem65OWdO0fOwkAk3DV2i/pwvuQ0C/jWMKK7aRdmkqF9P4RAVfCzCqc4UqV4tdrWxg8CQzFLAynjlra/1FAQSowGgKqV42f12o/ngZIK5MMFMx7+pYNqs1gDRPQw2jNq4mlYIf466Xg9hQtFtHRL/VBXCWCo8nkc9pt0y4q1o2ZMqeRhTFROrZoKEFLJvXv7v6kOt5t/cxbHg2miTmTDrvWL6Gxkx3WJkkKYQSJl8vl75TtFa0SA+mqQQu333EbKKR/ZSkl6w3fFa1QlxI= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5483.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(366004)(396003)(346002)(39860400002)(451199015)(478600001)(71200400001)(122000001)(86362001)(54906003)(107886003)(6506007)(5660300002)(7696005)(66446008)(4326008)(8676002)(64756008)(8936002)(76116006)(66946007)(83380400001)(66476007)(66556008)(38100700002)(52536014)(33656002)(2906002)(55016003)(82960400001)(186003)(110136005)(26005)(9686003)(41300700001)(53546011)(316002)(38070700005)(213903007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ao/ug3W5Mcbwls28S8vS+kiKThfjg9XX14RyodozO+JQPOAXb3rZx3kbqzfX?= =?us-ascii?Q?vEl8LLfs1yeLP1WajYOtwsT+NNmRmoyAKgr28tDbwoY21S7osKNc3l3CCDsO?= =?us-ascii?Q?on1984XUPRsejQ93h71vM9JT+IcUun/B8VwnKkyz0+GKmZUUxFYiOaqinKl7?= =?us-ascii?Q?soINbkqosmJ7WtaWhVkC7AvZtSYFSSthWu2vBdmNvCVy41TEfhFCwYGXgbAH?= =?us-ascii?Q?3OlnSylvS+8UU5jTR/A0CtJc4M8T/Dv1QzLbqdlA/T5RqKlAPsw1enrE3rAu?= =?us-ascii?Q?pZOTdLiWLl4H1apLEu1ZMX9R5SV0GC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WPt4l3nZa+9cYSZgYN8RoiZQ64D4Trbe7Guidc76zcNiyReiLL+tPxKRPD+?= =?us-ascii?Q?Xpp/IIbfuwIU9+yJshotDmrsxiaR5yQtTWIwC+qzemCRbwu1543Vu3cQTUaK?= =?us-ascii?Q?DdCjJKw1lUX2QQWYI5u+2Yvia7R4GG+uK5smF/387HNLS6knc2GuZBXMXzqI?= =?us-ascii?Q?nggQkhICjwAcADAcdykPT0BWLwtqSlQBDVjQ1Q4TaBMhIh7j40Yxj9+8ata/?= =?us-ascii?Q?8pAYmsMo+gOv7ctvGXuEuf14sBJH7JcIa8PKLcMkkXUi5dZVJntgsLM7mFio?= =?us-ascii?Q?PNTwGyCDRFgYo/t1AYrY0s82YCyLvE4OrUowqVNmxsKrgvVfVeiSRpHhkDRm?= =?us-ascii?Q?7J0q4mjJH58lyMrepB39mkNNy/VrWTr7cXxEOxwo?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66018164-fa7a-431b-6d3c-08daadabbf77 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2022 06:17:18.9009 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SAIH+t+Ft5999hRbGdX09wXpVmM/T5vyIsKCq/QP7GBGgAGQsI/hc8/ExqLGI6WEx1hfNiKwuoU3YSjD7cXARQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB6766 Return-Path: dun.tan@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks for Ray's comments! I'll send a new version patch later. Thanks, Dun -----Original Message----- From: Ni, Ray =20 Sent: Friday, October 14, 2022 1:49 PM To: Tan, Dun ; devel@edk2.groups.io Cc: Dong, Eric ; Kumar, Rahul R Subject: RE: [Patch V2 1/3] UefiCpuPkg: Add Unit tests for DxeCpuExceptionH= andlerLib the patch looks good! 5 minor comments in below. > since [StackBase, StackBase + SIZE_4KB] is guarded in page 1. can you say specifically "... is marked as not present in page table" in= stead of "guarded"? > +#pragma pack (1) > + > +typedef union { > + struct { > + UINT32 LimitLow : 16; > + UINT32 BaseLow : 16; > + UINT32 BaseMid : 8; > + UINT32 Type : 4; > + UINT32 System : 1; > + UINT32 Dpl : 2; > + UINT32 Present : 1; > + UINT32 LimitHigh : 4; > + UINT32 Software : 1; > + UINT32 Reserved : 1; > + UINT32 DefaultSize : 1; > + UINT32 Granularity : 1; > + UINT32 BaseHigh : 8; > + } Bits; > + UINT64 Uint64; > +} IA32_GDT; 2. can you reuse IA32_SEGMENT_DESCRIPTOR definition from BaseLib.h? > + > +typedef struct { > + UINT32 InitialApicId; > + UINT32 ApicId; > + UINT32 Health; > + UINT64 ApTopOfStack; > +} CPU_INFO_IN_HOB; 3. This is an internal data structure used by MpInitLib. Do you still need = it? > +typedef struct { > + UINT64 Rdi; > + UINT64 Rsi; > + UINT64 Rbx; > + UINT64 Rdx; > + UINT64 Rcx; > + UINT64 Rax; > + UINT64 R8Register; > + UINT64 R9Register; > + UINT64 R10Register; > + UINT64 R11Register; > + UINT64 R12Register; > + UINT64 R13Register; > + UINT64 R14Register; > + UINT64 R15Register; 4. Can we just use "R8/R9" as the register name? If needed, you can change = the ECC exception file to fix the ECC failure. > + > + Cr0.UintN =3D AsmReadCr0 (); > + if (Cr0.Bits.PG =3D=3D 0) { > + return; 5. FoundPFAddress is not set to FALSE when returning. How about let the function return a Boolean flag so the caller code can= be as below? if (FindPFAddressInPageTable (&PFAddress)) { ... }