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

            Bug ID: 89935
           Summary: [Arm] Return from interrupt on Cortex-R52 must use
                    eret instruction
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alfedotov at gmail dot com
  Target Milestone: ---

Compiling following code for Arm Cortex-r52:

extern int another_func(int);
void __attribute__ ((interrupt ("IRQ"))) IRQ_Handler(void)
{
  another_func(0);
}

gcc generates epilogue respectively:
  ldmfd    sp!, {r0, r1, r2, r3, r4, fp, ip, pc}^

The problem is that on Cortex-R52 virtualization is used so that when IRQ
interrupt happens in Hypervisor mode (EL2) return from interrupt must use ERET
instruction. Otherwise Undefined exception occurs (what actually corresponds to
chapter F5.1.65 LDM (exception return) in
https://static.docs.arm.com/ddi0487/da/DDI0487D_a_armv8_arm.pdf?_ga=2.927729.1146405679.1554127327-529207546.1554127327)

Probably we should introduce new ISR attribute like IRQ_el2 or IRQ_hyp.

Reply via email to