2008-11-24 09:30:58 +01:00
|
|
|
/** @file
|
|
|
|
AsmDisableCache function
|
|
|
|
|
2010-04-23 18:00:47 +02:00
|
|
|
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
|
|
|
This program and the accompanying materials
|
2008-11-24 09:30:58 +01:00
|
|
|
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
|
2010-06-11 02:02:51 +02:00
|
|
|
http://opensource.org/licenses/bsd-license.php.
|
2008-11-24 09:30:58 +01:00
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
/**
|
2008-12-03 03:19:49 +01:00
|
|
|
Set CD bit and clear NW bit of CR0 followed by a WBINVD.
|
2008-11-24 09:30:58 +01:00
|
|
|
|
2008-12-03 03:19:49 +01:00
|
|
|
Disables the caches by setting the CD bit of CR0 to 1, clearing the NW bit of CR0 to 0,
|
|
|
|
and executing a WBINVD instruction. This function is only available on IA-32 and x64.
|
2008-11-24 09:30:58 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
AsmDisableCache (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
|
|
|
_asm {
|
|
|
|
mov eax, cr0
|
|
|
|
bts eax, 30
|
|
|
|
btr eax, 29
|
|
|
|
mov cr0, eax
|
|
|
|
wbinvd
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|