Changeset 77662 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib
- Timestamp:
- Mar 12, 2019 12:40:12 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 129295
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 20 added
- 2 deleted
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776 /vendor/edk2/current 103735-103757,103769-103776,129194-129237
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
r58466 r77662 2 2 # Base Synchronization Library implementation. 3 3 # 4 # Copyright (c) 2007 - 201 4, Intel Corporation. All rights reserved.<BR>4 # Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> 6 6 # … … 31 31 32 32 [Sources.IA32] 33 Ia32/InternalGetSpinLockProperties.c | MSFT 33 34 Ia32/InterlockedCompareExchange64.c | MSFT 34 35 Ia32/InterlockedCompareExchange32.c | MSFT 36 Ia32/InterlockedCompareExchange16.c | MSFT 35 37 Ia32/InterlockedDecrement.c | MSFT 36 38 Ia32/InterlockedIncrement.c | MSFT 37 39 SynchronizationMsc.c | MSFT 38 40 41 Ia32/InterlockedCompareExchange64.nasm| INTEL 39 42 Ia32/InterlockedCompareExchange64.asm | INTEL 43 Ia32/InterlockedCompareExchange32.nasm| INTEL 40 44 Ia32/InterlockedCompareExchange32.asm | INTEL 45 Ia32/InterlockedCompareExchange16.nasm| INTEL 46 Ia32/InterlockedCompareExchange16.asm | INTEL 47 Ia32/InterlockedDecrement.nasm| INTEL 41 48 Ia32/InterlockedDecrement.asm | INTEL 49 Ia32/InterlockedIncrement.nasm| INTEL 42 50 Ia32/InterlockedIncrement.asm | INTEL 43 51 Synchronization.c | INTEL 44 52 53 Ia32/InternalGetSpinLockProperties.c | GCC 45 54 Ia32/GccInline.c | GCC 46 55 SynchronizationGcc.c | GCC 47 56 48 57 [Sources.X64] 58 Ia32/InternalGetSpinLockProperties.c | MSFT 49 59 X64/InterlockedCompareExchange64.c | MSFT 50 60 X64/InterlockedCompareExchange32.c | MSFT 61 X64/InterlockedCompareExchange16.c | MSFT 51 62 63 X64/InterlockedCompareExchange64.nasm| INTEL 52 64 X64/InterlockedCompareExchange64.asm | INTEL 65 X64/InterlockedCompareExchange32.nasm| INTEL 53 66 X64/InterlockedCompareExchange32.asm | INTEL 67 X64/InterlockedCompareExchange16.nasm| INTEL 68 X64/InterlockedCompareExchange16.asm | INTEL 54 69 55 70 X64/InterlockedDecrement.c | MSFT … … 57 72 SynchronizationMsc.c | MSFT 58 73 74 X64/InterlockedDecrement.nasm| INTEL 59 75 X64/InterlockedDecrement.asm | INTEL 76 X64/InterlockedIncrement.nasm| INTEL 60 77 X64/InterlockedIncrement.asm | INTEL 61 78 Synchronization.c | INTEL 62 79 80 Ia32/InternalGetSpinLockProperties.c | GCC 63 81 X64/GccInline.c | GCC 64 82 SynchronizationGcc.c | GCC … … 68 86 Ipf/InterlockedCompareExchange64.s 69 87 Ipf/InterlockedCompareExchange32.s 88 Ipf/InterlockedCompareExchange16.s 89 90 Ipf/InternalGetSpinLockProperties.c | MSFT 91 Ipf/InternalGetSpinLockProperties.c | GCC 70 92 71 93 Synchronization.c | INTEL … … 79 101 [Sources.ARM] 80 102 Synchronization.c 81 Arm/Synchronization.c 103 Arm/Synchronization.asm | RVCT 104 Arm/Synchronization.S | GCC 82 105 83 106 [Sources.AARCH64] 84 107 Synchronization.c 85 AArch64/Synchronization. c108 AArch64/Synchronization.S 86 109 87 110 [Packages] -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.uni
r58464 r77662 1 // /** @file1 // /** @file 2 2 // Base Synchronization Library implementation. 3 3 // -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
r48674 r77662 2 2 Declaration of internal functions in BaseSynchronizationLib. 3 3 4 Copyright (c) 2006 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 64 64 65 65 /** 66 Performs an atomic compare exchange operation on a 16-bit unsigned integer. 67 68 Performs an atomic compare exchange operation on the 16-bit unsigned integer 69 specified by Value. If Value is equal to CompareValue, then Value is set to 70 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, 71 then Value is returned. The compare exchange operation must be performed using 72 MP safe mechanisms. 73 74 @param Value A pointer to the 16-bit value for the compare exchange 75 operation. 76 @param CompareValue A 16-bit value used in compare operation. 77 @param ExchangeValue A 16-bit value used in exchange operation. 78 79 @return The original *Value before exchange. 80 81 **/ 82 UINT16 83 EFIAPI 84 InternalSyncCompareExchange16 ( 85 IN volatile UINT16 *Value, 86 IN UINT16 CompareValue, 87 IN UINT16 ExchangeValue 88 ); 89 90 91 /** 66 92 Performs an atomic compare exchange operation on a 32-bit unsigned integer. 67 93 … … 113 139 ); 114 140 141 /** 142 Internal function to retrieve the architecture specific spin lock alignment 143 requirements for optimal spin lock performance. 144 145 @return The architecture specific spin lock alignment. 146 147 **/ 148 UINTN 149 InternalGetSpinLockProperties ( 150 VOID 151 ); 152 115 153 #endif -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/Ebc/Synchronization.c
r58466 r77662 12 12 13 13 **/ 14 15 /** 16 Performs an atomic compare exchange operation on a 16-bit 17 unsigned integer. 18 19 Performs an atomic compare exchange operation on the 16-bit 20 unsigned integer specified by Value. If Value is equal to 21 CompareValue, then Value is set to ExchangeValue and 22 CompareValue is returned. If Value is not equal to 23 CompareValue, then Value is returned. The compare exchange 24 operation must be performed using MP safe mechanisms. 25 26 @param Value A pointer to the 16-bit value for the 27 compare exchange operation. 28 @param CompareValue 16-bit value used in compare operation. 29 @param ExchangeValue 16-bit value used in exchange operation. 30 31 @return The original *Value before exchange. 32 33 **/ 34 UINT16 35 EFIAPI 36 InternalSyncCompareExchange16 ( 37 IN volatile UINT16 *Value, 38 IN UINT16 CompareValue, 39 IN UINT16 ExchangeValue 40 ) 41 { 42 return *Value != CompareValue ? *Value : 43 ((*Value = ExchangeValue), CompareValue); 44 } 14 45 15 46 /** -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c
r58466 r77662 86 86 87 87 return Result; 88 } 89 90 /** 91 Performs an atomic compare exchange operation on a 16-bit unsigned integer. 92 93 Performs an atomic compare exchange operation on the 16-bit unsigned integer 94 specified by Value. If Value is equal to CompareValue, then Value is set to 95 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, 96 then Value is returned. The compare exchange operation must be performed using 97 MP safe mechanisms. 98 99 100 @param Value A pointer to the 16-bit value for the compare exchange 101 operation. 102 @param CompareValue 16-bit value used in compare operation. 103 @param ExchangeValue 16-bit value used in exchange operation. 104 105 @return The original *Value before exchange. 106 107 **/ 108 UINT16 109 EFIAPI 110 InternalSyncCompareExchange16 ( 111 IN OUT volatile UINT16 *Value, 112 IN UINT16 CompareValue, 113 IN UINT16 ExchangeValue 114 ) 115 { 116 117 __asm__ __volatile__ ( 118 " \n\t" 119 "lock \n\t" 120 "cmpxchgw %1, %2 \n\t" 121 : "=a" (CompareValue) 122 : "q" (ExchangeValue), 123 "m" (*Value), 124 "0" (CompareValue) 125 : "memory", 126 "cc" 127 ); 128 129 return CompareValue; 88 130 } 89 131 -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.asm
r48674 r77662 1 1 ;------------------------------------------------------------------------------ 2 2 ; 3 ; Copyright (c) 2006 , Intel Corporation. All rights reserved.<BR>3 ; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 4 4 ; This program and the accompanying materials 5 5 ; are licensed and made available under the terms and conditions of the BSD License … … 30 30 ; EFIAPI 31 31 ; InternalSyncCompareExchange32 ( 32 ; IN UINT32*Value,32 ; IN volatile UINT32 *Value, 33 33 ; IN UINT32 CompareValue, 34 34 ; IN UINT32 ExchangeValue -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c
r48674 r77662 2 2 InterlockedCompareExchange32 function 3 3 4 Copyright (c) 2006 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 36 36 EFIAPI 37 37 InternalSyncCompareExchange32 ( 38 IN UINT32*Value,38 IN volatile UINT32 *Value, 39 39 IN UINT32 CompareValue, 40 40 IN UINT32 ExchangeValue -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.asm
r48674 r77662 1 1 ;------------------------------------------------------------------------------ 2 2 ; 3 ; Copyright (c) 2006 , Intel Corporation. All rights reserved.<BR>3 ; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 4 4 ; This program and the accompanying materials 5 5 ; are licensed and made available under the terms and conditions of the BSD License … … 30 30 ; EFIAPI 31 31 ; InternalSyncCompareExchange64 ( 32 ; IN UINT64*Value,32 ; IN volatile UINT64 *Value, 33 33 ; IN UINT64 CompareValue, 34 34 ; IN UINT64 ExchangeValue -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c
r48674 r77662 2 2 InterlockedCompareExchange64 function 3 3 4 Copyright (c) 2006 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 35 35 EFIAPI 36 36 InternalSyncCompareExchange64 ( 37 IN UINT64*Value,37 IN volatile UINT64 *Value, 38 38 IN UINT64 CompareValue, 39 39 IN UINT64 ExchangeValue -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.asm
r48674 r77662 1 1 ;------------------------------------------------------------------------------ 2 2 ; 3 ; Copyright (c) 2006 , Intel Corporation. All rights reserved.<BR>3 ; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 4 4 ; This program and the accompanying materials 5 5 ; are licensed and made available under the terms and conditions of the BSD License … … 30 30 ; EFIAPI 31 31 ; InternalSyncDecrement ( 32 ; IN UINT32*Value32 ; IN volatile UINT32 *Value 33 33 ; ); 34 34 ;------------------------------------------------------------------------------ -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.c
r48674 r77662 2 2 InterlockedDecrement function 3 3 4 Copyright (c) 2006 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 32 32 EFIAPI 33 33 InternalSyncDecrement ( 34 IN UINT32*Value34 IN volatile UINT32 *Value 35 35 ) 36 36 { -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.asm
r48674 r77662 1 1 ;------------------------------------------------------------------------------ 2 2 ; 3 ; Copyright (c) 2006 , Intel Corporation. All rights reserved.<BR>3 ; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 4 4 ; This program and the accompanying materials 5 5 ; are licensed and made available under the terms and conditions of the BSD License … … 30 30 ; EFIAPI 31 31 ; InternalSyncIncrement ( 32 ; IN UINT32*Value32 ; IN volatile UINT32 *Value 33 33 ; ); 34 34 ;------------------------------------------------------------------------------ -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.c
r48674 r77662 2 2 InterLockedIncrement function 3 3 4 Copyright (c) 2006 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 32 32 EFIAPI 33 33 InternalSyncIncrement ( 34 IN UINT32*Value34 IN volatile UINT32 *Value 35 35 ) 36 36 { -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/Synchronization.c
r58466 r77662 2 2 Implementation of synchronization functions. 3 3 4 Copyright (c) 2006 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 105 105 INT64 Delta; 106 106 107 if (PcdGet32 (PcdSpinLockTimeout) > 0) { 107 if (PcdGet32 (PcdSpinLockTimeout) == 0) { 108 while (!AcquireSpinLockOrFail (SpinLock)) { 109 CpuPause (); 110 } 111 } else if (!AcquireSpinLockOrFail (SpinLock)) { 108 112 // 109 113 // Get the current timer value … … 149 153 ASSERT (Total < Timeout); 150 154 } 151 } else {152 while (!AcquireSpinLockOrFail (SpinLock)) {153 CpuPause ();154 }155 155 } 156 156 return SpinLock; … … 245 245 EFIAPI 246 246 InterlockedIncrement ( 247 IN UINT32*Value247 IN volatile UINT32 *Value 248 248 ) 249 249 { … … 270 270 EFIAPI 271 271 InterlockedDecrement ( 272 IN UINT32*Value272 IN volatile UINT32 *Value 273 273 ) 274 274 { 275 275 ASSERT (Value != NULL); 276 276 return InternalSyncDecrement (Value); 277 } 278 279 /** 280 Performs an atomic compare exchange operation on a 16-bit unsigned integer. 281 282 Performs an atomic compare exchange operation on the 16-bit unsigned integer 283 specified by Value. If Value is equal to CompareValue, then Value is set to 284 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, 285 then Value is returned. The compare exchange operation must be performed using 286 MP safe mechanisms. 287 288 If Value is NULL, then ASSERT(). 289 290 @param Value A pointer to the 16-bit value for the compare exchange 291 operation. 292 @param CompareValue 16-bit value used in compare operation. 293 @param ExchangeValue 16-bit value used in exchange operation. 294 295 @return The original *Value before exchange. 296 297 **/ 298 UINT16 299 EFIAPI 300 InterlockedCompareExchange16 ( 301 IN OUT volatile UINT16 *Value, 302 IN UINT16 CompareValue, 303 IN UINT16 ExchangeValue 304 ) 305 { 306 ASSERT (Value != NULL); 307 return InternalSyncCompareExchange16 (Value, CompareValue, ExchangeValue); 277 308 } 278 309 … … 299 330 EFIAPI 300 331 InterlockedCompareExchange32 ( 301 IN OUT UINT32*Value,332 IN OUT volatile UINT32 *Value, 302 333 IN UINT32 CompareValue, 303 334 IN UINT32 ExchangeValue … … 329 360 EFIAPI 330 361 InterlockedCompareExchange64 ( 331 IN OUT UINT64*Value,362 IN OUT volatile UINT64 *Value, 332 363 IN UINT64 CompareValue, 333 364 IN UINT64 ExchangeValue … … 359 390 EFIAPI 360 391 InterlockedCompareExchangePointer ( 361 IN OUT VOID * *Value,392 IN OUT VOID * volatile *Value, 362 393 IN VOID *CompareValue, 363 394 IN VOID *ExchangeValue … … 371 402 case sizeof (UINT32): 372 403 return (VOID*)(UINTN)InterlockedCompareExchange32 ( 373 ( UINT32*)Value,404 (volatile UINT32 *)Value, 374 405 (UINT32)(UINTN)CompareValue, 375 406 (UINT32)(UINTN)ExchangeValue … … 377 408 case sizeof (UINT64): 378 409 return (VOID*)(UINTN)InterlockedCompareExchange64 ( 379 ( UINT64*)Value,410 (volatile UINT64 *)Value, 380 411 (UINT64)(UINTN)CompareValue, 381 412 (UINT64)(UINTN)ExchangeValue -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c
r58466 r77662 2 2 Implementation of synchronization functions. 3 3 4 Copyright (c) 2006 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> 6 6 This program and the accompanying materials … … 46 46 ) 47 47 { 48 return 32;48 return InternalGetSpinLockProperties (); 49 49 } 50 50 … … 115 115 INT64 Delta; 116 116 117 if (PcdGet32 (PcdSpinLockTimeout) > 0) { 117 if (PcdGet32 (PcdSpinLockTimeout) == 0) { 118 while (!AcquireSpinLockOrFail (SpinLock)) { 119 CpuPause (); 120 } 121 } else if (!AcquireSpinLockOrFail (SpinLock)) { 118 122 // 119 123 // Get the current timer value … … 159 163 ASSERT (Total < Timeout); 160 164 } 161 } else {162 while (!AcquireSpinLockOrFail (SpinLock)) {163 CpuPause ();164 }165 165 } 166 166 return SpinLock; … … 261 261 EFIAPI 262 262 InterlockedIncrement ( 263 IN UINT32*Value263 IN volatile UINT32 *Value 264 264 ) 265 265 { … … 286 286 EFIAPI 287 287 InterlockedDecrement ( 288 IN UINT32*Value288 IN volatile UINT32 *Value 289 289 ) 290 290 { 291 291 ASSERT (Value != NULL); 292 292 return InternalSyncDecrement (Value); 293 } 294 295 /** 296 Performs an atomic compare exchange operation on a 16-bit unsigned integer. 297 298 Performs an atomic compare exchange operation on the 16-bit unsigned integer 299 specified by Value. If Value is equal to CompareValue, then Value is set to 300 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, 301 then Value is returned. The compare exchange operation must be performed using 302 MP safe mechanisms. 303 304 If Value is NULL, then ASSERT(). 305 306 @param Value A pointer to the 16-bit value for the compare exchange 307 operation. 308 @param CompareValue A 16-bit value used in compare operation. 309 @param ExchangeValue A 16-bit value used in exchange operation. 310 311 @return The original *Value before exchange. 312 313 **/ 314 UINT16 315 EFIAPI 316 InterlockedCompareExchange16 ( 317 IN OUT volatile UINT16 *Value, 318 IN UINT16 CompareValue, 319 IN UINT16 ExchangeValue 320 ) 321 { 322 ASSERT (Value != NULL); 323 return InternalSyncCompareExchange16 (Value, CompareValue, ExchangeValue); 293 324 } 294 325 … … 315 346 EFIAPI 316 347 InterlockedCompareExchange32 ( 317 IN OUT UINT32*Value,348 IN OUT volatile UINT32 *Value, 318 349 IN UINT32 CompareValue, 319 350 IN UINT32 ExchangeValue … … 345 376 EFIAPI 346 377 InterlockedCompareExchange64 ( 347 IN OUT UINT64*Value,378 IN OUT volatile UINT64 *Value, 348 379 IN UINT64 CompareValue, 349 380 IN UINT64 ExchangeValue … … 375 406 EFIAPI 376 407 InterlockedCompareExchangePointer ( 377 IN OUT VOID * *Value,408 IN OUT VOID * volatile *Value, 378 409 IN VOID *CompareValue, 379 410 IN VOID *ExchangeValue … … 387 418 case sizeof (UINT32): 388 419 return (VOID*)(UINTN)InterlockedCompareExchange32 ( 389 ( UINT32*)Value,420 (volatile UINT32 *)Value, 390 421 (UINT32)(UINTN)CompareValue, 391 422 (UINT32)(UINTN)ExchangeValue … … 393 424 case sizeof (UINT64): 394 425 return (VOID*)(UINTN)InterlockedCompareExchange64 ( 395 ( UINT64*)Value,426 (volatile UINT64 *)Value, 396 427 (UINT64)(UINTN)CompareValue, 397 428 (UINT64)(UINTN)ExchangeValue -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c
r58466 r77662 2 2 Implementation of synchronization functions. 3 3 4 Copyright (c) 2006 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 48 48 ) 49 49 { 50 return 32;50 return InternalGetSpinLockProperties (); 51 51 } 52 52 … … 117 117 INT64 Delta; 118 118 119 if (PcdGet32 (PcdSpinLockTimeout) > 0) { 119 if (PcdGet32 (PcdSpinLockTimeout) == 0) { 120 while (!AcquireSpinLockOrFail (SpinLock)) { 121 CpuPause (); 122 } 123 } else if (!AcquireSpinLockOrFail (SpinLock)) { 120 124 // 121 125 // Get the current timer value … … 161 165 ASSERT (Total < Timeout); 162 166 } 163 } else {164 while (!AcquireSpinLockOrFail (SpinLock)) {165 CpuPause ();166 }167 167 } 168 168 return SpinLock; … … 263 263 EFIAPI 264 264 InterlockedIncrement ( 265 IN UINT32*Value265 IN volatile UINT32 *Value 266 266 ) 267 267 { … … 288 288 EFIAPI 289 289 InterlockedDecrement ( 290 IN UINT32*Value290 IN volatile UINT32 *Value 291 291 ) 292 292 { 293 293 ASSERT (Value != NULL); 294 294 return InternalSyncDecrement (Value); 295 } 296 297 /** 298 Performs an atomic compare exchange operation on a 16-bit unsigned integer. 299 300 Performs an atomic compare exchange operation on the 16-bit unsigned integer 301 specified by Value. If Value is equal to CompareValue, then Value is set to 302 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, 303 then Value is returned. The compare exchange operation must be performed using 304 MP safe mechanisms. 305 306 If Value is NULL, then ASSERT(). 307 308 @param Value A pointer to the 16-bit value for the compare exchange 309 operation. 310 @param CompareValue A 16-bit value used in a compare operation. 311 @param ExchangeValue A 16-bit value used in an exchange operation. 312 313 @return The original *Value before exchange. 314 315 **/ 316 UINT16 317 EFIAPI 318 InterlockedCompareExchange16 ( 319 IN OUT volatile UINT16 *Value, 320 IN UINT16 CompareValue, 321 IN UINT16 ExchangeValue 322 ) 323 { 324 ASSERT (Value != NULL); 325 return InternalSyncCompareExchange16 (Value, CompareValue, ExchangeValue); 295 326 } 296 327 … … 317 348 EFIAPI 318 349 InterlockedCompareExchange32 ( 319 IN OUT UINT32*Value,350 IN OUT volatile UINT32 *Value, 320 351 IN UINT32 CompareValue, 321 352 IN UINT32 ExchangeValue … … 347 378 EFIAPI 348 379 InterlockedCompareExchange64 ( 349 IN OUT UINT64*Value,380 IN OUT volatile UINT64 *Value, 350 381 IN UINT64 CompareValue, 351 382 IN UINT64 ExchangeValue … … 377 408 EFIAPI 378 409 InterlockedCompareExchangePointer ( 379 IN OUT VOID * *Value,410 IN OUT VOID * volatile *Value, 380 411 IN VOID *CompareValue, 381 412 IN VOID *ExchangeValue … … 389 420 case sizeof (UINT32): 390 421 return (VOID*)(UINTN)InterlockedCompareExchange32 ( 391 ( UINT32*)Value,422 (volatile UINT32*)Value, 392 423 (UINT32)(UINTN)CompareValue, 393 424 (UINT32)(UINTN)ExchangeValue … … 395 426 case sizeof (UINT64): 396 427 return (VOID*)(UINTN)InterlockedCompareExchange64 ( 397 ( UINT64*)Value,428 (volatile UINT64*)Value, 398 429 (UINT64)(UINTN)CompareValue, 399 430 (UINT64)(UINTN)ExchangeValue -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c
r58466 r77662 90 90 91 91 /** 92 Performs an atomic compare exchange operation on a 16-bit unsigned integer. 93 94 Performs an atomic compare exchange operation on the 16-bit unsigned integer 95 specified by Value. If Value is equal to CompareValue, then Value is set to 96 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, 97 then Value is returned. The compare exchange operation must be performed using 98 MP safe mechanisms. 99 100 101 @param Value A pointer to the 16-bit value for the compare exchange 102 operation. 103 @param CompareValue 16-bit value used in compare operation. 104 @param ExchangeValue 16-bit value used in exchange operation. 105 106 @return The original *Value before exchange. 107 108 **/ 109 UINT16 110 EFIAPI 111 InternalSyncCompareExchange16 ( 112 IN OUT volatile UINT16 *Value, 113 IN UINT16 CompareValue, 114 IN UINT16 ExchangeValue 115 ) 116 { 117 118 119 __asm__ __volatile__ ( 120 "lock \n\t" 121 "cmpxchgw %3, %1 " 122 : "=a" (CompareValue), 123 "=m" (*Value) 124 : "a" (CompareValue), 125 "r" (ExchangeValue), 126 "m" (*Value) 127 : "memory", 128 "cc" 129 ); 130 131 return CompareValue; 132 } 133 134 135 /** 92 136 Performs an atomic compare exchange operation on a 32-bit unsigned integer. 93 137 -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.asm
r48674 r77662 1 1 ;------------------------------------------------------------------------------ 2 2 ; 3 ; Copyright (c) 2006 , Intel Corporation. All rights reserved.<BR>3 ; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 4 4 ; This program and the accompanying materials 5 5 ; are licensed and made available under the terms and conditions of the BSD License … … 27 27 ; UINT32 28 28 ; EFIAPI 29 ; Inter lockedCompareExchange32 (30 ; IN UINT32*Value,29 ; InternalSyncCompareExchange32 ( 30 ; IN volatile UINT32 *Value, 31 31 ; IN UINT32 CompareValue, 32 32 ; IN UINT32 ExchangeValue -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c
r48674 r77662 2 2 InterlockedCompareExchange32 function 3 3 4 Copyright (c) 2006 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 45 45 EFIAPI 46 46 InternalSyncCompareExchange32 ( 47 IN UINT32*Value,47 IN volatile UINT32 *Value, 48 48 IN UINT32 CompareValue, 49 49 IN UINT32 ExchangeValue -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.asm
r48674 r77662 1 1 ;------------------------------------------------------------------------------ 2 2 ; 3 ; Copyright (c) 2006 , Intel Corporation. All rights reserved.<BR>3 ; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 4 4 ; This program and the accompanying materials 5 5 ; are licensed and made available under the terms and conditions of the BSD License … … 27 27 ; UINT64 28 28 ; EFIAPI 29 ; Inter lockedCompareExchange64 (30 ; IN UINT64*Value,29 ; InternalSyncCompareExchange64 ( 30 ; IN volatile UINT64 *Value, 31 31 ; IN UINT64 CompareValue, 32 32 ; IN UINT64 ExchangeValue -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c
r48674 r77662 2 2 InterlockedCompareExchange64 function 3 3 4 Copyright (c) 2006 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 44 44 EFIAPI 45 45 InternalSyncCompareExchange64 ( 46 IN UINT64*Value,46 IN volatile UINT64 *Value, 47 47 IN UINT64 CompareValue, 48 48 IN UINT64 ExchangeValue -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.asm
r48674 r77662 1 1 ;------------------------------------------------------------------------------ 2 2 ; 3 ; Copyright (c) 2006 , Intel Corporation. All rights reserved.<BR>3 ; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 4 4 ; This program and the accompanying materials 5 5 ; are licensed and made available under the terms and conditions of the BSD License … … 27 27 ; UINT32 28 28 ; EFIAPI 29 ; Inter lockedDecrement (30 ; IN UINT32*Value29 ; InternalSyncDecrement ( 30 ; IN volatile UINT32 *Value 31 31 ; ); 32 32 ;------------------------------------------------------------------------------ -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.c
r48674 r77662 2 2 InterlockedDecrement function 3 3 4 Copyright (c) 2006 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 39 39 EFIAPI 40 40 InternalSyncDecrement ( 41 IN UINT32*Value41 IN volatile UINT32 *Value 42 42 ) 43 43 { 44 return _InterlockedDecrement ( Value);44 return _InterlockedDecrement ((long *)(UINTN)(Value)); 45 45 } 46 46 -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.asm
r48674 r77662 1 1 ;------------------------------------------------------------------------------ 2 2 ; 3 ; Copyright (c) 2006 , Intel Corporation. All rights reserved.<BR>3 ; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 4 4 ; This program and the accompanying materials 5 5 ; are licensed and made available under the terms and conditions of the BSD License … … 27 27 ; UINT32 28 28 ; EFIAPI 29 ; Inter lockedIncrement (30 ; IN UINT32*Value29 ; InternalSyncIncrement ( 30 ; IN volatile UINT32 *Value 31 31 ; ); 32 32 ;------------------------------------------------------------------------------ -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.c
r48674 r77662 2 2 InterLockedIncrement function 3 3 4 Copyright (c) 2006 - 20 08, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 39 39 EFIAPI 40 40 InternalSyncIncrement ( 41 IN UINT32*Value41 IN volatile UINT32 *Value 42 42 ) 43 43 { 44 return _InterlockedIncrement ( Value);44 return _InterlockedIncrement ((long *)(UINTN)(Value)); 45 45 } 46 46
Note:
See TracChangeset
for help on using the changeset viewer.