Browse Source

* x86_64 updates

peter 20 years ago
parent
commit
64cd72bc5a
5 changed files with 124 additions and 30 deletions
  1. 5 2
      rtl/inc/threadh.inc
  2. 5 2
      rtl/linux/tthread.inc
  3. 11 8
      rtl/linux/x86_64/syscall.inc
  4. 5 2
      rtl/unix/cthreads.pp
  5. 98 16
      rtl/x86_64/math.inc

+ 5 - 2
rtl/inc/threadh.inc

@@ -21,7 +21,7 @@ const
 
 type
   PEventState = pointer;
-  TThreadFunc = function(parameter : pointer) : longint;
+  TThreadFunc = function(parameter : pointer) : ptrint;
 
   // Function prototypes for TThreadManager Record.
   TBeginThreadHandler = Function (sa : Pointer;stacksize : dword; ThreadFunction : tthreadfunc;p : pointer;creationFlags : dword; var ThreadId : THandle) : DWord;
@@ -145,7 +145,10 @@ function  basiceventWaitFor(Timeout : Cardinal;state:peventstate) : longint;
 
 {
   $Log$
-  Revision 1.19  2004-09-19 18:55:30  armin
+  Revision 1.20  2004-12-12 14:30:27  peter
+    * x86_64 updates
+
+  Revision 1.19  2004/09/19 18:55:30  armin
   * added define DISABLE_NO_THREAD_MANAGER to avoid warnings if thread manager is always present
 
   Revision 1.18  2004/05/23 20:26:20  marco

+ 5 - 2
rtl/linux/tthread.inc

@@ -127,7 +127,7 @@ end;
 {$define WRITE_DEBUG := //}      // just comment out those lines
 {$ENDIF}
 
-function ThreadFunc(parameter: Pointer): LongInt; 
+function ThreadFunc(parameter: Pointer): PtrInt; 
 var
   LThread: TThread;
   c: char;
@@ -325,7 +325,10 @@ end;
 
 {
   $Log$
-  Revision 1.7  2004-03-03 22:00:37  peter
+  Revision 1.8  2004-12-12 14:30:27  peter
+    * x86_64 updates
+
+  Revision 1.7  2004/03/03 22:00:37  peter
     * remove cdecl
 
   Revision 1.6  2003/11/22 11:04:08  marco

+ 11 - 8
rtl/linux/x86_64/syscall.inc

@@ -27,7 +27,7 @@ asm
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
   movq  %rax,%rdx
-  movq  FPC_THREADVAR_RELOCATE,%rax
+  movq  fpc_threadvar_relocate_proc,%rax
   testq %rax,%rax
   jne   .LThread
   movq  %rdx,Errno+8
@@ -53,7 +53,7 @@ asm
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
   movq  %rax,%rdx
-  movq  FPC_THREADVAR_RELOCATE,%rax
+  movq  fpc_threadvar_relocate_proc,%rax
   testq %rax,%rax
   jne   .LThread
   movq  %rdx,Errno+8
@@ -80,7 +80,7 @@ asm
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
   movq  %rax,%rdx
-  movq  FPC_THREADVAR_RELOCATE,%rax
+  movq  fpc_threadvar_relocate_proc,%rax
   testq %rax,%rax
   jne   .LThread
   movq  %rdx,Errno+8
@@ -108,7 +108,7 @@ asm
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
   movq  %rax,%rdx
-  movq  FPC_THREADVAR_RELOCATE,%rax
+  movq  fpc_threadvar_relocate_proc,%rax
   testq %rax,%rax
   jne   .LThread
   movq  %rdx,Errno+8
@@ -137,7 +137,7 @@ asm
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
   movq  %rax,%rdx
-  movq  FPC_THREADVAR_RELOCATE,%rax
+  movq  fpc_threadvar_relocate_proc,%rax
   testq %rax,%rax
   jne   .LThread
   movq  %rdx,Errno+8
@@ -167,7 +167,7 @@ asm
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
   movq  %rax,%rdx
-  movq  FPC_THREADVAR_RELOCATE,%rax
+  movq  fpc_threadvar_relocate_proc,%rax
   testq %rax,%rax
   jne   .LThread
   movq  %rdx,Errno+8
@@ -199,7 +199,7 @@ asm
   jnae .LSyscOK           { Jump to error handler if error.  }
   negq  %rax
   movq  %rax,%rdx
-  movq  FPC_THREADVAR_RELOCATE,%rax
+  movq  fpc_threadvar_relocate_proc,%rax
   testq %rax,%rax
   jne   .LThread
   movq  %rdx,Errno+8
@@ -224,7 +224,10 @@ end;
 
 {
   $Log$
-  Revision 1.8  2004-05-28 21:37:34  peter
+  Revision 1.9  2004-12-12 14:30:27  peter
+    * x86_64 updates
+
+  Revision 1.8  2004/05/28 21:37:34  peter
     * fix errno for multithread
 
   Revision 1.7  2004/05/18 20:13:12  peter

+ 5 - 2
rtl/unix/cthreads.pp

@@ -245,7 +245,7 @@ Uses
       begin
         DoneThread;
         pthread_detach(pthread_t(pthread_self()));
-        pthread_exit(pointer(ExitCode));
+        pthread_exit(pointer(ptrint(ExitCode)));
       end;
 
 
@@ -561,7 +561,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.13  2004-10-14 17:39:33  florian
+  Revision 1.14  2004-12-12 14:30:27  peter
+    * x86_64 updates
+
+  Revision 1.13  2004/10/14 17:39:33  florian
     + added system.align
     + threadvars are now aligned
 

+ 98 - 16
rtl/x86_64/math.inc

@@ -37,25 +37,88 @@
                        EXTENDED data type routines
  ****************************************************************************}
 
+{$ifdef INTERNCONSTINTF}
     {$define FPC_SYSTEM_HAS_PI}
-    function pi : extended;[internproc:fpc_in_pi];
+    function fpc_pi_real : ValReal;compilerproc;
+    begin
+      { Function is handled internal in the compiler }
+      runerror(207);
+      result:=0;
+    end;
+    {$define FPC_SYSTEM_HAS_ABS}
+    function fpc_abs_real(d : ValReal) : ValReal;compilerproc;
+    begin
+      { Function is handled internal in the compiler }
+      runerror(207);
+      result:=0;
+    end;
+    {$define FPC_SYSTEM_HAS_SQR}
+    function fpc_sqr_real(d : ValReal) : ValReal;compilerproc;
+    begin
+      { Function is handled internal in the compiler }
+      runerror(207);
+      result:=0;
+    end;
+    {$define FPC_SYSTEM_HAS_SQRT}
+    function fpc_sqrt_real(d : ValReal) : ValReal;compilerproc;
+    begin
+      { Function is handled internal in the compiler }
+      runerror(207);
+      result:=0;
+    end;
+    {$define FPC_SYSTEM_HAS_ARCTAN}
+    function fpc_arctan_real(d : ValReal) : ValReal;compilerproc;
+    begin
+      { Function is handled internal in the compiler }
+      runerror(207);
+      result:=0;
+    end;
+    {$define FPC_SYSTEM_HAS_LN}
+    function fpc_ln_real(d : ValReal) : ValReal;compilerproc;
+    begin
+      { Function is handled internal in the compiler }
+      runerror(207);
+      result:=0;
+    end;
+    {$define FPC_SYSTEM_HAS_SIN}
+    function fpc_sin_real(d : ValReal) : ValReal;compilerproc;
+    begin
+      { Function is handled internal in the compiler }
+      runerror(207);
+      result:=0;
+    end;
+    {$define FPC_SYSTEM_HAS_COS}
+    function fpc_cos_real(d : ValReal) : ValReal;compilerproc;
+    begin
+      { Function is handled internal in the compiler }
+      runerror(207);
+      result:=0;
+    end;
+{$else}
+    {$define FPC_SYSTEM_HAS_PI}
+    function pi : ValReal;[internproc:fpc_in_pi];
     {$define FPC_SYSTEM_HAS_ABS}
-    function abs(d : extended) : extended;[internproc:fpc_in_abs_real];
+    function abs(d : ValReal) : ValReal;[internproc:fpc_in_abs_real];
     {$define FPC_SYSTEM_HAS_SQR}
-    function sqr(d : extended) : extended;[internproc:fpc_in_sqr_real];
+    function sqr(d : ValReal) : ValReal;[internproc:fpc_in_sqr_real];
     {$define FPC_SYSTEM_HAS_SQRT}
-    function sqrt(d : extended) : extended;[internproc:fpc_in_sqrt_real];
+    function sqrt(d : ValReal) : ValReal;[internproc:fpc_in_sqrt_real];
     {$define FPC_SYSTEM_HAS_ARCTAN}
-    function arctan(d : extended) : extended;[internproc:fpc_in_arctan_real];
+    function arctan(d : ValReal) : ValReal;[internproc:fpc_in_arctan_real];
     {$define FPC_SYSTEM_HAS_LN}
-    function ln(d : extended) : extended;[internproc:fpc_in_ln_real];
+    function ln(d : ValReal) : ValReal;[internproc:fpc_in_ln_real];
     {$define FPC_SYSTEM_HAS_SIN}
-    function sin(d : extended) : extended;[internproc:fpc_in_sin_real];
+    function sin(d : ValReal) : ValReal;[internproc:fpc_in_sin_real];
     {$define FPC_SYSTEM_HAS_COS}
-    function cos(d : extended) : extended;[internproc:fpc_in_cos_real];
+    function cos(d : ValReal) : ValReal;[internproc:fpc_in_cos_real];
+{$endif}
 
     {$define FPC_SYSTEM_HAS_EXP}
-    function exp(d : extended) : extended;assembler;[internconst:fpc_in_const_exp];
+  {$ifdef INTERNCONSTINTF}
+    function fpc_exp_real(d : ValReal) : ValReal;assembler;compilerproc;
+  {$else}
+    function exp(d : ValReal) : ValReal;assembler;[internconst:fpc_in_const_exp];
+  {$endif}
        asm
             // comes from DJ GPP
             fldt        d
@@ -89,7 +152,11 @@
 
 
     {$define FPC_SYSTEM_HAS_FRAC}
-    function frac(d : extended) : extended;assembler;[internconst:fpc_in_const_frac];
+  {$ifdef INTERNCONSTINTF}
+    function fpc_frac_real(d : ValReal) : ValReal;assembler;compilerproc;
+  {$else}
+    function frac(d : ValReal) : ValReal;assembler;[internconst:fpc_in_const_frac];
+  {$endif}
       asm
             subq $16,%rsp
             fnstcw -4(%rbp)
@@ -110,7 +177,11 @@
 
 
     {$define FPC_SYSTEM_HAS_INT}
-    function int(d : extended) : extended;assembler;[internconst:fpc_in_const_int];
+  {$ifdef INTERNCONSTINTF}
+    function fpc_int_real(d : ValReal) : ValReal;assembler;compilerproc;
+  {$else}
+    function int(d : ValReal) : ValReal;assembler;[internconst:fpc_in_const_int];
+  {$endif}
       asm
             subq $16,%rsp
             fnstcw -4(%rbp)
@@ -129,7 +200,11 @@
 
 
     {$define FPC_SYSTEM_HAS_TRUNC}
-    function trunc(d : extended) : int64;assembler;[internconst:fpc_in_const_trunc];
+  {$ifdef INTERNCONSTINTF}
+    function fpc_trunc_real(d : ValReal) : int64;assembler;compilerproc;
+  {$else}
+    function trunc(d : ValReal) : int64;assembler;[internconst:fpc_in_const_trunc];
+  {$endif}
       var
         oldcw,
         newcw : word;
@@ -150,13 +225,17 @@
 
 
     {$define FPC_SYSTEM_HAS_ROUND}
-{$ifdef hascompilerproc}
+{$ifdef internconstintf}
+    function fpc_round_real(d : ValReal) : int64;assembler;compilerproc;
+{$else}
+  {$ifdef hascompilerproc}
     function round(d : extended) : int64;[internconst:fpc_in_const_round, external name 'FPC_ROUND'];
 
     function fpc_round(d : extended) : int64;assembler;[public, alias:'FPC_ROUND'];{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
-{$else}
+  {$else}
     function round(d : extended) : int64;assembler;[internconst:fpc_in_const_round];
-{$endif hascompilerproc}
+  {$endif hascompilerproc}
+{$endif}
       var
         oldcw,
         newcw : word;
@@ -196,7 +275,10 @@
 
 {
   $Log$
-  Revision 1.5  2004-12-12 12:41:46  peter
+  Revision 1.6  2004-12-12 14:30:27  peter
+    * x86_64 updates
+
+  Revision 1.5  2004/12/12 12:41:46  peter
     * updated for latest rtl changes
 
   Revision 1.4  2004/04/24 18:31:25  florian