From: qhuang8 Date: Thu, 14 Feb 2008 02:47:49 +0000 (+0000) Subject: Fix a conformance issue in gBS->CreateEvent() & gBS->CreateEventEx(): X-Git-Tag: edk2-stable201903~21503 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=bb8ffffd1c0ff0ee697c26d377fd9767097cc02b Fix a conformance issue in gBS->CreateEvent() & gBS->CreateEventEx(): 1. gBS->CreateEventEx() with EventGroup = NULL should behavior like gBS->CreateEvent() 2. EVT_SIGNAL_EXIT_BOOT_SERVICES & EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE are invalid parameters for gBS->CreateEventEx() if the EventGroup is not NULL. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4692 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Core/Dxe/Event/event.c b/MdeModulePkg/Core/Dxe/Event/event.c index c4d6eeb553..81f0b1af10 100644 --- a/MdeModulePkg/Core/Dxe/Event/event.c +++ b/MdeModulePkg/Core/Dxe/Event/event.c @@ -323,22 +323,7 @@ Returns: --*/ { - EFI_GUID *GuidPtr; - EFI_EVENT_NOTIFY Function; - - GuidPtr = NULL; - Function = NotifyFunction; - - // - // Convert EFI 1.10 Events to their UEFI 2.0 CreateEventEx mapping - // - if (Type == EVT_SIGNAL_EXIT_BOOT_SERVICES) { - GuidPtr = &gEfiEventExitBootServicesGuid; - } else if (Type == EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) { - GuidPtr = &gEfiEventVirtualAddressChangeGuid; - } - - return CoreCreateEventEx (Type, NotifyTpl, Function, NotifyContext, GuidPtr, Event); + return CoreCreateEventEx (Type, NotifyTpl, NotifyFunction, NotifyContext, NULL, Event); } @@ -363,7 +348,7 @@ Arguments: NotifyFunction - Pointer to the events notification function NotifyContext - Pointer to the notification functions context; corresponds to parameter "Context" in the notification function - EventGrout - GUID for EventGroup if NULL act the same as gBS->CreateEvent(). + EventGroup - GUID for EventGroup if NULL act the same as gBS->CreateEvent(). Event - Pointer to the newly created event if the call succeeds; undefined otherwise Returns: @@ -396,6 +381,33 @@ Returns: return EFI_INVALID_PARAMETER; } + // + // Convert Event type for pre-defined Event groups + // + if (EventGroup != NULL) { + // + // For event group, type EVT_SIGNAL_EXIT_BOOT_SERVICES and EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE + // are not valid + // + if ((Type == EVT_SIGNAL_EXIT_BOOT_SERVICES) || (Type == EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE)) { + return EFI_INVALID_PARAMETER; + } + if (CompareGuid (EventGroup, &gEfiEventExitBootServicesGuid)) { + Type = EVT_SIGNAL_EXIT_BOOT_SERVICES; + } else if (CompareGuid (EventGroup, &gEfiEventVirtualAddressChangeGuid)) { + Type = EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE; + } + } else { + // + // Convert EFI 1.10 Events to their UEFI 2.0 CreateEventEx mapping + // + if (Type == EVT_SIGNAL_EXIT_BOOT_SERVICES) { + EventGroup = &gEfiEventExitBootServicesGuid; + } else if (Type == EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) { + EventGroup = &gEfiEventVirtualAddressChangeGuid; + } + } + // // If it's a notify type of event, check its parameters //