]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[efi] Avoid setting direction flag on EFI platforms
authorMichael Brown <mcb30@ipxe.org>
Tue, 7 Jul 2020 12:49:17 +0000 (13:49 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 7 Jul 2020 13:08:05 +0000 (14:08 +0100)
commit98d49e460a27f74212aab2d6b5eef1143c7a8e37
treec9cb594bafd7066935e8965bda84c659e2e12c20
parent2f032c84a2cbed37308da8b29e84efb6eb2fe9e5
[efi] Avoid setting direction flag on EFI platforms

The only remaining use case in iPXE for the CPU direction flag is in
__memcpy_reverse() where it is set to allow the use of "rep movsb" to
perform the memory copy.  This matches the equivalent functionality in
the EDK2 codebase, which has functions such as InternalMemCopyMem that
also temporarily set the direction flag in order to use "rep movsb".

As noted in commit d2fb317 ("[crypto] Avoid temporarily setting
direction flag in bigint_is_geq()"), some UEFI implementations are
known to have buggy interrupt handlers that may reboot the machine if
a timer interrupt happens to occur while the direction flag is set.

Work around these buggy UEFI implementations by using the
(unoptimised) generic_memcpy_reverse() on i386 or x86_64 UEFI
platforms.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/x86/core/x86_string.c
src/config/defaults/efi.h