Skip to content

Instantly share code, notes, and snippets.

@kmcallister
Created December 26, 2018 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmcallister/febdb1085c485c6a01bf431798e0ac97 to your computer and use it in GitHub Desktop.
Save kmcallister/febdb1085c485c6a01bf431798e0ac97 to your computer and use it in GitHub Desktop.
#include <util/atomic.h>
void blahblah();
void foo() {
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
blahblah();
}
}
// avr-gcc -c foo.c -std=c99 -Os && avr-objdump -dr foo.o
Disassembly of section .text:
00000000 <foo>:
0: cf 93 push r28
2: cf b7 in r28, 0x3f ; 63
4: f8 94 cli
6: 00 d0 rcall .+0 ; 0x8 <foo+0x8>
6: R_AVR_13_PCREL blahblah
8: cf bf out 0x3f, r28 ; 63
a: cf 91 pop r28
c: 08 95 ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment