forked from ichitaso/vnodebypass
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSVC_Caller.h
More file actions
22 lines (20 loc) · 704 Bytes
/
SVC_Caller.h
File metadata and controls
22 lines (20 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdint.h>
inline int SVC_Access(const char* detectionPath) {
#if defined __arm64__ || defined __arm64e__
int64_t flag = 0;
__asm __volatile("mov x0, %0" :: "r" (detectionPath)); //path
__asm __volatile("mov x1, #0"); //mode
__asm __volatile("mov x16, #0x21"); //access
__asm __volatile("svc #0x80"); //supervisor call
__asm __volatile("mov %0, x0" : "=r" (flag));
#else
int flag = 0;
__asm __volatile("mov r0, %0" :: "r" (detectionPath)); //path
__asm __volatile("mov r1, #0"); //mode
__asm __volatile("mov r12, #0x21"); //access
__asm __volatile("svc #0x80"); //supervisor call
__asm __volatile("mov %0, r0" : "=r" (flag));
#endif
return flag;
}