5 Star 0 Fork 7

OpenCloudOS Stream/edk2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0047-OvmfPkg-BaseMemcryptSevLib-Correct-the-calculation-o.patch 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
From a7be35225490d79b651b6e564349dc25a69b79ec Mon Sep 17 00:00:00 2001
From: hanliyang <hanliyang@hygon.cn>
Date: Mon, 17 Jan 2022 01:19:21 -0500
Subject: [PATCH 17/20] OvmfPkg/BaseMemcryptSevLib: Correct the calculation of
page range that notified to hypervisor
Correct the calculation of page range that notified to hypervisor.
Signed-off-by: hanliyang <hanliyang@hygon.cn>
---
.../Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c
index 42e3b03..69ada87 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c
@@ -999,9 +999,13 @@ SetMemoryEncDec (
// Notify Hypervisor on C-bit status
//
if (CBitChanged) {
+ UINTN StartPfn = OrigPhysicalAddress >> EFI_PAGE_SHIFT;
+ UINTN EndPfn = (OrigPhysicalAddress + OrigLength +
+ ((1 << EFI_PAGE_SHIFT) - 1)) >> EFI_PAGE_SHIFT;
+
Status = SetMemoryEncDecHypercall3 (
OrigPhysicalAddress,
- EFI_SIZE_TO_PAGES (OrigLength),
+ (EndPfn - StartPfn),
(Mode == SetCBit) ? TRUE : FALSE
);
}
--
2.41.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/opencloudos-stream/edk2.git
git@gitee.com:opencloudos-stream/edk2.git
opencloudos-stream
edk2
edk2
master

搜索帮助