summaryrefslogtreecommitdiff
path: root/euler/source/syscall.asm
blob: d4515bb65fdee6f47605d7aa96c0561638bd307a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
bits 64

section .text

global __euler_do_syscall
__euler_do_syscall:

  push rdi
  push rsi
  push rdx
  push rcx

  mov rax, qword [rdi]
  mov rdi, qword [rsi]
  mov rsi, qword [rdx]
  mov rdx, qword [rcx]

  syscall

  pop rcx
  mov qword [rcx], rdx

  pop rdx
  mov qword [rdx], rsi

  pop rsi
  mov qword [rsi], rdi

  pop rdi
  mov qword [rdi], rax

  ret