Dear developers,

While performing some research tasks, I noticed that when 
UefiDriverEntryPoint's _gDriverUnloadImageCount is 0 (only MODULE_UNLOAD 
entries are count, DESTRUCTOR as they are used with libraries are not, as far 
as I can see), EFI_LOADED_IMAGE_PROTOCOL.Unload is not set, even if libraries 
with destructors are included by the built module.
Is this intentional, so, is a module without a MODULE_UNLOAD property in its 
build file considered a module that does not support being unloaded? If so, why 
is EFI_LOADED_IMAGE_PROTOCOL.Unload not set to a dummy that returns an EFI 
error code?

For example, DxeDebugPrintErrorLevelLib installs a protocol interface in its 
CONSTRUCTOR function. When this library is included in a module without a 
MODULE_UNLOAD property and that module is unloaded, the 
DxeDebugPrintErrorLevelLib DESTRUCTOR function, which uninstalls the interface, 
is never called and hence the interface remains in the protocol database, 
despite it pointing to a memory location that is now free. If it is called, the 
behavior is obviously undefined.

Did I understand something incorrectly, are these modules not supposed to be 
unloadable or is this a bug?

Thank you,
Marvin.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to