From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by mx.groups.io with SMTP id smtpd.web09.446.1614718138220924848 for ; Tue, 02 Mar 2021 12:48:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=q7j4ANBr; spf=pass (domain: linux.ibm.com, ip: 148.163.158.5, mailfrom: tobin@linux.ibm.com) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 122KhJOF167153; Tue, 2 Mar 2021 15:48:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=mWFr+lnaNXNX8fqBoItHRCjcU9AzaBBOnyTYCnqINLk=; b=q7j4ANBre2HSTaDALzi53WkmUraK9BQF/TnlrPYHbcTZWdR2JQly0TVdzKPWcrwEH1BP 4FTaIUO7jgnT4OwTuw8AX8bP3qKyWx3eIYmOkqqQWTQf9lbRG9cFIjsBj0dJuSm6ROHN FhwNvZ3BGoSEOf+G3oTlS99tltAVoJqGzhmbe4RD2utafHJE76PWVNlc5fFBVFdok5QH LUcf/Il//hONI+hnlmhtLJLIBsxPfunMlB4xbko3371BOZk3zz1FM7Xy2stzwWHUuOHj 6nkUKWvgnrcJ8t9F+s72eRg7O3uaAq3+xtubtOYZO+aUlpEm/L7n2GO6blEbCpo9CstA 6g== Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 371vn488f3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Mar 2021 15:48:56 -0500 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 122KbCse026320; Tue, 2 Mar 2021 20:48:55 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma01wdc.us.ibm.com with ESMTP id 36ydq91sc9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Mar 2021 20:48:55 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 122KmrMt49938764 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 2 Mar 2021 20:48:53 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 04F60C605B; Tue, 2 Mar 2021 20:48:53 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 71294C6055; Tue, 2 Mar 2021 20:48:52 +0000 (GMT) Received: from amdrome1.watson.ibm.com (unknown [9.2.130.16]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 2 Mar 2021 20:48:52 +0000 (GMT) From: "Tobin Feldman-Fitzthum" To: devel@edk2.groups.io Cc: Dov Murik , Tobin Feldman-Fitzthum , Tobin Feldman-Fitzthum , James Bottomley , Hubertus Franke , Brijesh Singh , Ashish Kalra , Jon Grimm , Tom Lendacky Subject: [RFC PATCH 10/14] UefiCpuPkg/CpuExceptionHandlerLib: Exception handling as runtime memory Date: Tue, 2 Mar 2021 15:48:35 -0500 Message-Id: <20210302204839.82042-11-tobin@linux.ibm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210302204839.82042-1-tobin@linux.ibm.com> References: <20210302204839.82042-1-tobin@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-02_08:2021-03-01,2021-03-02 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 spamscore=0 bulkscore=0 suspectscore=0 impostorscore=0 mlxlogscore=664 malwarescore=0 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103020156 Content-Transfer-Encoding: 8bit Reserve IDT and other exception-related memory as runtime so it won't be overwritten by the OS while the MH is running. Signed-off-by: Tobin Feldman-Fitzthum --- UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c index fd59f09ecd..35610f8cf5 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c @@ -102,7 +102,7 @@ InitializeCpuInterruptHandlers ( EFI_CPU_INTERRUPT_HANDLER *ExternalInterruptHandler; Status = gBS->AllocatePool ( - EfiBootServicesCode, + EfiRuntimeServicesCode, sizeof (RESERVED_VECTORS_DATA) * CPU_INTERRUPT_NUM, (VOID **)&ReservedVectors ); @@ -116,7 +116,7 @@ InitializeCpuInterruptHandlers ( } } - ExternalInterruptHandler = AllocateZeroPool (sizeof (EFI_CPU_INTERRUPT_HANDLER) * CPU_INTERRUPT_NUM); + ExternalInterruptHandler = AllocateRuntimeZeroPool (sizeof (EFI_CPU_INTERRUPT_HANDLER) * CPU_INTERRUPT_NUM); ASSERT (ExternalInterruptHandler != NULL); // @@ -130,7 +130,7 @@ InitializeCpuInterruptHandlers ( // // Create Interrupt Descriptor Table and Copy the old IDT table in // - IdtTable = AllocateZeroPool (sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM); + IdtTable = AllocateRuntimeZeroPool (sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM); ASSERT (IdtTable != NULL); CopyMem (IdtTable, (VOID *)IdtDescriptor.Base, sizeof (IA32_IDT_GATE_DESCRIPTOR) * IdtEntryCount); @@ -138,7 +138,7 @@ InitializeCpuInterruptHandlers ( ASSERT (TemplateMap.ExceptionStubHeaderSize <= HOOKAFTER_STUB_SIZE); Status = gBS->AllocatePool ( - EfiBootServicesCode, + EfiRuntimeServicesCode, TemplateMap.ExceptionStubHeaderSize * CPU_INTERRUPT_NUM, (VOID **)&InterruptEntryCode ); -- 2.20.1