]> git.proxmox.com Git - mirror_edk2.git/commit
OvmfPkg/Sec: fix stack switch
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 8 Jun 2022 10:09:36 +0000 (18:09 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 8 Jun 2022 11:48:07 +0000 (11:48 +0000)
commitff36b2550f94dc5fac838cf298ae5a23cfddf204
tree26b0adb6df4706c9222a58efd6c83fcded9c6da1
parenta81a650da1dc40ec2b2825d1878cdf2778b4be14
OvmfPkg/Sec: fix stack switch

The ebp/rbp register can either be used for the frame pointer or
as general purpose register.  With gcc (and clang) this depends
on the -f(no-)omit-frame-pointer switch.

This patch updates tools_def.template to explicitly set the compiler
option and also add a define to allow conditionally compile code.

The new define is used to fix stack switching in TemporaryRamMigration.
The ebp/rbp must not be touched when the compiler can use it as general
purpose register.  With version 12 gcc starts actually using the
register, so changing it leads to firmware crashes in some
configurations.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3934
Reported-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
BaseTools/Conf/tools_def.template
OvmfPkg/Sec/SecMain.c