freebsd-dev/sys/boot/efi
Dexuan Cui 985455c0cc loader.efi: reduce the size of the staging area if necessary
The loader assumes physical memory in [2MB, 2MB + EFI_STAGING_SIZE)
is Conventional Memory, but actually it may not, e.g. in the case
of Hyper-V Generation-2 VM (i.e. UEFI VM) running on Windows
Server 2012 R2 host, there is a BootServiceData memory block at
the address 47.449MB and the memory is not writable.

Without the patch, the loader will crash in efi_copy_finish():
see PR 211746.

The patch verifies the end of the staging area, and reduces its
size if necessary. This way, the loader will not try to write into
the BootServiceData memory any longer.

Thank Marcel Moolenaar for helping me on this issue!

The patch also allocates the staging area in the first 1GB memory.
See the comment in the patch for this.

PR:		211746
Reviewed by:	marcel, kib, sephe
Approved by:	sephe (mentor)
MFC after:	2 weeks
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D9686
2017-03-02 07:25:50 +00:00
..
boot1 Use proper prototypes in struct boot_module_t 2017-01-11 20:00:24 +00:00
fdt Add more .NOMETA missed in r291320 2016-03-11 23:45:51 +00:00
include loader: Replace EFI part devices. 2017-02-06 09:18:47 +00:00
libefi sys: Replace zero with NULL for pointers. 2017-02-22 02:35:59 +00:00
loader loader.efi: reduce the size of the staging area if necessary 2017-03-02 07:25:50 +00:00
Makefile Fix typo in the COMPILER_VERSION check 2016-10-22 20:00:39 +00:00
Makefile.inc [efi] Build EFI bits with -fPIC on ARM 2017-01-10 20:15:24 +00:00