From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mx.groups.io with SMTP id smtpd.web08.8059.1667136571356207926 for ; Sun, 30 Oct 2022 06:29:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=TWRFgbmp; spf=pass (domain: ventanamicro.com, ip: 209.85.210.175, mailfrom: sunilvl@ventanamicro.com) Received: by mail-pf1-f175.google.com with SMTP id d10so8568065pfh.6 for ; Sun, 30 Oct 2022 06:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G3NKBgwzW4x0/qC8/8YTT5pW1uN6UduxXlgEVXpNxdA=; b=TWRFgbmpBhajbAY2VCoF9/oyu7sXM+4DIKOOg+nhfG5O+RjF2YhUZLbIz7Xa80p/4/ N4FLi3R/z29lSQ3bi57kfNpbU2d2pjb3HxqdAiuyXHOj8kRMvOrrWS0vp6efcZS47MwP nbp48IY5VB2ojGaM1E6rkgUYJRhFOPcLAETwzpAeeYjabT+fJGnh+OudYWNxgsj5Ai+q jKYgGdDb03QSSKCUUsRemq9FplmTIbHy7dV+j+vT4Qg1IANwlSy8eCRoWPkfrnST2Ujk +o88M691a/R0/UOBLtHaVzNGBZdRNcYxuep6/aKA2jcNoGMATm/YPdQ8vZ1huCrfAc+O OI/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G3NKBgwzW4x0/qC8/8YTT5pW1uN6UduxXlgEVXpNxdA=; b=gH1/dltP8A3W5J9rF3mU0TAffsQRIEMv+4RkIL8UMA2JSFfoxVNJi6zhQFiP1t6ZD+ 3pq8q7uBRFJmK08KCEs8LR8DyVjx8+aWlEEFgq5V2RcYIYs53FomXfN1RaOrUtUDCC7O QdoAzCyTwDnEcVc4apgHSIs++XDSEIp6RjNbUDbJ4Hhjuj3N3mFyE7xWxhXmxRRmj4wB SWVIDIUyIOQw7yktkOXY1hr60FWtGxrlZIwQCKZWoZQOx2Q4kb1mFKZ+OlzF63w6aYpj vnTWopzduWGYWB+KIn25jZqKtBtuvU7cSaXrxUmM6DBkZCHHPw3H8OA8+fxJTaHVZfPd Zu8A== X-Gm-Message-State: ACrzQf19Cml8KbN5Qxm8jIRJikilM71Qu4XKyCJlYaawXxoYdTfiYVGy UiB1CIvnnVzZiyrS0cy4rt504CRI0XbSKA== X-Google-Smtp-Source: AMsMyM4YGRk+4DkV2dF7i7FgX/6BpqwFOJs1rVT3x5ITEsoJKtIJskpDreM2i4Z6esoiC2XQwHlPlQ== X-Received: by 2002:a63:5d5b:0:b0:46e:f010:d0f7 with SMTP id o27-20020a635d5b000000b0046ef010d0f7mr7998986pgm.585.1667136570589; Sun, 30 Oct 2022 06:29:30 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([49.206.12.236]) by smtp.gmail.com with ESMTPSA id r10-20020aa79eca000000b0056b6a22d6c9sm2612330pfq.212.2022.10.30.06.29.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 06:29:29 -0700 (PDT) From: "Sunil V L" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar Subject: [edk2-staging/RiscV64QemuVirt PATCH V5 15/30] UefiCpuPkg/CpuExceptionHandlerLib: Refactor to allow other architectures Date: Sun, 30 Oct 2022 18:58:27 +0530 Message-Id: <20221030132842.54077-16-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221030132842.54077-1-sunilvl@ventanamicro.com> References: <20221030132842.54077-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4076 Currently, the CpuExceptionHandlerLib library supports only X86. Refactor the library to allow adding other CPU architectures. Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Signed-off-by: Sunil V L --- UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf | 14 ++++++++------ UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf | 8 ++++---- UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf | 12 +++++++----- UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf | 8 ++++---- UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf | 6 +++--- UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32X64}/CpuExceptionCommon.h | 0 UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32X64}/CpuExceptionCommon.c | 0 UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32X64}/DxeException.c | 0 UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32X64}/PeiCpuException.c | 0 UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32X64}/PeiDxeSmmCpuException.c | 0 UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32X64}/SecPeiCpuException.c | 0 UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32X64}/SmmException.c | 0 12 files changed, 26 insertions(+), 22 deletions(-) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf index e7a81bebdb13..8fdf2b756c2c 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf @@ -32,11 +32,11 @@ [Sources.X64] X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h -[Sources.common] - CpuExceptionCommon.h - CpuExceptionCommon.c - PeiDxeSmmCpuException.c - DxeException.c +[Sources.IA32, Sources.X64] + Ia32X64/CpuExceptionCommon.h + Ia32X64/CpuExceptionCommon.c + Ia32X64/PeiDxeSmmCpuException.c + Ia32X64/DxeException.c [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard @@ -56,8 +56,10 @@ [LibraryClasses] SerialPortLib PrintLib SynchronizationLib - LocalApicLib PeCoffGetEntryPointLib MemoryAllocationLib DebugLib + +[LibraryClasses.IA32, LibraryClasses.X64] + LocalApicLib VmgExitLib diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf index 7c2ec3b2db4c..af4899e6885e 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf @@ -33,10 +33,10 @@ [Sources.X64] X64/ArchInterruptDefs.h [Sources.common] - CpuExceptionCommon.h - CpuExceptionCommon.c - PeiCpuException.c - PeiDxeSmmCpuException.c + Ia32X64/CpuExceptionCommon.h + Ia32X64/CpuExceptionCommon.c + Ia32X64/PeiCpuException.c + Ia32X64/PeiDxeSmmCpuException.c [Packages] MdePkg/MdePkg.dec diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf index 6a170286c8fc..79911b21f62d 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf @@ -32,10 +32,10 @@ [Sources.X64] X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h -[Sources.common] - CpuExceptionCommon.h - CpuExceptionCommon.c - SecPeiCpuException.c +[Sources.IA32, Sources.X64] + Ia32X64/CpuExceptionCommon.h + Ia32X64/CpuExceptionCommon.c + Ia32X64/SecPeiCpuException.c [Packages] MdePkg/MdePkg.dec @@ -46,8 +46,10 @@ [LibraryClasses] BaseLib SerialPortLib PrintLib - LocalApicLib PeCoffGetEntryPointLib + +[LibraryClasses.IA32, LibraryClasses.X64] + LocalApicLib VmgExitLib [Pcd] diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf index 9dde07612a04..249446588bfa 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf @@ -33,10 +33,10 @@ [Sources.X64] X64/ArchInterruptDefs.h [Sources.common] - CpuExceptionCommon.h - CpuExceptionCommon.c - PeiDxeSmmCpuException.c - SmmException.c + Ia32X64/CpuExceptionCommon.h + Ia32X64/CpuExceptionCommon.c + Ia32X64/PeiDxeSmmCpuException.c + Ia32X64/SmmException.c [Packages] MdePkg/MdePkg.dec diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf index 6d2f66504a5b..23200437eb8b 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf @@ -38,9 +38,9 @@ [Sources.X64] X64/ArchInterruptDefs.h [Sources.common] - CpuExceptionCommon.h - CpuExceptionCommon.c - SecPeiCpuException.c + Ia32X64/CpuExceptionCommon.h + Ia32X64/CpuExceptionCommon.c + Ia32X64/SecPeiCpuException.c [Packages] MdePkg/MdePkg.dec diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/CpuExceptionCommon.h similarity index 100% rename from UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h rename to UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/CpuExceptionCommon.h diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/CpuExceptionCommon.c similarity index 100% rename from UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.c rename to UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/CpuExceptionCommon.c diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/DxeException.c similarity index 100% rename from UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c rename to UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/DxeException.c diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/PeiCpuException.c similarity index 100% rename from UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c rename to UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/PeiCpuException.c diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/PeiDxeSmmCpuException.c similarity index 100% rename from UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c rename to UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/PeiDxeSmmCpuException.c diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/SecPeiCpuException.c similarity index 100% rename from UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c rename to UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/SecPeiCpuException.c diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/SmmException.c similarity index 100% rename from UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c rename to UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32X64/SmmException.c -- 2.38.0