]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg/BaseSynchronizationLib GCC: simplify IA32 InternalSyncCompareExchange64()
authorLaszlo Ersek <lersek@redhat.com>
Sat, 29 Sep 2018 21:13:47 +0000 (23:13 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 17 Oct 2018 16:44:51 +0000 (18:44 +0200)
The IA32 variant of InternalSyncCompareExchange64() is correct, but we can
simplify it. We don't need to load the lower 32 bits of ExchangeValue into
EBX in two steps (first into a general register, then into EBX); we can
ask GCC to populate EBX like that itself.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1208
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c

index 44188e265af2d4a7620d917cd47fe1ee8c1018ce..af39bdeb516c6ab19de6a6ebaef4627d973a37eb 100644 (file)
@@ -193,14 +193,11 @@ InternalSyncCompareExchange64 (
   )\r
 {\r
   __asm__ __volatile__ (\r
-    "push        %%ebx      \n\t"\r
-    "movl        %2,%%ebx   \n\t"\r
     "lock                   \n\t"\r
     "cmpxchg8b   (%1)       \n\t"\r
-    "pop         %%ebx      \n\t"\r
     : "+A"  (CompareValue)                    // %0\r
     : "S"   (Value),                          // %1\r
-      "r"   ((UINT32) ExchangeValue),         // %2\r
+      "b"   ((UINT32) ExchangeValue),         // %2\r
       "c"   ((UINT32) (ExchangeValue >> 32))  // %3\r
     : "memory",\r
       "cc"\r