This is an archive of the discontinued LLVM Phabricator instance.

[AVR] fix interrupt stack pointer restoration
ClosedPublic

Authored by couchand on Sep 15 2020, 6:54 PM.

Details

Summary

This patch fixes a corruption of the stack pointer and several registers in any AVR interrupt with non-empty stack frame. Previously, the callee-saved registers were popped before restoring the stack pointer, causing the pointer math to use the wrong base value while also corrupting the caller's register. This change fixes the code to restore the stack pointer last before exiting the interrupt service routine.

https://bugs.llvm.org/show_bug.cgi?id=47253

Diff Detail

Event Timeline

couchand created this revision.Sep 15 2020, 6:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2020, 6:54 PM
couchand requested review of this revision.Sep 15 2020, 6:54 PM
couchand updated this revision to Diff 292935.Sep 18 2020, 7:38 PM

Fixes formatting.

dylanmckay accepted this revision.Sep 30 2020, 5:17 AM

This is a great patch, thanks @couchand!

LGTM - do you need someone to commit this for you?

This revision is now accepted and ready to land.Sep 30 2020, 5:17 AM

Thanks for the code review @dylanmckay!

Yes, please commit it for me, thanks.

This revision was automatically updated to reflect the committed changes.