Bläddra i källkod

* picfied code

git-svn-id: trunk@2127 -
florian 19 år sedan
förälder
incheckning
ce73006fc3
1 ändrade filer med 79 tillägg och 130 borttagningar
  1. 79 130
      rtl/linux/i386/syscall.inc

+ 79 - 130
rtl/linux/i386/syscall.inc

@@ -15,9 +15,10 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
-
 {$ASMMODE ATT}
 {$ASMMODE ATT}
 
 
+Procedure fpc_geteipasebx;[external name 'fpc_geteipasebx'];
+
 function FpSysCall(sysnr:TSysParam):TSysResult; assembler; oldfpccall;[public,alias:'FPC_SYSCALL0'];
 function FpSysCall(sysnr:TSysParam):TSysResult; assembler; oldfpccall;[public,alias:'FPC_SYSCALL0'];
 
 
 asm
 asm
@@ -27,33 +28,26 @@ asm
   cmpl  $-4095,%eax
   cmpl  $-4095,%eax
   jb   .LSyscOK
   jb   .LSyscOK
   negl  %eax
   negl  %eax
-{$ifdef REGCALL}
+{$ifdef FPC_PIC}
+  call  fpc_geteipasebx
+  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
+  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
+  movl  (%ecx),%ecx
+  movl  Errno@GOT(%ebx),%edi
+{$else FPC_PIC}
+  leal  Errno,%edi
   movl  fpc_threadvar_relocate_proc,%ecx
   movl  fpc_threadvar_relocate_proc,%ecx
+{$endif FPC_PIC}
   testl %ecx,%ecx
   testl %ecx,%ecx
   jne   .LThread
   jne   .LThread
-  movl  %eax,Errno+4
+  movl  %eax,4(%edi)
   jmp   .LNoThread
   jmp   .LNoThread
 .LThread:
 .LThread:
   movl  %eax,%ebx
   movl  %eax,%ebx
-  movl Errno,%eax
+  movl  (%edi),%eax
   call  *%ecx
   call  *%ecx
   movl  %ebx,(%eax)
   movl  %ebx,(%eax)
 .LNoThread:
 .LNoThread:
-{$else}
-  movl  %eax,%edx
-  movl  fpc_threadvar_relocate_proc,%eax
-  testl %eax,%eax
-  jne   .LThread
-  movl  %edx,Errno+4
-  jmp   .LNoThread
-.LThread:
-  pushl %edx
-  pushl Errno
-  call  *%eax
-  popl  %edx
-  movl  %edx,(%eax)
-.LNoThread:
-{$endif REGCALL}
   movl  $-1,%eax
   movl  $-1,%eax
 .LSyscOK:
 .LSyscOK:
 end;
 end;
@@ -68,33 +62,26 @@ asm
   cmpl  $-4095,%eax
   cmpl  $-4095,%eax
   jb   .LSyscOK
   jb   .LSyscOK
   negl  %eax
   negl  %eax
-{$ifdef REGCALL}
+{$ifdef FPC_PIC}
+  call  fpc_geteipasebx
+  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
+  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
+  movl  (%ecx),%ecx
+  movl  Errno@GOT(%ebx),%edi
+{$else FPC_PIC}
+  leal  Errno,%edi
   movl  fpc_threadvar_relocate_proc,%ecx
   movl  fpc_threadvar_relocate_proc,%ecx
+{$endif FPC_PIC}
   testl %ecx,%ecx
   testl %ecx,%ecx
   jne   .LThread
   jne   .LThread
-  movl  %eax,Errno+4
+  movl  %eax,4(%edi)
   jmp   .LNoThread
   jmp   .LNoThread
 .LThread:
 .LThread:
   movl  %eax,%ebx
   movl  %eax,%ebx
-  movl Errno,%eax
+  movl  (%edi),%eax
   call  *%ecx
   call  *%ecx
   movl  %ebx,(%eax)
   movl  %ebx,(%eax)
 .LNoThread:
 .LNoThread:
-{$else}
-  movl  %eax,%edx
-  movl  fpc_threadvar_relocate_proc,%eax
-  testl %eax,%eax
-  jne   .LThread
-  movl  %edx,Errno+4
-  jmp   .LNoThread
-.LThread:
-  pushl %edx
-  pushl Errno
-  call  *%eax
-  popl  %edx
-  movl  %edx,(%eax)
-.LNoThread:
-{$endif REGCALL}
   movl  $-1,%eax
   movl  $-1,%eax
 .LSyscOK:
 .LSyscOK:
 end;
 end;
@@ -110,33 +97,26 @@ asm
   cmpl  $-4095,%eax
   cmpl  $-4095,%eax
   jb   .LSyscOK
   jb   .LSyscOK
   negl  %eax
   negl  %eax
-{$ifdef REGCALL}
+{$ifdef FPC_PIC}
+  call  fpc_geteipasebx
+  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
+  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
+  movl  (%ecx),%ecx
+  movl  Errno@GOT(%ebx),%edi
+{$else FPC_PIC}
+  leal  Errno,%edi
   movl  fpc_threadvar_relocate_proc,%ecx
   movl  fpc_threadvar_relocate_proc,%ecx
+{$endif FPC_PIC}
   testl %ecx,%ecx
   testl %ecx,%ecx
   jne   .LThread
   jne   .LThread
-  movl  %eax,Errno+4
+  movl  %eax,4(%edi)
   jmp   .LNoThread
   jmp   .LNoThread
 .LThread:
 .LThread:
   movl  %eax,%ebx
   movl  %eax,%ebx
-  movl Errno,%eax
+  movl (%edi),%eax
   call  *%ecx
   call  *%ecx
   movl  %ebx,(%eax)
   movl  %ebx,(%eax)
 .LNoThread:
 .LNoThread:
-{$else}
-  movl  %eax,%edx
-  movl  fpc_threadvar_relocate_proc,%eax
-  testl %eax,%eax
-  jne   .LThread
-  movl  %edx,Errno+4
-  jmp   .LNoThread
-.LThread:
-  pushl %edx
-  pushl Errno
-  call  *%eax
-  popl  %edx
-  movl  %edx,(%eax)
-.LNoThread:
-{$endif REGCALL}
   movl  $-1,%eax
   movl  $-1,%eax
 .LSyscOK:
 .LSyscOK:
 end;
 end;
@@ -153,33 +133,26 @@ asm
   cmpl  $-4095,%eax
   cmpl  $-4095,%eax
   jb   .LSyscOK
   jb   .LSyscOK
   negl  %eax
   negl  %eax
-{$ifdef REGCALL}
+{$ifdef FPC_PIC}
+  call  fpc_geteipasebx
+  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
+  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
+  movl  (%ecx),%ecx
+  movl  Errno@GOT(%ebx),%edi
+{$else FPC_PIC}
+  leal  Errno,%edi
   movl  fpc_threadvar_relocate_proc,%ecx
   movl  fpc_threadvar_relocate_proc,%ecx
+{$endif FPC_PIC}
   testl %ecx,%ecx
   testl %ecx,%ecx
   jne   .LThread
   jne   .LThread
-  movl  %eax,Errno+4
+  movl  %eax,4(%edi)
   jmp   .LNoThread
   jmp   .LNoThread
 .LThread:
 .LThread:
   movl  %eax,%ebx
   movl  %eax,%ebx
-  movl Errno,%eax
+  movl  (%edi),%eax
   call  *%ecx
   call  *%ecx
   movl  %ebx,(%eax)
   movl  %ebx,(%eax)
 .LNoThread:
 .LNoThread:
-{$else}
-  movl  %eax,%edx
-  movl  fpc_threadvar_relocate_proc,%eax
-  testl %eax,%eax
-  jne   .LThread
-  movl  %edx,Errno+4
-  jmp   .LNoThread
-.LThread:
-  pushl %edx
-  pushl Errno
-  call  *%eax
-  popl  %edx
-  movl  %edx,(%eax)
-.LNoThread:
-{$endif REGCALL}
   movl  $-1,%eax
   movl  $-1,%eax
 .LSyscOK:
 .LSyscOK:
 end;
 end;
@@ -197,33 +170,26 @@ asm
   cmpl  $-4095,%eax
   cmpl  $-4095,%eax
   jb   .LSyscOK
   jb   .LSyscOK
   negl  %eax
   negl  %eax
-{$ifdef REGCALL}
+{$ifdef FPC_PIC}
+  call  fpc_geteipasebx
+  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
+  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
+  movl  (%ecx),%ecx
+  movl  Errno@GOT(%ebx),%edi
+{$else FPC_PIC}
+  leal  Errno,%edi
   movl  fpc_threadvar_relocate_proc,%ecx
   movl  fpc_threadvar_relocate_proc,%ecx
+{$endif FPC_PIC}
   testl %ecx,%ecx
   testl %ecx,%ecx
   jne   .LThread
   jne   .LThread
-  movl  %eax,Errno+4
+  movl  %eax,4(%edi)
   jmp   .LNoThread
   jmp   .LNoThread
 .LThread:
 .LThread:
   movl  %eax,%ebx
   movl  %eax,%ebx
-  movl Errno,%eax
+  movl  (%edi),%eax
   call  *%ecx
   call  *%ecx
   movl  %ebx,(%eax)
   movl  %ebx,(%eax)
 .LNoThread:
 .LNoThread:
-{$else}
-  movl  %eax,%edx
-  movl  fpc_threadvar_relocate_proc,%eax
-  testl %eax,%eax
-  jne   .LThread
-  movl  %edx,Errno+4
-  jmp   .LNoThread
-.LThread:
-  pushl %edx
-  pushl Errno
-  call  *%eax
-  popl  %edx
-  movl  %edx,(%eax)
-.LNoThread:
-{$endif REGCALL}
   movl  $-1,%eax
   movl  $-1,%eax
 .LSyscOK:
 .LSyscOK:
 end;
 end;
@@ -242,33 +208,26 @@ asm
   cmpl  $-4095,%eax
   cmpl  $-4095,%eax
   jb   .LSyscOK
   jb   .LSyscOK
   negl  %eax
   negl  %eax
-{$ifdef REGCALL}
+{$ifdef FPC_PIC}
+  call  fpc_geteipasebx
+  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
+  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
+  movl  (%ecx),%ecx
+  movl  Errno@GOT(%ebx),%edi
+{$else FPC_PIC}
+  leal  Errno,%edi
   movl  fpc_threadvar_relocate_proc,%ecx
   movl  fpc_threadvar_relocate_proc,%ecx
+{$endif FPC_PIC}
   testl %ecx,%ecx
   testl %ecx,%ecx
   jne   .LThread
   jne   .LThread
-  movl  %eax,Errno+4
+  movl  %eax,4(%edi)
   jmp   .LNoThread
   jmp   .LNoThread
 .LThread:
 .LThread:
   movl  %eax,%ebx
   movl  %eax,%ebx
-  movl Errno,%eax
+  movl  (%edi),%eax
   call  *%ecx
   call  *%ecx
   movl  %ebx,(%eax)
   movl  %ebx,(%eax)
 .LNoThread:
 .LNoThread:
-{$else}
-  movl  %eax,%edx
-  movl  fpc_threadvar_relocate_proc,%eax
-  testl %eax,%eax
-  jne   .LThread
-  movl  %edx,Errno+4
-  jmp   .LNoThread
-.LThread:
-  pushl %edx
-  pushl Errno
-  call  *%eax
-  popl  %edx
-  movl  %edx,(%eax)
-.LNoThread:
-{$endif REGCALL}
   movl  $-1,%eax
   movl  $-1,%eax
 .LSyscOK:
 .LSyscOK:
 end;
 end;
@@ -289,33 +248,26 @@ asm
   cmpl  $-4095,%eax
   cmpl  $-4095,%eax
   jb   .LSyscOK
   jb   .LSyscOK
   negl  %eax
   negl  %eax
-{$ifdef REGCALL}
+{$ifdef FPC_PIC}
+  call  fpc_geteipasebx
+  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
+  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
+  movl  (%ecx),%ecx
+  movl  Errno@GOT(%ebx),%edi
+{$else FPC_PIC}
+  leal  Errno,%edi
   movl  fpc_threadvar_relocate_proc,%ecx
   movl  fpc_threadvar_relocate_proc,%ecx
+{$endif FPC_PIC}
   testl %ecx,%ecx
   testl %ecx,%ecx
   jne   .LThread
   jne   .LThread
-  movl  %eax,Errno+4
+  movl  %eax,4(%edi)
   jmp   .LNoThread
   jmp   .LNoThread
 .LThread:
 .LThread:
   movl  %eax,%ebx
   movl  %eax,%ebx
-  movl Errno,%eax
+  movl  (%edi),%eax
   call  *%ecx
   call  *%ecx
   movl  %ebx,(%eax)
   movl  %ebx,(%eax)
 .LNoThread:
 .LNoThread:
-{$else}
-  movl  %eax,%edx
-  movl  fpc_threadvar_relocate_proc,%eax
-  testl %eax,%eax
-  jne   .LThread
-  movl  %edx,Errno+4
-  jmp   .LNoThread
-.LThread:
-  pushl %edx
-  pushl Errno
-  call  *%eax
-  popl  %edx
-  movl  %edx,(%eax)
-.LNoThread:
-{$endif REGCALL}
   movl  $-1,%eax
   movl  $-1,%eax
 .LSyscOK:
 .LSyscOK:
 end;
 end;
@@ -325,6 +277,3 @@ end;
 {$IFDEF SYS_LINUX}
 {$IFDEF SYS_LINUX}
   {$UNDEF SYSCALL_DEBUG}
   {$UNDEF SYSCALL_DEBUG}
 {$ENDIF SYS_LINUX}
 {$ENDIF SYS_LINUX}
-
-
-