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