]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg/BaseIoLibIntrinsicArmVirt ARM: avoid double word loads and stores
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 7 Nov 2018 13:13:01 +0000 (14:13 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 15 Nov 2018 12:31:42 +0000 (04:31 -0800)
BaseIoLibIntrinsicArmVirt was created to prevent LTO from merging
accesses to MMIO regions, resulting in instructions with multiple
output registers that KVM on ARM cannot emulate (since the exception
syndrome information that KVM relies on can only describe a single
output register)

However, using double word loads on ARM amounts to the same thing,
and so code that relies on doing 64-bit MMIO to regions that are
emulated under KVM (such as the GICv3 TYPER register) will still
suffer from the original issue.

So replace ldrd and strd with equivalent two instruction sequences.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.S
MdePkg/Library/BaseIoLibIntrinsic/Arm/ArmVirtMmio.asm

index 3ad22bd5706dc0b792d30a96627437a50728297a..0d802d6928d6da1cae104ad3ab85b9ae5942f10b 100644 (file)
@@ -125,7 +125,8 @@ ASM_PFX(MmioWrite32Internal):
 //  @return The value read.\r
 //\r
 ASM_PFX(MmioRead64Internal):\r
 //  @return The value read.\r
 //\r
 ASM_PFX(MmioRead64Internal):\r
-  ldrd    r0, r1, [r0]\r
+  ldr     r1, [r0, #4]\r
+  ldr     r0, [r0]\r
   dmb\r
   bx      lr\r
 \r
   dmb\r
   bx      lr\r
 \r
@@ -141,5 +142,6 @@ ASM_PFX(MmioRead64Internal):
 //\r
 ASM_PFX(MmioWrite64Internal):\r
   dmb     st\r
 //\r
 ASM_PFX(MmioWrite64Internal):\r
   dmb     st\r
-  strd    r2, r3, [r0]\r
+  str     r2, [r0]\r
+  str     r3, [r0, #4]\r
   bx      lr\r
   bx      lr\r
index e1a3d68a430c97d348a54ae590b1a82289696118..deba8c1f0c59daf29cc239ffaa3ac90c56875c3c 100644 (file)
@@ -127,7 +127,8 @@ MmioWrite32Internal
 ;  @return The value read.\r
 ;\r
 MmioRead64Internal\r
 ;  @return The value read.\r
 ;\r
 MmioRead64Internal\r
-  ldrd    r0, r1, [r0]\r
+  ldr     r1, [r0, #4]\r
+  ldr     r0, [r0]\r
   dmb\r
   bx      lr\r
 \r
   dmb\r
   bx      lr\r
 \r
@@ -143,7 +144,8 @@ MmioRead64Internal
 ;\r
 MmioWrite64Internal\r
   dmb     st\r
 ;\r
 MmioWrite64Internal\r
   dmb     st\r
-  strd    r2, r3, [r0]\r
+  str     r2, [r0]\r
+  str     r3, [r0, #4]\r
   bx      lr\r
 \r
   END\r
   bx      lr\r
 \r
   END\r