]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[efi] Modify global system table when wrapping a loaded image
authorMichael Brown <mcb30@ipxe.org>
Sun, 21 Nov 2021 13:27:14 +0000 (13:27 +0000)
committerMichael Brown <mcb30@ipxe.org>
Sun, 21 Nov 2021 13:34:10 +0000 (13:34 +0000)
commitb6045a8cbb3843f185e8b1ab6488ee6799d0c2b7
tree956c27047574229be355748c768cb1b1d08b2dcc
parent51612b6e69e049b6f08e833581815b4d0e9ffd39
[efi] Modify global system table when wrapping a loaded image

The EFI loaded image protocol allows an image to be provided with a
custom system table, and we currently use this mechanism to wrap any
boot services calls made by the loaded image in order to provide
strace-like debugging via DEBUG=efi_wrap.

The ExitBootServices() call will modify the global system table,
leaving the loaded image using a system table that is no longer
current.  When DEBUG=efi_wrap is used, this generally results in the
machine locking up at the point that the loaded operating system calls
ExitBootServices().

Fix by modifying the global EFI system table to point to our wrapper
functions, instead of providing a custom system table via the loaded
image protocol.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/efi/efi_wrap.h
src/interface/efi/efi_wrap.c