MdePkg/BaseSynchronizationLib GCC: fix whitespace and comments

The "GccInline.c" files have some inconsistent whitespace, and missing (or
incorrect) operand comments. Fix and unify them.

This patch doesn't change behavior.

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>
This commit is contained in:
Laszlo Ersek 2018-09-29 20:18:34 +02:00
parent b7dc8888f3
commit 310ddb638b
2 changed files with 39 additions and 49 deletions

View File

@ -39,7 +39,7 @@ InternalSyncIncrement (
"movl $1, %%eax \n\t" "movl $1, %%eax \n\t"
"lock \n\t" "lock \n\t"
"xadd %%eax, %1 \n\t" "xadd %%eax, %1 \n\t"
"inc %%eax " "inc %%eax \n\t"
: "=a" (Result), // %0 : "=a" (Result), // %0
"+m" (*Value) // %1 "+m" (*Value) // %1
: // no inputs that aren't also outputs : // no inputs that aren't also outputs
@ -48,7 +48,6 @@ InternalSyncIncrement (
); );
return Result; return Result;
} }
@ -76,10 +75,10 @@ InternalSyncDecrement (
"movl $-1, %%eax \n\t" "movl $-1, %%eax \n\t"
"lock \n\t" "lock \n\t"
"xadd %%eax, %1 \n\t" "xadd %%eax, %1 \n\t"
"dec %%eax " "dec %%eax \n\t"
: "=a" (Result), // %0 : "=a" (Result), // %0
"+m" (*Value) // %1 "+m" (*Value) // %1
: // no inputs that aren't also outputs : // no inputs that aren't also outputs
: "memory", : "memory",
"cc" "cc"
); );
@ -87,6 +86,7 @@ InternalSyncDecrement (
return Result; return Result;
} }
/** /**
Performs an atomic compare exchange operation on a 16-bit unsigned integer. Performs an atomic compare exchange operation on a 16-bit unsigned integer.
@ -113,15 +113,13 @@ InternalSyncCompareExchange16 (
IN UINT16 ExchangeValue IN UINT16 ExchangeValue
) )
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
" \n\t"
"lock \n\t" "lock \n\t"
"cmpxchgw %1, %2 \n\t" "cmpxchgw %1, %2 \n\t"
: "=a" (CompareValue) : "=a" (CompareValue) // %0
: "q" (ExchangeValue), : "q" (ExchangeValue), // %1
"m" (*Value), "m" (*Value), // %2
"0" (CompareValue) "0" (CompareValue) // %3
: "memory", : "memory",
"cc" "cc"
); );
@ -129,6 +127,7 @@ InternalSyncCompareExchange16 (
return CompareValue; return CompareValue;
} }
/** /**
Performs an atomic compare exchange operation on a 32-bit unsigned integer. Performs an atomic compare exchange operation on a 32-bit unsigned integer.
@ -155,15 +154,13 @@ InternalSyncCompareExchange32 (
IN UINT32 ExchangeValue IN UINT32 ExchangeValue
) )
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
" \n\t"
"lock \n\t" "lock \n\t"
"cmpxchgl %1, %2 \n\t" "cmpxchgl %1, %2 \n\t"
: "=a" (CompareValue) // %0 : "=a" (CompareValue) // %0
: "q" (ExchangeValue), // %1 : "q" (ExchangeValue), // %1
"m" (*Value), // %2 "m" (*Value), // %2
"0" (CompareValue) // %4 "0" (CompareValue) // %3
: "memory", : "memory",
"cc" "cc"
); );
@ -171,6 +168,7 @@ InternalSyncCompareExchange32 (
return CompareValue; return CompareValue;
} }
/** /**
Performs an atomic compare exchange operation on a 64-bit unsigned integer. Performs an atomic compare exchange operation on a 64-bit unsigned integer.
@ -197,7 +195,6 @@ InternalSyncCompareExchange64 (
) )
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
" \n\t"
"push %%ebx \n\t" "push %%ebx \n\t"
"movl %2,%%ebx \n\t" "movl %2,%%ebx \n\t"
"lock \n\t" "lock \n\t"

View File

@ -39,7 +39,7 @@ InternalSyncIncrement (
"movl $1, %%eax \n\t" "movl $1, %%eax \n\t"
"lock \n\t" "lock \n\t"
"xadd %%eax, %1 \n\t" "xadd %%eax, %1 \n\t"
"inc %%eax " "inc %%eax \n\t"
: "=a" (Result), // %0 : "=a" (Result), // %0
"+m" (*Value) // %1 "+m" (*Value) // %1
: // no inputs that aren't also outputs : // no inputs that aren't also outputs
@ -75,10 +75,10 @@ InternalSyncDecrement (
"movl $-1, %%eax \n\t" "movl $-1, %%eax \n\t"
"lock \n\t" "lock \n\t"
"xadd %%eax, %1 \n\t" "xadd %%eax, %1 \n\t"
"dec %%eax " "dec %%eax \n\t"
: "=a" (Result), // %0 : "=a" (Result), // %0
"+m" (*Value) // %1 "+m" (*Value) // %1
: // no inputs that aren't also outputs : // no inputs that aren't also outputs
: "memory", : "memory",
"cc" "cc"
); );
@ -113,16 +113,14 @@ InternalSyncCompareExchange16 (
IN UINT16 ExchangeValue IN UINT16 ExchangeValue
) )
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"lock \n\t" "lock \n\t"
"cmpxchgw %3, %1 " "cmpxchgw %3, %1 \n\t"
: "=a" (CompareValue), : "=a" (CompareValue), // %0
"=m" (*Value) "=m" (*Value) // %1
: "a" (CompareValue), : "a" (CompareValue), // %2
"r" (ExchangeValue), "r" (ExchangeValue), // %3
"m" (*Value) "m" (*Value) // %4
: "memory", : "memory",
"cc" "cc"
); );
@ -157,16 +155,14 @@ InternalSyncCompareExchange32 (
IN UINT32 ExchangeValue IN UINT32 ExchangeValue
) )
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"lock \n\t" "lock \n\t"
"cmpxchgl %3, %1 " "cmpxchgl %3, %1 \n\t"
: "=a" (CompareValue), // %0 : "=a" (CompareValue), // %0
"=m" (*Value) // %1 "=m" (*Value) // %1
: "a" (CompareValue), // %2 : "a" (CompareValue), // %2
"r" (ExchangeValue), // %3 "r" (ExchangeValue), // %3
"m" (*Value) "m" (*Value) // %4
: "memory", : "memory",
"cc" "cc"
); );
@ -200,20 +196,17 @@ InternalSyncCompareExchange64 (
IN UINT64 ExchangeValue IN UINT64 ExchangeValue
) )
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"lock \n\t" "lock \n\t"
"cmpxchgq %3, %1 " "cmpxchgq %3, %1 \n\t"
: "=a" (CompareValue), // %0 : "=a" (CompareValue), // %0
"=m" (*Value) // %1 "=m" (*Value) // %1
: "a" (CompareValue), // %2 : "a" (CompareValue), // %2
"r" (ExchangeValue), // %3 "r" (ExchangeValue), // %3
"m" (*Value) "m" (*Value) // %4
: "memory", : "memory",
"cc" "cc"
); );
return CompareValue; return CompareValue;
} }