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

--- Comment #20 from Neal Frager <neal.frager at amd dot com> ---
(In reply to Gopi Kumar Bulusu from comment #19)
> This does not look like a compiler defect.
> 
> This becomes clear when look at the way stack is setup and used in the
> interrupt handler defined in entry.S
> 
> C_ENTRY(_interrupt):
> 
> Here stack space is allocated for pt_regs structure
> 
>  addik   r1, r1, -PT_SIZE;
>         SAVE_REGS
> 
> However SAVE_REGS does not actually use the top 8 bytes of the stack;
> 
> But then this instruction can be seen to access r1(4)
> 
>  swi     r11, r1, PT_R1;
> 
> After an rtbd to do_IRQ()
> 
> do_IRQ() can be seen to access (what it sees as callers frame) where it
> expects space to be allocated for inbound arguments 
> 
> +   c:  f8a10024        swi     r5, r1, 36
> 
> The value of r5 will be overwriting value of r11 stored in pt_regs
> 
> It would be a simple fix in the arch/microblaze/kernel/entry.S
> 
> This PR may be marked as INVALID

Thank you for this analysis!

Could you create a simple patch fix to the arch/microblaze/kernel/entry.S file,
so we can apply it to the Linux kernel and verify this?

Assuming you are correct, could you also upstream your patch to the Linux
kernel?

Best regards,
Neal Frager
AMD

Reply via email to