https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95571

            Bug ID: 95571
           Summary: xtensa stack unwinding doesn't work well with
                    asynchronous register spilling
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jcmvbkbc at gcc dot gnu.org
  Target Milestone: ---

Xtensa architecture with variable register windows store registers of the
spilled register windows in two separate locations: registers a0-a3 of the
current function caller are stored right below the stack pointer of current
function in the location known as a base save area, and the registers a4-a7 (or
a4-a11) are stored in the top of the caller's stack frame in a location known
as an extra save area, right under the base save area of is own caller. To
spill or restore registers a4-a7/a11 of the function its caller stack pointer
is used to find its extra save area.

Interrupt handlers on bare metal xtensa targets spill registers of all active
register windows in the interrupted code except the current topmost window.

Stack unwinding code for xtensa copies base save area of the context being
installed into the base save area under the _Unwind_RaiseException stack
pointer so that return from _Unwind_RaiseException reload registers of that
context. However when it happens in a function called from
_Unwind_RaiseException an interrupt can spill registers of the
_Unwind_RaiseException to its extra save area. The location of this area is
lost once base save area under the _Unwind_RaiseException stack pointer is
overwritten resulting in bogus values being reloaded into registers a4-a7
usually resulting in a crash.

Reply via email to