Created
June 18, 2015 07:06
-
-
Save rbarzic/37c254d12f7cc4c5d997 to your computer and use it in GitHub Desktop.
getting stack pointer value from C using gcc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline uint32_t get_stack_pointer(void) { | |
uint32_t sp; | |
asm("mov %0,sp" : "=r"(sp)); | |
return sp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
32-bit CPU obviously :-)