Browse Source

* Set errno using a call to seterrno, like it is done for i386 target. This removes most of assembler code together with PIC hacks and makes this part independent of threadvar implementation details.

git-svn-id: trunk@22042 -
sergei 13 years ago
parent
commit
12dc48afbf
1 changed files with 14 additions and 168 deletions
  1. 14 168
      rtl/linux/x86_64/syscall.inc

+ 14 - 168
rtl/linux/x86_64/syscall.inc

@@ -34,30 +34,8 @@ asm
   cmpq $-4095, %rax       { Check %rax for error.  }
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
-  movq  %rax,%rdx
-{$ifdef FPC_PIC}
-  movq  fpc_threadvar_relocate_proc@GOTPCREL(%rip),%rax
-  movq  (%rax),%rax
-{$ifndef FPC_STATICRIPFIXED}
-  movq  Errno@GOTPCREL(%rip),%r11
-{$else}
-  leaq  Errno(%rip),%r11
-{$endif}
-{$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  %rax,%rdi
+  call  seterrno
   movq  $-1,%rax
 .LSyscOK:
 end;
@@ -78,30 +56,8 @@ asm
   cmpq $-4095, %rax       { Check %rax for error.  }
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
-  movq  %rax,%rdx
-{$ifdef FPC_PIC}
-  movq  fpc_threadvar_relocate_proc@GOTPCREL(%rip),%rax
-  movq  (%rax),%rax
-{$ifndef FPC_STATICRIPFIXED}
-  movq  Errno@GOTPCREL(%rip),%r11
-{$else}
-  leaq  Errno(%rip),%r11
-{$endif}
-{$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  %rax,%rdi
+  call  seterrno
   movq  $-1,%rax
 .LSyscOK:
 end;
@@ -125,30 +81,8 @@ asm
   cmpq $-4095, %rax       { Check %rax for error.  }
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
-  movq  %rax,%rdx
-{$ifdef FPC_PIC}
-  movq  fpc_threadvar_relocate_proc@GOTPCREL(%rip),%rax
-  movq  (%rax),%rax
-{$ifndef FPC_STATICRIPFIXED}
-  movq  Errno@GOTPCREL(%rip),%r11
-{$else}
-  leaq  Errno(%rip),%r11
-{$endif}
-{$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  %rax,%rdi
+  call  seterrno
   movq  $-1,%rax
 .LSyscOK:
 end;
@@ -175,30 +109,8 @@ asm
   cmpq $-4095, %rax       { Check %rax for error.  }
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
-  movq  %rax,%rdx
-{$ifdef FPC_PIC}
-  movq  fpc_threadvar_relocate_proc@GOTPCREL(%rip),%rax
-  movq  (%rax),%rax
-{$ifndef FPC_STATICRIPFIXED}
-  movq  Errno@GOTPCREL(%rip),%r11
-{$else}
-  leaq  Errno(%rip),%r11
-{$endif}
-{$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  %rax,%rdi
+  call  seterrno
   movq  $-1,%rax
 .LSyscOK:
 end;
@@ -228,30 +140,8 @@ asm
   cmpq $-4095, %rax       { Check %rax for error.  }
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
-  movq  %rax,%rdx
-{$ifdef FPC_PIC}
-  movq  fpc_threadvar_relocate_proc@GOTPCREL(%rip),%rax
-  movq  (%rax),%rax
-{$ifndef FPC_STATICRIPFIXED}
-  movq  Errno@GOTPCREL(%rip),%r11
-{$else}
-  leaq  Errno(%rip),%r11
-{$endif}
-{$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  %rax,%rdi
+  call  seterrno
   movq  $-1,%rax
 .LSyscOK:
 end;
@@ -284,30 +174,8 @@ asm
   cmpq $-4095, %rax       { Check %rax for error.  }
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
-  movq  %rax,%rdx
-{$ifdef FPC_PIC}
-  movq  fpc_threadvar_relocate_proc@GOTPCREL(%rip),%rax
-  movq  (%rax),%rax
-{$ifndef FPC_STATICRIPFIXED}
-  movq  Errno@GOTPCREL(%rip),%r11
-{$else}
-  leaq  Errno(%rip),%r11
-{$endif}
-{$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  %rax,%rdi
+  call  seterrno
   movq  $-1,%rax
 .LSyscOK:
 end;
@@ -344,30 +212,8 @@ asm
   cmpq $-4095, %rax       { Check %rax for error.  }
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
-  movq  %rax,%rdx
-{$ifdef FPC_PIC}
-  movq  fpc_threadvar_relocate_proc@GOTPCREL(%rip),%rax
-  movq  (%rax),%rax
-{$ifndef FPC_STATICRIPFIXED}
-  movq  Errno@GOTPCREL(%rip),%r11
-{$else}
-  leaq  Errno(%rip),%r11
-{$endif}
-{$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  %rax,%rdi
+  call  seterrno
   movq  $-1,%rax
 .LSyscOK:
 end;