From 47627d1b4e0e6d04b06418b8a8e19b336f6a1491 Mon Sep 17 00:00:00 2001 From: Jiaqi Gao Date: Mon, 30 Aug 2021 18:52:15 +0800 Subject: [PATCH] OvmfPkg: Fix the issue in IO #VE handler From: tianocore/edk2-staging@a25c007 --- OvmfPkg/Library/VmTdExitLib/VmTdExitVeHandler.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/Library/VmTdExitLib/VmTdExitVeHandler.c b/OvmfPkg/Library/VmTdExitLib/VmTdExitVeHandler.c index 43e4384cdb6ac..16ad824e0e03b 100644 --- a/OvmfPkg/Library/VmTdExitLib/VmTdExitVeHandler.c +++ b/OvmfPkg/Library/VmTdExitLib/VmTdExitVeHandler.c @@ -112,16 +112,18 @@ IoExit( Val = 0; if (Write == TRUE) { CopyMem (&Val, (VOID *) Regs->Rsi, Size); + Regs->Rsi += Size; } - Regs->Rsi += Size; + Status = TdVmCall(EXIT_REASON_IO_INSTRUCTION, Size, Write, Port, Val, (Write ? NULL : &Val)); if (Status != 0) { break; } if (Write == FALSE) { CopyMem ((VOID *) Regs->Rdi, &Val, Size); + Regs->Rdi += Size; } - Regs->Rdi += Size; + if (Veinfo->ExitQualification.Io.Rep) { Regs->Rcx -= 1; }