X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FLibrary%2FBaseLib%2FIa32%2FFlushCacheLine.c;h=7ac4af353f7bd2f2aca2ae6d7fe1eadea66ac3a1;hb=6f7878a97281299bf4a052687a177dfbee4b0de1;hp=d157fbfb67f53222b17857ad54a24975dadf4801;hpb=030cd1a2e95018683638462e9fcfa2d204aaff33;p=mirror_edk2.git diff --git a/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c b/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c index d157fbfb67..7ac4af353f 100644 --- a/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c +++ b/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c @@ -1,11 +1,11 @@ /** @file AsmFlushCacheLine function - Copyright (c) 2006 - 2007, Intel Corporation
- All rights reserved. This program and the accompanying materials + Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php + http://opensource.org/licenses/bsd-license.php. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @@ -36,9 +36,23 @@ AsmFlushCacheLine ( IN VOID *LinearAddress ) { + // + // If the CPU does not support CLFLUSH instruction, + // then promote flush range to flush entire cache. + // _asm { - mov eax, LinearAddress + mov eax, 1 + cpuid + test edx, BIT19 + jz NoClflush + mov eax, dword ptr [LinearAddress] clflush [eax] + jmp Done +NoClflush: + wbinvd +Done: } + + return LinearAddress; }