Skip to content

Instantly share code, notes, and snippets.

@rickmark
Created January 16, 2019 03:16
Show Gist options
  • Save rickmark/6d11aac71c7873c1fc90915c9f5d6ced to your computer and use it in GitHub Desktop.
Save rickmark/6d11aac71c7873c1fc90915c9f5d6ced to your computer and use it in GitHub Desktop.
//
// Syscalls.c
// InvalidSyscall
//
// Created by Rick Mark on 1/15/19.
// Copyright © 2019 Dropbox. All rights reserved.
//
#include <stdio.h>
#include "Bridge.h"
int execv_custom(const char* path, const char* argv[]) {
long result = 0;
asm volatile("mov x16, #11\n"
"sub sp, sp, #16\n"
"mov x0, %[path]\n"
"str x0, [sp, #8]\n"
"mov x0, %[argv]\n"
"str x0, [sp]\n"
"svc 0x00000080\n"
"mov %[result], x0\n"
"add sp, sp, #16"
: [result] "=r" (result)
: [path] "r" (path), [argv] "r" (argv)
);
return (int)result;
}
//int lstat_custom(const char *restrict path, struct stat *restrict buf) {
// return 0;
//}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment