diff options
author | Laszlo Ersek <lersek@redhat.com> | 2017-09-04 17:09:18 +0200 |
---|---|---|
committer | Laszlo Ersek <lersek@redhat.com> | 2017-09-11 22:28:05 +0200 |
commit | 98a4d04e8fda7c23c0cce1ac65597e8144bcb5b8 (patch) | |
tree | 4872c4780296664f3af756a921dd13e54e77115d /MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm | |
parent | aa9aa47e06ac0082948b880c226c8bdf2a12102b (diff) | |
download | edk2-98a4d04e8fda7c23c0cce1ac65597e8144bcb5b8.tar.gz edk2-98a4d04e8fda7c23c0cce1ac65597e8144bcb5b8.tar.bz2 edk2-98a4d04e8fda7c23c0cce1ac65597e8144bcb5b8.zip |
MdePkg/BaseIoLibIntrinsic: fix SEV (=unrolled) variants of IoWriteFifoXX()
In commit b6d11d7c4678 ("MdePkg: BaseIoLibIntrinsic (IoLib class)
library", 2017-04-12), the MOV instructions in the write loops were
probably copied from the read loops. However, the operand order was not
adjusted.
As a result, the IoWriteFifoXX() routines, when invoked in SEV guests, now
overwrite the source buffer with value 0x01 / 0x0001 / 0x00000001 -- the
SevNoRepIo() function returns value 1 in EAX, in SEV guests --, and write
the same value to the target IO port.
Fix this by putting the target operand (AL / AX / EAX) first, and the
source operand (BYTE / WORD / DWORD [ESI/RSI]) second.
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Fixes: b6d11d7c467810ea7f2e2eda46ef0bdc57bf1475
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
Diffstat (limited to 'MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm')
-rw-r--r-- | MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm index 26e016625b..4d86a6cd53 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm +++ b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm @@ -205,7 +205,7 @@ ASM_PFX(IoWriteFifo8): jrcxz @IoWriteFifo8_Done
@IoWriteFifo8_Loop:
- mov byte [rsi], al
+ mov al, byte [rsi]
out dx, al
inc rsi
loop @IoWriteFifo8_Loop
@@ -241,7 +241,7 @@ ASM_PFX(IoWriteFifo16): jrcxz @IoWriteFifo16_Done
@IoWriteFifo16_Loop:
- mov word [rsi], ax
+ mov ax, word [rsi]
out dx, ax
add rsi, 2
loop @IoWriteFifo16_Loop
@@ -277,7 +277,7 @@ ASM_PFX(IoWriteFifo32): jrcxz @IoWriteFifo32_Done
@IoWriteFifo32_Loop:
- mov dword [rsi], eax
+ mov eax, dword [rsi]
out dx, eax
add rsi, 4
loop @IoWriteFifo32_Loop
|