tanya/arch/x64/linux/syscall.S

53 lines
818 B
ArmAsm
Raw Normal View History

2017-09-08 19:52:17 +02:00
/*
The kernel uses the following registers:
%rdi, %rsi, %rdx, %r8, %r9, %r10
The number of the syscall is passed in %rax.
A syscall clobbers:
%rax, %rcx, %r11
The returned value is placed in %rax.
*/
.text
.globl syscall1
.type syscall1, @function
syscall1:
movq %rsi, %rax // Syscall number.
syscall
ret
2018-04-22 08:07:20 +02:00
// 2 parameters.
.globl _D5tanya3sys5linux7syscall7syscallFNbNilllZl
.type _D5tanya3sys5linux7syscall7syscallFNbNilllZl, @function
2017-09-08 19:52:17 +02:00
2018-04-22 08:07:20 +02:00
_D5tanya3sys5linux7syscall7syscallFNbNilllZl:
movq %rdx, %rax
2017-09-08 19:52:17 +02:00
syscall
ret
2018-04-22 08:07:20 +02:00
// 6 parameters.
.globl _D5tanya3sys5linux7syscall7syscallFNbNilllllllZl
.type _D5tanya3sys5linux7syscall7syscallFNbNilllllllZl, @function
2017-09-08 19:52:17 +02:00
2018-04-22 08:07:20 +02:00
_D5tanya3sys5linux7syscall7syscallFNbNilllllllZl:
pushq %rbp
movq %rsp, %rbp
2017-09-08 19:52:17 +02:00
2018-04-22 08:07:20 +02:00
movq 16(%rbp), %rax
2017-09-08 19:52:17 +02:00
2018-04-22 08:07:20 +02:00
mov %rcx, %r10
2017-09-08 19:52:17 +02:00
syscall
2018-04-22 08:07:20 +02:00
leave
2017-09-08 19:52:17 +02:00
ret