diff options
author | comex | 2015-01-25 21:09:10 -0500 |
---|---|---|
committer | comex | 2015-01-25 21:09:10 -0500 |
commit | ef5abd92fdcf9337e512de1ec541ca310eaaea06 (patch) | |
tree | 1098763344f370f6057e21c3fbf56e230058cae5 /lib/darwin/manual-syscall.h | |
parent | make a basic .deb generator (diff) | |
download | substitute-ef5abd92fdcf9337e512de1ec541ca310eaaea06.tar.gz |
this is dumb
Diffstat (limited to 'lib/darwin/manual-syscall.h')
-rw-r--r-- | lib/darwin/manual-syscall.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/darwin/manual-syscall.h b/lib/darwin/manual-syscall.h index 4d847ac..9f04d2b 100644 --- a/lib/darwin/manual-syscall.h +++ b/lib/darwin/manual-syscall.h @@ -5,48 +5,48 @@ __attribute__((always_inline)) #if defined(__x86_64__) -static int manual_syscall(long s, long a, long b, long c, long d, long e) { +static int manual_syscall(long s, long a, long b, long c, long d) { if (s < 0) s = -s | 1 << 24; else s |= 2 << 24; REG(s, rax); REG(a, rdi); REG(b, rsi); REG(c, rdx); REG(d, rcx); OREG(out, rax); - __asm__ volatile("push %1; syscall; pop %1" + __asm__ volatile("syscall" : "=r"(out) - : "r"(e), "r"(_s), "r"(_a), "r"(_b), "r"(_c), "r"(_d)); + : "r"(_s), "r"(_a), "r"(_b), "r"(_c), "r"(_d)); return out; } #elif defined(__i386__) -static int manual_syscall(long s, long a, long b, long c, long d, long e) { +static int manual_syscall(long s, long a, long b, long c, long d) { REG(s, eax); OREG(out, eax); - __asm__ volatile("push %6; push %5; push %4; push %3; push %2; push $0;" + __asm__ volatile("push %5; push %4; push %3; push %2; push $0;" "mov %%esp, %%ecx;" "call 1f; 1: pop %%edx; add $(2f-1b), %%edx;" "sysenter;" - "2: add $(6 * 4), %%esp" + "2: add $(5 * 4), %%esp" : "=r"(out) - : "r"(_s), "g"(a), "g"(b), "g"(c), "g"(d), "g"(e) + : "r"(_s), "g"(a), "g"(b), "g"(c), "g"(d) : "edx", "ecx"); return out; } #elif defined(__arm__) -static int manual_syscall(long s, long a, long b, long c, long d, long e) { +static int manual_syscall(long s, long a, long b, long c, long d) { REG(s, r12); REG(a, r0); REG(b, r1); REG(c, r2); REG(d, r3); OREG(out, r0); - __asm__ volatile("push {%1}; svc #0x80; pop {%1}" + __asm__ volatile("svc #0x80" : "=r"(out) - : "r"(e), "r"(_s), "r"(_a), "r"(_b), "r"(_c), "r"(_d)); + : "r"(_s), "r"(_a), "r"(_b), "r"(_c), "r"(_d)); return out; } #elif defined(__arm64__) -static int manual_syscall(long s, long a, long b, long c, long d, long e) { +static int manual_syscall(long s, long a, long b, long c, long d) { REG(s, x16); REG(a, x0); REG(b, x1); REG(c, x2); REG(d, x3); OREG(out, x0); - __asm__ volatile("str %1, [sp, #-0x10]!\n svc #0x80\n ldr %1, [sp], #0x10" + __asm__ volatile("svc #0x80" : "=r"(out) - : "r"(e), "r"(_s), "r"(_a), "r"(_b), "r"(_c), "r"(_d)); + : "r"(_s), "r"(_a), "r"(_b), "r"(_c), "r"(_d)); return out; } #else |