Skip to content

Instantly share code, notes, and snippets.

@Mic92
Last active June 26, 2019 16:27
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 Mic92/93a57e2c59f3b52a092e820651741f5d to your computer and use it in GitHub Desktop.
Save Mic92/93a57e2c59f3b52a092e820651741f5d to your computer and use it in GitHub Desktop.
Don't ask, why one need this... :(
static long syscall3(long n, long a1, long a2, long a3) {
unsigned long ret;
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
"d"(a3) : "rcx", "r11", "memory");
return ret;
}
static void desperate_print(const char* format, ...) {
char buf[1024]; // enough !1!
va_list args;
va_start (args, format);
vsnprintf(buf, sizeof(buf), format, args);
va_end (args);
syscall3(1, 1, buf, strlen(buf));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment