]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/DisableCache.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / DisableCache.c
1 /** @file
2 AsmDisableCache function
3
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 /**
10 Set CD bit and clear NW bit of CR0 followed by a WBINVD.
11
12 Disables the caches by setting the CD bit of CR0 to 1, clearing the NW bit of CR0 to 0,
13 and executing a WBINVD instruction. This function is only available on IA-32 and x64.
14
15 **/
16 VOID
17 EFIAPI
18 AsmDisableCache (
19 VOID
20 )
21 {
22 _asm {
23 mov eax, cr0
24 bts eax, 30
25 btr eax, 29
26 mov cr0, eax
27 wbinvd
28 }
29 }
30