> 
> 
> diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c 
> b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
> index 5c88419..2d75d67 100644
> --- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
> +++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
> @@ -20,6 +20,11 @@
> 
> #include "VirtioMmioDevice.h"
> 
> +//
> +// Notifications
> +//
> +EFI_EVENT EfiExitBootServicesEvent      = (EFI_EVENT)NULL;
> +
> static VIRTIO_DEVICE_PROTOCOL mMmioDeviceProtocolTemplate = {
>     0,                                     // SubSystemDeviceId
>     VirtioMmioGetDeviceFeatures,           // GetDeviceFeatures
> @@ -120,6 +125,22 @@ VirtioMmioUninit (
>   // the old comms area.
>   //
>   VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_STATUS, 0);
> +  VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_PAGE_OFF, 0);
> +}
> +
> +/***************************************
> + * This function should be called
> + * on Event: ExitBootServices
> + * to free up memory, stop the driver
> + * and uninstall the protocols
> + ***************************************/
> +VOID
EFIAPI
> +VirtioMmioExitBootServicesEvent (
> +  IN EFI_EVENT  Event,
> +  IN VOID       *Context
> +  )
> +{
> +  VirtioMmioUninit (Context);
> }
> 

Module entry points (not edk2 entry points in your C code since the real entry 
point is in a lib), events, and protocol member functions need to be decorated 
with EFIAPI to indicate required calling conventions. 

Mostly a pedantic requirement, but some versions of GCC do use it to force the 
EFI ABI for X64 (x86_64) calling. 


https://svn.code.sf.net/p/edk2/code/trunk/edk2/BaseTools/Conf/tools_def.template
DEFINE GCC44_X64_CC_FLAGS            = DEF(GCC44_ALL_CC_FLAGS) -m64 
"-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS -mno-red-zone 
-Wno-address -mcmodel=large

So in your example, *Context is passed in RDX, but could be referenced by RSI 
by some compilers. 

If the compilers default ABI is compatible with EFIABI the fact that the event 
is passed into a C API is enough to ensure the calling conventions are correct. 

Thanks,

Andrew Fish



------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to