]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
plat/common/arm: Zero out `x29` and `x30` before stack switch
authorEduard Vintilă <eduard.vintila47@gmail.com>
Sun, 12 Nov 2023 13:54:34 +0000 (15:54 +0200)
committerEduard Vintilă <eduard.vintila47@gmail.com>
Sun, 12 Nov 2023 13:54:34 +0000 (15:54 +0200)
In order to properly mark the end of a stacktrace and avoid
undefined behaviour during unwinding, both the frame pointer
(`x29`) and the link register (`x30`) should be
zeroed out before switching to a new stack.

Signed-off-by: Eduard Vintilă <eduard.vintila47@gmail.com>
plat/common/arm/lcpu.c

index 2d4021bd1a10967e494b117179d2b9b33ee8192c..d0172494ed116821b29bbc427ad158221c0bc6a2 100644 (file)
@@ -55,6 +55,8 @@ __lcpuid lcpu_arch_id(void)
 void __noreturn lcpu_arch_jump_to(void *sp, ukplat_lcpu_entry_t entry)
 {
        __asm__ __volatile__ (
+               "mov    x29, xzr\n"
+               "mov    x30, xzr\n"
                "mov    sp, %0\n" /* set the sp  */
                "br     %1\n"     /* branch to the entry function */
                :