]>
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 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include "BaseSynchronizationLibInternals.h"
12 Internal function to retrieve the architecture specific spin lock alignment
13 requirements for optimal spin lock performance.
15 @return The architecture specific spin lock alignment.
19 InternalGetSpinLockProperties (
30 // Retrieve CPUID Version Information
32 AsmCpuid (0x01, &RegEax
, &RegEbx
, NULL
, NULL
);
34 // EBX: Bits 15 - 08: CLFLUSH line size (Value * 8 = cache line size)
36 CacheLineSize
= ((RegEbx
>> 8) & 0xff) * 8;
38 // Retrieve CPU Family and Model
40 FamilyId
= (RegEax
>> 8) & 0xf;
41 ModelId
= (RegEax
>> 4) & 0xf;
42 if (FamilyId
== 0x0f) {
44 // In processors based on Intel NetBurst microarchitecture, use two cache lines
46 ModelId
= ModelId
| ((RegEax
>> 12) & 0xf0);
47 if (ModelId
<= 0x04 || ModelId
== 0x06) {
52 if (CacheLineSize
< 32) {