/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
Reads and returns the current GDTR descriptor and returns it in Gdtr. This
function is only available on IA-32 and x64.
If Gdtr is NULL, then ASSERT().
@param Gdtr The pointer to a GDTR descriptor.
**/
VOID
EFIAPI
AsmReadGdtr (
OUT IA32_DESCRIPTOR *Gdtr
);
Every segment register has a “visible” part and a “hidden”
part. (The hidden part is sometimes referred to as a “descriptor cache” or a
“shadow register.”) When a segment selector is loaded into the visible part of
a segment register, the processor also loads the hidden part of the segment
register with the base address, segment limit, and access control information
from the segment descriptor pointed to by the segment selector. The information
cached in the segment register (visible and hidden) allows the processor to
translate addresses without taking extra bus cycles to read the base address
and limit from the segment descriptor. In systems in which multiple processors
have access to the same descriptor tables, it is the
responsibility of software to reload the segment registers when the descriptor
tables are modified. If this is not done, an old segment descriptor cached in a
segment register might be used after its memory-resident version has been
modified.
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = mst
FILE_GUID = fb925ac7-192b-9569-8580-7c6f5f710601
MODULE_TYPE = UEFI_APPLICATION
VERSION_STRING = 1.0
ENTRY_POINT = MSMain
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF
#
[Sources]
MSTest.c
[Packages]
AppPkg/AppPkg.dec
MdePkg/MdePkg.dec
[LibraryClasses]
UefiApplicationEntryPoint
UefiLib
BaseLib
错误提示为:
c:\buildbs\201903\AppPkg\Applications\MSTest\MSTest.c(20): error C2143: syntax error: missing '{' before '*'
c:\buildbs\201903\AppPkg\Applications\MSTest\MSTest.c(20): warning C4218: nonstandard extension used: must specify at least a storage class or a type
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\x86_amd64\cl.exe"' : return code '0x2'
Stop.
EFI_STATUS
GopPrivateReadKeyStrokeWorker (
IN GOP_PRIVATE_DATA *Private,
OUT EFI_KEY_DATA *KeyData
)
/*++
Routine Description:
Reads the next keystroke from the input device. The WaitForKey Event can
be used to test for existance of a keystroke via WaitForEvent () call.
Arguments:
Private - The private structure of WinNt Gop device.
KeyData - A pointer to a buffer that is filled in with the keystroke
state data for the key that was pressed.
Returns:
EFI_SUCCESS - The keystroke information was returned.
EFI_NOT_READY - There was no keystroke data availiable.
EFI_DEVICE_ERROR - The keystroke information was not returned due to
hardware errors.
EFI_INVALID_PARAMETER - KeyData is NULL.
--*/
{
EFI_STATUS Status;
EFI_TPL OldTpl;
if (KeyData == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// Enter critical section
//
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
//
// Call hot key callback before telling caller there is a key available
//
WinNtGopSimpleTextInTimerHandler (NULL, Private);
ZeroMem (&KeyData->Key, sizeof (KeyData->Key));
InitializeKeyState (Private, &KeyData->KeyState);
Status = GopPrivateCheckQ (&Private->QueueForRead);
if (!EFI_ERROR (Status)) {
//
// If a Key press exists try and read it.
//
Status = GopPrivateDeleteQ (Private, &Private->QueueForRead, KeyData);
if (!EFI_ERROR (Status)) {
//
// If partial keystroke is not enabled, check whether it is value key. If not return
// EFI_NOT_READY.
//
if (!Private->IsPartialKeySupport) {
if (KeyData->Key.ScanCode == SCAN_NULL && KeyData->Key.UnicodeChar == CHAR_NULL) {
Status = EFI_NOT_READY;
}
}
}
}
//
// Leave critical section and return
//
gBS->RestoreTPL (OldTpl);
return Status;
}
case WM_CHAR:
//
// The ESC key also generate WM_CHAR.
//
if (wParam == 0x1B) {
return 0;
}
if (AltIsPress == TRUE) {
//
// If AltIsPress is true that means the Alt key is pressed.
//
Private->LeftAlt = TRUE;
}
for (Index = 0; Index < (lParam & 0xffff); Index++) {
if (wParam != 0) {
Key.UnicodeChar = (CHAR16) wParam;
Key.ScanCode = SCAN_NULL;
GopPrivateAddKey (Private, Key);
}
}
if (AltIsPress == TRUE) {
//
// When Alt is released there is no windoes message, so
// clean it after using it.
//
Private->LeftAlt = FALSE;
Private->RightAlt = FALSE;
}
DEBUG ((EFI_D_INFO, "Key [%X] [%X]\n",Key.ScanCode,Key.UnicodeChar)); //LABZ_DEBUG
return 0;