Skip to content

Instantly share code, notes, and snippets.

@hasherezade
Created October 11, 2017 18:25
Show Gist options
  • Select an option

  • Save hasherezade/3d8466833219aabfdc945110eb995abf to your computer and use it in GitHub Desktop.

Select an option

Save hasherezade/3d8466833219aabfdc945110eb995abf to your computer and use it in GitHub Desktop.
#include <stdio.h>
void set_regs()
{
void* address = (void*) 0x00000000;
char *val = (char*) "mmmmmm";
__asm__ volatile (
"mov %1, %%rdi \n"
"mov %0, %%rsp \n"
: /* no output operand*/
:"r"(address), "r"(val) /* inputs operands */
:"%rdi", "rsp"); /* clobbered registers */
}
int main()
{
set_regs();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment