From e8222123e648b41c4d25ea3a98c63242fc0648f1 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 22 Apr 2018 08:07:20 +0200 Subject: Use syscall instead of mmap and munmap --- arch/x64/linux/syscall.S | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) (limited to 'arch/x64') diff --git a/arch/x64/linux/syscall.S b/arch/x64/linux/syscall.S index 9261d87..7c00036 100644 --- a/arch/x64/linux/syscall.S +++ b/arch/x64/linux/syscall.S @@ -22,44 +22,31 @@ syscall1: ret - .globl syscall2 - .type syscall2, @function +// 2 parameters. + .globl _D5tanya3sys5linux7syscall7syscallFNbNilllZl + .type _D5tanya3sys5linux7syscall7syscallFNbNilllZl, @function -syscall2: - // Store registers. - movq %rdi, %r8 - - movq %rdx, %rax // Syscall number. - - // Syscall arguments. - movq %rsi, %rdi - movq %r8, %rsi +_D5tanya3sys5linux7syscall7syscallFNbNilllZl: + movq %rdx, %rax syscall - // Restore registers. - movq %rdi, %rsi - movq %r8, %rdi - ret - .globl syscall3 - .type syscall3, @function +// 6 parameters. + .globl _D5tanya3sys5linux7syscall7syscallFNbNilllllllZl + .type _D5tanya3sys5linux7syscall7syscallFNbNilllllllZl, @function -syscall3: - // Store registers. - movq %rdi, %r8 +_D5tanya3sys5linux7syscall7syscallFNbNilllllllZl: + pushq %rbp + movq %rsp, %rbp - movq %rcx, %rax // Syscall number. + movq 16(%rbp), %rax - // Syscall arguments. - movq %rdx, %rdi - movq %r8, %rdx + mov %rcx, %r10 syscall - // Restore registers. - movq %r8, %rdi - + leave ret -- cgit v1.2.3