Skip to content

Commit

Permalink
xtensa: make XTHAL_GET_INTERRUPT, XTHAL_GET_CCOUNT volatile
Browse files Browse the repository at this point in the history
INTERRUPT and CCOUNT registers will change outside of program control.
Making the inline assembly used to read these registers volatile
indicates this fact to the compiler.

Fixes #2127
  • Loading branch information
igrr committed Jul 2, 2018
1 parent a8fa420 commit da179e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/esp32/include/xtensa/core-macros.h
Expand Up @@ -335,7 +335,7 @@
__asm__ __volatile__("wsr.intenable %0" :: "a"(__intenable):"memory"); \
} while(0)
# define XTHAL_GET_INTERRUPT() ({ int __interrupt; \
__asm__("rsr.interrupt %0" : "=a"(__interrupt)); \
__asm__ __volatile__("rsr.interrupt %0" : "=a"(__interrupt)); \
__interrupt; })
# define XTHAL_SET_INTSET(v) do { int __interrupt = (int)(v); \
__asm__ __volatile__("wsr.intset %0" :: "a"(__interrupt):"memory"); \
Expand All @@ -344,7 +344,7 @@
__asm__ __volatile__("wsr.intclear %0" :: "a"(__interrupt):"memory"); \
} while(0)
# define XTHAL_GET_CCOUNT() ({ int __ccount; \
__asm__("rsr.ccount %0" : "=a"(__ccount)); \
__asm__ __volatile__("rsr.ccount %0" : "=a"(__ccount)); \
__ccount; })
# define XTHAL_SET_CCOUNT(v) do { int __ccount = (int)(v); \
__asm__ __volatile__("wsr.ccount %0" :: "a"(__ccount):"memory"); \
Expand Down

0 comments on commit da179e0

Please sign in to comment.