From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.4213.1665726519044476148 for ; Thu, 13 Oct 2022 22:48:39 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ariquTV+; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665726519; x=1697262519; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=VlU+1sdsKIiVYFzQIkQoSuKiCjJ/+E6iL/VMON0QxbQ=; b=ariquTV+6J8nbUPIsgcSHa+jvY2ahiJsNYTT8Lv0obzKBkS24zr6mlq2 7pDHZlOeRVlfYhBaaTrSkTZ262AHEn3YD5axcd+6yf2DYx8/X9dG5T1L2 72TTkkpG/1GTq/i9HJBZugcj2rFwn79BKME/Y8zJwvheEBE6eVaL/zm0N aNkANYDgxk3gr11YRErB2XHaL+EhThs4trumeqKPZy9B0Bhm6QWSReny6 2FmruKX7n9syIZzWhwh7Mkwy5aA2bReSMx9FebRzalDuTc7S9c+0Ii73L Id2PWn82VlurCXkqKQy8S29HDTp1pqBvkVuIBJyF+DGyk93yl/naEoI9l A==; X-IronPort-AV: E=McAfee;i="6500,9779,10499"; a="369478991" X-IronPort-AV: E=Sophos;i="5.95,182,1661842800"; d="scan'208";a="369478991" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2022 22:48:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10499"; a="956461946" X-IronPort-AV: E=Sophos;i="5.95,182,1661842800"; d="scan'208";a="956461946" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga005.fm.intel.com with ESMTP; 13 Oct 2022 22:48:37 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx602.amr.corp.intel.com (10.18.126.82) 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 22:48:37 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx607.amr.corp.intel.com (10.18.126.87) 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 22:48:37 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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 via Frontend Transport; Thu, 13 Oct 2022 22:48:37 -0700 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.172) by edgegateway.intel.com (192.55.55.68) 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 22:48:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vgxoluev5Ncuk1dWku8lCC7kGSR+HXA/hkZrebVWgSnCazq0bI6zZMQlID15v3BzmvYR7EQPgohCvKC/GzY7lUVBEbxOM5PH/9xY2Yro60YUn1IpsGQ3ONlCy1Wh8Gt0OyHgsmuhCMGSzl0hbSPPLSdzwW67REQBDwFu8/6BfeJJC5iTw9ZDRW/0NGwcALIZSkvthyafhFIAbHEE7V8yVMGFvjfhCuk/doZL9H8FncjnMJdKZ96G4X5zTih+uaWzkBU1BmbFlAqqO4w7ay2TTQzeEqfKevVeCGuiF5hge9QwwVLu5GCtvtaXuYf+y4hNSWYNTbZSznkt2cY8U8Z2/A== 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=o8nfEVw1loNkHv98p2239KYfyomMycovVk5iqhQAnb8=; b=gPvS2xWwrrMPDBcXpIlqW1BqCkYDzdZWZ+4vNoJgoWBIFTbE14aKgRqkLFxlJsnNeIMir1Mg83hTPVzz8vlAcn/0DaFc0igkV07ZGgz9EGiitfgDOCgKRIcs0Ykwwcu6ELAWaqp9LczYAiNNyqGbnKcgKCUpCb1KbYBl1fTybohAoJeojxjZV1ZOf6M3G12ROV3mIbJBIVeJefFI+ZIDcdee7cC/UMgmK3bFn6yqq1ozii1muIQ0PytcH+ofCKPHwEH+r+TueDpJV6I+Gq7xR9ZreWryEmveLwrlz7E/tiB3/AHv/qRIhR9VD5Qnn3D0JA4R5vUC4yV9bc3k7wa1tw== 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 MWHPR11MB1631.namprd11.prod.outlook.com (2603:10b6:301:10::10) by DM4PR11MB6357.namprd11.prod.outlook.com (2603:10b6:8:b5::11) 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 05:48:35 +0000 Received: from MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::483f:4bb5:a15f:f571]) by MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::483f:4bb5:a15f:f571%11]) with mapi id 15.20.5723.026; Fri, 14 Oct 2022 05:48:35 +0000 From: "Ni, Ray" To: "Tan, Dun" , "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/GtCAK4NXznQ Date: Fri, 14 Oct 2022 05:48:35 +0000 Message-ID: References: <20221014015400.440-1-dun.tan@intel.com> <20221014015400.440-2-dun.tan@intel.com> In-Reply-To: <20221014015400.440-2-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: MWHPR11MB1631:EE_|DM4PR11MB6357:EE_ x-ms-office365-filtering-correlation-id: 8f0a3c25-4550-4aaa-9297-08daada7bc10 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LjPojJdTIJjeJAJBS/i9KQibofRL9pICHMH1/Jw2NKQ1BZOTdoR6IXi6UbyBN6oX6III2C4gVq1A3pxlqCs/UeOSbRjuC718O+iMGjfzbJGrvrzYbPekf1fA6G21V1cT4uPa7fM9dVWFaOWMXUzChfOJjkpFhrclD6+bR6GIZcJRBhTgFJNwtNnj2l06+pWu/X5pjJEsL9qc/JH+pXFqQB4rw7ic2996V44SqGZHQCzPn8KwQiwEbzaM65OJ8oWBxTrxEGHTmkuvtfWnpM6fFzvwMis9Sx6wbt4Oz7D5U68xxhcBvkaE3srMdoCzrDBIDJmkKtgZVImLye7nxN0Ig6vmsuiAPCe0KNmOGIfkP83/wi5zs0fFx4YO6/jvUJiD6EOC/GLQSdx2lFBTJcQCqllcg5Ta/HHTQRb5EgilglN9erAzwBkFuAQVjv+Hm5hA/raqBdRzpi+fGY4ntSpAgbqyXEW5E4MYqMxhHXVwSb+uxPIvaj3h7F8xzqj9LMdhszg4co6z3sRGcjAH6/kIrhGtOBBl+xLKpptQt/Mfvs+o84iauMPpuk1Fx7RMtcNovRmvHdMgxhaoRY+y4Xi+OaodCLmGR+aT+28X/waM/EzHZMDBvCLPz2Cm4rfT16UZgZBKys1CRsP712tLSPtLMpo8qEFzR2yHa+G48A8Kho4CpCuTcSW7faIJmflHzl1eq+nFLHjP/AP9Hwq0tkJYQjY5rJf9+oibGZHWRwlylZyx8ek7KqymR6yIAmZozz8QXY36Vv8ByW7zI0REKNrrJxl2A/CqRtWlCgA8sM0DioA= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1631.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(39860400002)(366004)(136003)(346002)(396003)(376002)(451199015)(26005)(66556008)(4326008)(83380400001)(66446008)(41300700001)(86362001)(38100700002)(54906003)(110136005)(8676002)(7696005)(76116006)(66476007)(64756008)(6506007)(82960400001)(52536014)(107886003)(2906002)(5660300002)(9686003)(186003)(8936002)(33656002)(316002)(55016003)(71200400001)(66946007)(478600001)(122000001)(38070700005)(213903007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?BEZCUyEybg3p7Hq7E9Ob+vv5RfMB+NjBWcyviUx58cLHvxcneF6MITdEIJ3q?= =?us-ascii?Q?MRK8qPkYxkZCoMjYNHbaFyG+TjOf6hCNlGq69FCJq/j8yvGndge8PkysQJzk?= =?us-ascii?Q?anZGnxQcix58uLdCC1hSluIxJCC4CQq+UBr5C103w+5x6IdIl3Pd6krAvPyk?= =?us-ascii?Q?ZL/CXY1pin77vUQx4bxkIKWH0Zoh2fbZnte/O/KD3NcnR6vK34dexgdIS+Vk?= =?us-ascii?Q?kGMW4q250adIjfxOMoqyqFWwXIM/p1KqKhnJtkfB6q+PomfR5S8CWaPclGwy?= =?us-ascii?Q?gptk302EN/9+CnlouylvTIjuW/0igZstt4B8BV7wPOOfQi2pV/Ov80zNmaGR?= =?us-asc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2Hwu+G71/Vpgtlt7g9vjqAO?= =?us-ascii?Q?JccIgryyij8Fz4CMfz1i3WQVZNLUtJIW+x+FVJi9e4RRpeY6JH3FaDVZwcbz?= =?us-ascii?Q?t/hCf7tAMINC7ecrYKAHtXywQinId+S630d+ECjfATYNbL5zZzRhDl4oQE8e?= =?us-ascii?Q?3E6nTrdMY0ozltoGSccJLbRJtAklAKyoOsJllD16XkLvTXvyszqRkps7FiVW?= =?us-ascii?Q?pJL+f2O3Fa97J26EyzMeK4EriE9sqY0TWtQV8hkifJpqgPmwCSh+LETJ34iB?= =?us-ascii?Q?mU3BYoGFpypzLStmOq98/j/lP1T87Ia9ZLMvsfOKZIYYgU/ITIAYxWD45hf2?= =?us-ascii?Q?aVE1VUQa+Xz5pyLdoPXy2Sk5Yhp6wFlRffVNyWeE?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1631.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f0a3c25-4550-4aaa-9297-08daada7bc10 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2022 05:48:35.2224 (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: wasQT68ppCGHPgN0GmdAIg5pzPRp71bOZUDW9DymoNUQOqGpZfhlgGEzljq8vElPpi7OAxtfZlQ/BsbXRmtJqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB6357 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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)) { ... }