-
-
Save zmanji/3716779 to your computer and use it in GitHub Desktop.
Printing the SP on x86_64
This file contains hidden or 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
/* Tested on OSX with GCC 4.7 */ | |
#include <stdint.h> | |
#include <stdio.h> | |
int main() { | |
uint64_t sp = 0; | |
asm("movq %%rsp,%0" : "=r"(sp)); | |
printf("%016llX\n", sp); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment