[syslinux] [PATCH] Call ExitBootServices twice

Sylvain Gault sylvain.gault at gmail.com
Tue Aug 25 20:57:40 PDT 2015


2015-08-26 5:54 UTC+02:00, celelibi at gmail.com <celelibi at gmail.com>:
> From: Sylvain Gault <sylvain.gault at gmail.com>
>
> On some architecture, including my hardware, the function ExitBootServices
> may
> need to be called twice in order to successfully exit the boot services. As
> stated by the UEFI spec, the first call to ExitBootServices may perform a
> partial shutdown of the services. It seems that during this partial
> shutdown,
> the memory map can be modified, thus making another call to GetMemoryMap
> necessary. However GetMemoryMap needs a buffer to fill, but the memory
> allocation functions should not be used after the first call to
> ExitBootServices despite still working on my hardware. This patch solve
> this
> problem as follow:
> - Get the memory map and allocate a buffer larger than necessary
> - Call ExitBootServices
>   - If it succeed, we're done
> - Get the new memory map in the same buffer
> - Reallocate this buffer if it is too small anyway
>
> So the call to the memory allocation functions may be called after
> ExitBootServices only if the existing buffer was too small despite being
> already larger than needed on the first call to GetMemoryMap.
>
> This issue of calling ExitBootServices twice is mentioned around the web
> and
> this patch is quite close to the one implemented in Linux.
>
> Sylvain Gault (1):
>   efi: Call ExitBootServices at least twice
>
>  efi/main.c | 75
> +++++++++++++++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 64 insertions(+), 11 deletions(-)
>
> --
> 2.5.0
>
>

I included a cover letter because I had things to explain that didn't
fit into the commit message, but the patch is in the other mail
obviously.


More information about the Syslinux mailing list