]> git.ipfire.org Git - thirdparty/grub.git/commit
kern/misc: Implement faster grub_memcpy() for aligned buffers
authorGary Lin <glin@suse.com>
Wed, 15 Oct 2025 03:00:28 +0000 (11:00 +0800)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 23 Oct 2025 17:12:22 +0000 (19:12 +0200)
commit28dbe8a3b6b3c29e5b61c55c5525d0faec8d93cc
tree15d6e89c7e9c96db01adce654a6848a0e33935ad
parentda01eb0c55a06fd89516d159e8310d80fcc610b9
kern/misc: Implement faster grub_memcpy() for aligned buffers

When both "dest" and "src" are aligned, copying the data in grub_addr_t
sized chunks is more efficient than a byte-by-byte copy.

Also tweak __aeabi_memcpy(), __aeabi_memcpy4(), and __aeabi_memcpy8(),
since grub_memcpy() is not inline anymore.

Optimization for unaligned buffers was omitted to maintain code
simplicity and readability. The current chunk-copy optimization
for aligned buffers already provides a noticeable performance
improvement (*) for Argon2 keyslot decryption.

  (*) On my system, for a LUKS2 keyslot configured with a 1 GB Argon2
      memory requirement, this patch reduces the decryption time from
      22 seconds to 12 seconds.

Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/boot/decompressor/minilib.c
grub-core/kern/compiler-rt.c
grub-core/kern/misc.c
include/grub/misc.h