Skip to content

Instantly share code, notes, and snippets.

@zmanji
Created September 13, 2012 19:03
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 zmanji/3716779 to your computer and use it in GitHub Desktop.
Save zmanji/3716779 to your computer and use it in GitHub Desktop.
Printing the SP on x86_64
/* 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