]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseSynchronizationLib/Ia32/InternalGetSpinLockProperties.c
2 Internal function to get spin lock alignment.
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "BaseSynchronizationLibInternals.h"
18 Internal function to retrieve the architecture specific spin lock alignment
19 requirements for optimal spin lock performance.
21 @return The architecture specific spin lock alignment.
25 InternalGetSpinLockProperties (
36 // Retrieve CPUID Version Information
38 AsmCpuid (0x01, &RegEax
, &RegEbx
, NULL
, NULL
);
40 // EBX: Bits 15 - 08: CLFLUSH line size (Value * 8 = cache line size)
42 CacheLineSize
= ((RegEbx
>> 8) & 0xff) * 8;
44 // Retrieve CPU Family and Model
46 FamilyId
= (RegEax
>> 8) & 0xf;
47 ModelId
= (RegEax
>> 4) & 0xf;
48 if (FamilyId
== 0x0f) {
50 // In processors based on Intel NetBurst microarchitecture, use two cache lines
52 ModelId
= ModelId
| ((RegEax
>> 12) & 0xf0);
53 if (ModelId
<= 0x04 || ModelId
== 0x06) {
58 if (CacheLineSize
< 32) {