summaryrefslogtreecommitdiff
path: root/lang/fpc/files/patch-rtl-bsd-x86_64_syscall.inc
blob: e024f7e4459499ee2aa73c59245a4c0bc4dbfbc9 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
--- rtl/bsd/x86_64/syscall.inc	2008-09-13 19:17:13.000000000 +0100
+++ rtl/bsd/x86_64/syscall.inc	2010-08-12 11:35:15.000000000 +0100
@@ -219,7 +219,6 @@
 .LSyscOK:
 end;
 
-
 function fpsysCall(sysnr,param1,param2,param3,param4,param5,param6 : TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS6'];
 
 asm
@@ -232,7 +231,6 @@
   movq param6,%r9
   syscall                 { Do the system call. }
   jnb .LSyscOK            { branch to exit if ok, errorhandler otherwise}
-
   movq  %rax,%rdx
 {$ifdef FPC_PIC}
   movq  fpc_threadvar_relocate_proc@GOTPCREL(%rip),%rax
@@ -257,50 +255,11 @@
 .LSyscOK:
 
 end;
-//                    edi   esi   edx 	 ecx    r8      r9   stack
-function fp_sysCall(sysnr,param1,param2,param3,param4,param5,param6 : TSysParam):TSysResult; assembler;[public,alias:'FPC__DOSYS'];
 
-asm
-  movq sysnr,%rax         { Syscall number -> rax.  }
-  movq param1,%rdi        { shift arg1 - arg6. }
-  movq param2,%rsi
-  movq param3,%rdx
-  movq param4,%r10
-  movq param5,%r8
-  movq param6,%r9
-  syscall                 { Do the system call. }
-  jnb .LSyscOK            { branch to exit if ok, errorhandler otherwise}
-  movq  %rax,%rdx
-{$ifdef FPC_PIC}
-  movq  fpc_threadvar_relocate_proc@GOTPCREL(%rip),%rax
-  movq  (%rax),%rax
-  movq  Errno@GOTPCREL(%rip),%r11
-{$else FPC_PIC}
-  movq  fpc_threadvar_relocate_proc,%rax
-  leaq  Errno,%r11
-{$endif FPC_PIC}
-  testq %rax,%rax
-  jne   .LThread
-  movl  %edx,8(%r11)
-  jmp   .LNoThread
-.LThread:
-  pushq %rdx
-  movq  (%r11),%rdi
-  call  *%rax
-  popq  %rdx
-  movl  %edx,(%rax)
-.LNoThread:
-  movq  $-1,%rax
-.LSyscOK:
-  add    $0x18,%rsp
-end;
-
-
-//                    edi   esi   edx 	 ecx    r8      r9   stack  stack
-function fp_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7 : TSysParam):TSysResult; assembler;[public,alias:'FPC__DOSYS7'];
+function fp_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7 : TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS7'];
 
 asm
-  sub    $0x10,%rsp
+  subq   $0x10,%rsp
   movq   sysnr,%rax       { Syscall number -> rax.  }
   movq   param1,%rdi      { shift arg1 - arg6. }
   movq   param2,%rsi
@@ -309,7 +268,7 @@
   movq   param5,%r8
   movq   param6,%r9
   movq   param7,%r11
-  movq   %r11,(%rsp)
+  movq   %r11,8(%rsp)
   syscall                 { Do the system call. }
   jnb .LSyscOK            { branch to exit if ok, errorhandler otherwise}
   movq  %rax,%rdx
@@ -334,6 +293,6 @@
 .LNoThread:
   movq  $-1,%rax
 .LSyscOK:
-  add    $0x10,%rsp
+  addq   $0x10,%rsp
 end;