Pārlūkot izejas kodu

+ some files from old fixes branch added

git-svn-id: trunk@2385 -
florian 19 gadi atpakaļ
vecāks
revīzija
818ac29ba2

+ 6 - 0
.gitattributes

@@ -3894,8 +3894,14 @@ rtl/linux/ipccall.inc svneol=native#text/plain
 rtl/linux/ipcsys.inc svneol=native#text/plain
 rtl/linux/linuxvcs.pp -text
 rtl/linux/m68k/bsyscall.inc svneol=native#text/plain
+rtl/linux/m68k/cprt0.as -text
+rtl/linux/m68k/cprt21.as -text
+rtl/linux/m68k/dllprt0.as -text
+rtl/linux/m68k/gprt0.as -text
+rtl/linux/m68k/gprt21.as -text
 rtl/linux/m68k/prt0.as -text
 rtl/linux/m68k/prt1.as -text
+rtl/linux/m68k/signal.inc svneol=native#text/plain
 rtl/linux/m68k/stat.inc svneol=native#text/plain
 rtl/linux/osdefs.inc svneol=native#text/plain
 rtl/linux/osmacro.inc svneol=native#text/plain

+ 75 - 0
rtl/linux/m68k/cprt0.as

@@ -0,0 +1,75 @@
+|
+|   $Id: cprt0.as,v 1.1.2.2 2001/08/01 13:26:17 pierre Exp $
+|   This file is part of the Free Pascal run time library.
+|   Copyright (c) 2001 by Free Pascal Core Team
+|
+|   See the file COPYING.FPC, included in this distribution,
+|   for details about the copyright.
+|
+|   This program is distributed in the hope that it will be useful,
+|   but WITHOUT ANY WARRANTY;without even the implied warranty of
+|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+|
+|**********************************************************************}
+|
+| Linux m68k ELF startup code for linking with C lib for Free Pascal
+|
+        .file   "cprt0.as"
+	.text
+        .globl  _start
+        .type   _start,@function
+_start:
+        .globl  __entry
+        .type   __entry,@function
+__entry:
+        move.l   8(%sp),%d0
+        move.l   %d0,U_SYSLINUX_ENVP
+        move.l   %d0,__environ
+        move.l   4(%sp),%d0
+        move.l   %d0,U_SYSLINUX_ARGV
+        move.l   (%sp),%d0
+        move.l   %d0,U_SYSLINUX_ARGC
+|       The arguments should be in correct order for
+|       calling __libc_init
+|       This code is untested for now PM
+        jsr     __libc_init
+|       insert _fini in atexit chain
+        move.l   _fini,-(%sp)
+        jsr      atexit
+        addq.l   #4,%sp
+|       call _init function
+        jsr      _init
+
+        jsr      PASCALMAIN
+
+|       Used by System_exit procedure
+        .globl  _haltproc
+_haltproc:
+|       Call C exit function
+        move.w   U_SYSLINUX_EXITCODE,%d1
+        move.l   %d1,-(%sp)
+        jsr      exit
+        moveq.l  #1,%d0
+        move.l   (%sp)+,%d1
+        trap     #0
+        bra      _haltproc
+
+
+|       Is this still needed ??
+|        .data
+|        .align	4
+|        .globl	___fpc_brk_addr
+|___fpc_brk_addr:
+|       .long	0
+
+
+|
+| $Log: cprt0.as,v $
+| Revision 1.1.2.2  2001/08/01 13:26:17  pierre
+|  * syntax adapted to GNU as
+|
+| Revision 1.1.2.1  2001/07/13 15:29:32  pierre
+|  first version of cprt0.as
+|
+|
+

+ 144 - 0
rtl/linux/m68k/cprt21.as

@@ -0,0 +1,144 @@
+|
+|   $Id: cprt21.as,v 1.1.2.5 2002/02/28 22:44:44 pierre Exp $
+|   This file is part of the Free Pascal run time library.
+|   Copyright (c) 1999-2000 by Michael Van Canneyt and Peter Vreman
+|   members of the Free Pascal development team.
+|
+|   See the file COPYING.FPC, included in this distribution,
+|   for details about the copyright.
+|
+|   This program is distributed in the hope that it will be useful,
+|   but WITHOUT ANY WARRANTY;without even the implied warranty of
+|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+|
+|**********************************************************************}
+|
+| Linux ELF startup code for Free Pascal
+|
+
+        .file   "prt1.as"
+        .text
+        .globl  _start
+        .type   _start,@function
+_start:
+        /* First locate the start of the environment variables */
+        move.l    (%sp)+,%d3
+        move.l    %d0,%d4
+
+        move.l    %sp,%d1               /* Points to the arguments */
+        move.l    %d3,%d0
+        addq.l    #1,%d0
+        lsl.l     #2,%d0
+        add.l     %sp,%d0
+
+        move.l    %sp,%d7
+        and.l     #0xfffffff8,%d7        /* Align stack */
+        move.l    %d7,%sp
+
+        move.l    %d0,U_SYSLINUX_ENVP    /* Move the environment pointer */
+        move.l    %d3,U_SYSLINUX_ARGC    /* Move the argument counter    */
+        move.l    %d1,U_SYSLINUX_ARGV    /* Move the argument pointer    */
+
+        move.l   #0,%fp                  /* Zero frame pointer to end call stack */
+
+|
+|       Start of args for __libc_start_main
+|
+|
+        move.l   %d4,-(%sp)
+        move.l   %sp,-(%sp)
+        move.l   %a1,-(%sp)
+        pea.l    _fini_dummy
+        pea.l    _init_dummy
+        move.l   %d1,-(%sp)
+        move.l   %d3,-(%sp)
+        pea.l    main
+        jsr      __libc_start_main
+        trap     #0
+
+/* fake main routine which will be run from libc */
+main:
+        /* save return address */
+        move.l    (%sp)+,%d0
+        move.l    %d0,___fpc_ret
+        move.l    %d1,___fpc_ret_d1
+        move.l    %fp,___fpc_ret_fp
+        move.l    %d0,-(%sp)
+
+        /* start the program */
+        move.l   #0,%fp
+        jsr      PASCALMAIN
+
+        .globl _haltproc
+        .type _haltproc,@function
+_haltproc:
+        eor.l    %d0,%d0               /* load and save exitcode */
+        move.w   U_SYSLINUX_EXITCODE,%d0
+
+        move.l    ___fpc_ret,%d3         /* return to libc */
+        move.l    ___fpc_ret_fp,%fp
+        move.l    ___fpc_ret_d1,%d1
+        move.l    %d3,-(%sp)
+_init_dummy:
+_fini_dummy:
+        rts
+
+.data
+        .align  4
+
+        .globl  ___fpc_brk_addr         /* heap management */
+        .type   ___fpc_brk_addr,@object
+        .size   ___fpc_brk_addr,4
+___fpc_brk_addr:
+        .long   0
+
+___fpc_ret:                             /* return address to libc */
+        .long   0
+___fpc_ret_d1:
+        .long   0
+___fpc_ret_fp:
+        .long   0
+
+
+|
+| $Log: cprt21.as,v $
+| Revision 1.1.2.5  2002/02/28 22:44:44  pierre
+|  + add some comments
+|
+| Revision 1.1.2.4  2001/08/02 21:23:59  pierre
+|  * fix the args to __libc_start_main
+|
+| Revision 1.1.2.3  2001/07/30 20:05:07  pierre
+|  * fix a assembler syntax eror in last commit
+|
+| Revision 1.1.2.2  2001/07/30 16:18:53  pierre
+|  * converted from i386 code
+|
+| Revision 1.1.2.2  2001/06/04 18:04:32  peter
+|   * use own dummies for _init and _fini
+|
+| Revision 1.1.2.1  2001/02/14 22:18:45  pierre
+|  * fix Sebastian's problem with HeapTrace
+|
+| Revision 1.1  2000/07/13 06:30:55  michael
+| + Initial import
+|
+| Revision 1.3  2000/01/07 16:41:42  daniel
+|   * copyright 2000
+|
+| Revision 1.2  2000/01/07 16:32:28  daniel
+|   * copyright 2000 added
+|
+| Revision 1.1  1999/05/03 21:29:36  peter
+|   + glibc 2.1 support
+|
+| Revision 1.3  1998/11/04 10:16:25  peter
+|   + xorl fp,fp to indicate end of backtrace
+|
+| Revision 1.2  1998/10/14 21:28:46  peter
+|   * initialize fpu so sigfpe is finally generated for fpu errors
+|
+| Revision 1.1  1998/08/12 19:16:09  peter
+|   + loader including libc init and exit
+|
+|

+ 66 - 0
rtl/linux/m68k/dllprt0.as

@@ -0,0 +1,66 @@
+|
+|   $Id: dllprt0.as,v 1.1.2.4 2001/08/01 13:26:17 pierre Exp $
+|   This file is part of the Free Pascal run time library.
+|   Copyright (c) 2001 by Pierre Muller
+|
+|   See the file COPYING.FPC, included in this distribution,
+|   for details about the copyright.
+|
+|   This program is distributed in the hope that it will be useful,
+|   but WITHOUT ANY WARRANTY;without even the implied warranty of
+|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+|
+|**********************************************************************}
+|
+| Linux m68k ELF shared library startup code for Free Pascal
+|
+        .file "dllprt0.as"
+	.text
+        .globl  _startlib
+        .type   _startlib,@function
+_startlib:
+        .globl  FPC_LIB_START
+        .type   FPC_LIB_START,@function
+FPC_LIB_START:
+|
+|       The args and envs are not tested yet
+|
+        move.l   (%sp)+, %d0
+        lea      4(%sp,%d0*4),%a0
+        move.l   %a0, U_SYSLINUX_ENVP
+        move.l   %sp,U_SYSLINUX_ARGV
+        move.l   %d0,U_SYSLINUX_ARGC
+        jsr      PASCALMAIN
+        rts
+
+        .globl  _haltproc
+        .type   _haltproc,@function
+haltproc:
+        moveq.l   #1,%d0
+        move.w    U_SYSLINUX_EXITCODE,%d1
+        trap      #0
+        bra       _haltproc
+
+
+        .data
+	.align  4
+	.globl  ___fpc_brk_addr
+___fpc_brk_addr:
+        .long   0
+
+|
+| $Log: dllprt0.as,v $
+| Revision 1.1.2.4  2001/08/01 13:26:17  pierre
+|  * syntax adapted to GNU as
+|
+| Revision 1.1.2.3  2001/07/13 15:13:47  pierre
+|  + add and fix some comments
+|
+| Revision 1.1.2.2  2001/07/13 15:04:35  pierre
+|  * correct assembler error
+|
+| Revision 1.1.2.1  2001/07/13 15:03:02  pierre
+|  + New file converted from i386 version
+|
+|
+

+ 92 - 0
rtl/linux/m68k/gprt0.as

@@ -0,0 +1,92 @@
+|
+|   $Id: gprt0.as,v 1.1.2.3 2001/08/01 13:26:17 pierre Exp $
+|   This file is part of the Free Pascal run time library.
+|   Copyright (c) 2001 by Free Pascal Core Team
+|
+|   See the file COPYING.FPC, included in this distribution,
+|   for details about the copyright.
+|
+|   This program is distributed in the hope that it will be useful,
+|   but WITHOUT ANY WARRANTY;without even the implied warranty of
+|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+|
+|**********************************************************************}
+|
+| Linux m68k ELF startup code with profiling support for Free Pascal
+| Note: Needs linking with -lgmon and -lc
+|
+        .file   "gprt0.as"
+	.text
+        .globl  _start
+        .type   _start,@function
+_start:
+        .globl  __entry
+        .type   __entry,@function
+__entry:
+        move.l   8(%sp),%d0
+        move.l   %d0,U_SYSLINUX_ENVP
+        move.l   %d0,__environ
+        move.l   4(%sp),%d0
+        move.l   %d0,U_SYSLINUX_ARGV
+        move.l   (%sp),%d0
+        move.l   %d0,U_SYSLINUX_ARGC
+|       Initialize gmon
+|       Should this be done before or after __libc_init call ??
+|
+        move.l   _etext,-(%sp)                 /* Initialize gmon */
+        move.l   _start,-(%sp)
+        jsr      monstartup
+        addq.l   #8,%sp
+        move.l   _mcleanup,-(%sp)
+        jsr      atexit
+        addq.l   #4,%sp
+
+
+|       The arguments should be in correct order for
+|       calling __libc_init
+|       This code is untested for now PM
+        jsr     __libc_init
+|       insert _fini in atexit chain
+        move.l   _fini,-(%sp)
+        jsr      atexit
+        addq.l     #4,%sp
+|       call _init function
+        jsr      _init
+
+        jsr     PASCALMAIN
+
+|       Used by System_exit procedure
+        .globl  _haltproc
+_haltproc:
+|       Call C exit function
+        move.w   U_SYSLINUX_EXITCODE,%d1
+        move.l   %d1,-(%sp)
+        jsr      exit
+        moveq.l  #1,%d0
+        move.l   (%sp)+,%d1
+        trap     #0
+        bra      _haltproc
+
+
+|       Is this still needed ??
+|        .data
+|        .align	4
+|        .globl	___fpc_brk_addr
+|___fpc_brk_addr:
+|       .long	0
+
+
+|
+| $Log: gprt0.as,v $
+| Revision 1.1.2.3  2001/08/01 13:26:17  pierre
+|  * syntax adapted to GNU as
+|
+| Revision 1.1.2.2  2001/07/13 15:43:22  pierre
+|  assembler error corrected
+|
+| Revision 1.1.2.1  2001/07/13 15:38:54  pierre
+|  first version of gprt0.as file
+|
+|
+|
+

+ 95 - 0
rtl/linux/m68k/gprt21.as

@@ -0,0 +1,95 @@
+|
+|   $Id: gprt21.as,v 1.1.2.2 2001/08/01 13:26:17 pierre Exp $
+|   This file is part of the Free Pascal run time library.
+|   Copyright (c) 2001 by Free Pascal Core Team
+|
+|   See the file COPYING.FPC, included in this distribution,
+|   for details about the copyright.
+|
+|   This program is distributed in the hope that it will be useful,
+|   but WITHOUT ANY WARRANTY;without even the implied warranty of
+|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+|
+|**********************************************************************}
+|
+| Linux m68k ELF startup code with profiling support for Free Pascal
+| Note: Needs linking with -lgmon and -lc
+|
+        .file   "gprt0.as"
+	.text
+        .globl   _start
+        .type    _start,@function
+_start:
+        .globl   __entry
+        .type    __entry,@function
+__entry:
+        move.l   8(%sp),%d0
+        move.l   %d0,U_SYSLINUX_ENVP
+        move.l   %d0,__environ
+        move.l   4(%sp),%d0
+        move.l   %d0,U_SYSLINUX_ARGV
+        move.l   (%sp),%d0
+        move.l   %d0,U_SYSLINUX_ARGC
+|       Initialize gmon
+|       Should this be done before or after __libc_init call ??
+|
+        move.l   _etext,-(%sp)                 /* Initialize gmon */
+        move.l   _start,-(%sp)
+        jsr      monstartup
+        addq.l   #8,%sp
+        move.l   _mcleanup,-(%sp)
+        jsr      atexit
+        addq.l   #4,%sp
+
+
+|       The arguments should be in correct order for
+|       calling __libc_init
+|       This code is untested for now PM
+        jsr      __libc_init
+|       insert _fini in atexit chain
+        move.l   _fini,-(%sp)
+        jsr      atexit
+        addq.l   #4,%sp
+|       call _init function
+        jsr      _init
+
+        jsr      PASCALMAIN
+
+|       Used by System_exit procedure
+        .globl  _haltproc
+_haltproc:
+|       Call C exit function
+        move.w   U_SYSLINUX_EXITCODE,%d1
+        move.l   %d1,-(%sp)
+        jsr      exit
+        moveq.l  #1,%d0
+        move.l   (%sp)+,%d1
+        trap     #0
+        bra      _haltproc
+
+
+|       Is this still needed ??
+|        .data
+|        .align	4
+|        .globl	___fpc_brk_addr
+|___fpc_brk_addr:
+|       .long	0
+
+
+|
+| $Log: gprt21.as,v $
+| Revision 1.1.2.2  2001/08/01 13:26:17  pierre
+|  * syntax adapted to GNU as
+|
+| Revision 1.1.2.1  2001/07/13 15:45:40  pierre
+|  simple copies of cprt0 and gprt0 added
+|
+| Revision 1.1.2.2  2001/07/13 15:43:22  pierre
+|  assembler error corrected
+|
+| Revision 1.1.2.1  2001/07/13 15:38:54  pierre
+|  first version of gprt0.as file
+|
+|
+|
+

+ 220 - 0
rtl/linux/m68k/signal.inc

@@ -0,0 +1,220 @@
+{
+    $Id: signal.inc,v 1.1.2.2 2002/10/10 19:31:28 pierre Exp $
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by Pierre Muller,
+    member of the Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$packrecords C}
+{********************
+      Signal
+********************}
+
+Const
+  { For sending a signal }
+  SA_NOCLDSTOP = 1;
+  SA_SHIRQ     = $04000000;
+  SA_STACK     = $08000000;
+  SA_RESTART   = $10000000;
+  SA_INTERRUPT = $20000000;
+  SA_NOMASK    = $40000000;
+  SA_ONESHOT   = $80000000;
+
+  SIG_BLOCK   = 0;
+  SIG_UNBLOCK = 1;
+  SIG_SETMASK = 2;
+
+  SIG_DFL = 0 ;
+  SIG_IGN = 1 ;
+  SIG_ERR = -1 ;
+
+  SIGHUP     = 1;
+  SIGINT     = 2;
+  SIGQUIT    = 3;
+  SIGILL     = 4;
+  SIGTRAP    = 5;
+  SIGABRT    = 6;
+  SIGIOT     = 6;
+  SIGBUS     = 7;
+  SIGFPE     = 8;
+  SIGKILL    = 9;
+  SIGUSR1    = 10;
+  SIGSEGV    = 11;
+  SIGUSR2    = 12;
+  SIGPIPE    = 13;
+  SIGALRM    = 14;
+  SIGTerm    = 15;
+  SIGSTKFLT  = 16;
+  SIGCHLD    = 17;
+  SIGCONT    = 18;
+  SIGSTOP    = 19;
+  SIGTSTP    = 20;
+  SIGTTIN    = 21;
+  SIGTTOU    = 22;
+  SIGURG     = 23;
+  SIGXCPU    = 24;
+  SIGXFSZ    = 25;
+  SIGVTALRM  = 26;
+  SIGPROF    = 27;
+  SIGWINCH   = 28;
+  SIGIO      = 29;
+  SIGPOLL    = SIGIO;
+  SIGPWR     = 30;
+  SIGUNUSED  = 31;
+
+
+
+{ not sure this value is correct for m68k PM }
+const
+  SI_PAD_SIZE	= ((128 div sizeof(longint)) - 3);
+
+
+type
+  { REMARK: floating point regs are defined as arrays of
+    3 longints; I don't know if C does align this to
+    16 byte boundaries for each element of the array PM }
+  { If C does we might need to define this as
+    array from 0 to 3 }
+
+  tfpreg = array[0..2] of longint;
+
+  pfpstate = ^tfpstate;
+  tfpstate = record
+           pcr,psr,fpiaddr : longint;
+	   fpreg : array [0..7] of tfpreg;
+  end;
+
+  Size_T = cardinal;
+
+  SigSet  = Longint;
+  PSigSet = ^SigSet;
+
+  { as defined in asm_m68k/signal.h }
+  Stack_T = Record
+    ss_sp : pointer;
+    ss_flags : longint;
+    ss_size : size_t;
+  end;
+
+  { SigContextRec corresponds to the ucontext record
+    in linux asm-m68k/ucontext.h include file }
+  PSigContextRec = ^SigContextRec;
+  SigContextRec = record
+    uc_flags : cardinal;
+    uc_link : pSigContextRec;
+    uc_stack : stack_t; { what's that ?? }
+    { fields from 'version' to 'pc'
+      correspond to the mcontext struct in asm-m68k/ucontext.h file }
+    version : longint; { SigContext version check }
+    { 18 general registers }
+    d0,d1,d2,d3,d4,d5,d6,d7 : cardinal;
+    a0,a1,a2,a3,a4,a5 : cardinal;
+    fp,sp,ps,pc : cardinal;
+    { fields from 'pcr' to 'fpreg'
+      are floating point part }
+    pcr,psr,fpiaddr : longint;
+    fpreg : array[0..7] of tfpreg; { how is this aligned ?? }
+    filler : array[0..79] of cardinal;
+    sigmask : SigSet;
+  end;
+
+
+  PSigInfoRec = ^SigInfoRec;
+  SigInfoRec = record
+    si_signo: longint;
+    si_errno: longint;
+    si_code: longint;
+
+    case longint of
+      0:
+        (pad: array[0 .. SI_PAD_SIZE-1] of longint);
+      1: { kill }
+        ( kill: record
+            pid: longint;  { sender's pid }
+            uid : longint; { sender's uid }
+          end );
+      2: { POSIX.1b timers }
+        ( timer : record
+            timer1 : cardinal;
+            timer2 : cardinal;
+           end );
+      3: { POSIX.1b signals }
+        ( rt : record
+            pid : longint;    { sender's pid }
+            uid : longint;    { sender's uid }
+            sigval : longint;
+         end );
+      4: { SIGCHLD }
+        ( sigchld : record
+          pid : longint;    { which child }
+          uid : longint;    { sender's uid }
+          status : longint; { exit code }
+          utime : timeval;
+          stime : timeval;
+         end );
+      5: { SIGILL, SIGFPE, SIGSEGV, SIGBUS }
+        ( sigfault : record
+            addr : pointer;{ faulting insn/memory ref. }
+          end );
+      6:
+        ( sigpoll : record
+            band : longint; { POLL_IN, POLL_OUT, POLL_MSG }
+            fd : longint;
+          end );
+  end;
+
+
+  SignalHandler   = Procedure(Sig : Longint);cdecl;
+  PSignalHandler  = ^SignalHandler;
+  SignalRestorer  = Procedure;cdecl;
+  PSignalRestorer = ^SignalRestorer;
+  { the third argument is only a guess for now,
+    asm-m68k/signal.h gives only void * arg type PM }
+  TSigAction = procedure(Sig: Longint; SigInfoPtr : PSigInfoRec; SigContextPtr : PSigContextRec);cdecl;
+
+
+  SigActionRec = packed record
+    Handler  : record
+      case byte of
+        0: (Sh: SignalHandler);
+        1: (Sa: TSigAction);
+      end;
+    Sa_Mask     : SigSet;
+    Sa_Flags    : Longint;
+    Sa_restorer : SignalRestorer; { Obsolete - Don't use }
+  end;
+  PSigActionRec = ^SigActionRec;
+(*
+Procedure SigAction(Signum:Integer;Act,OldAct:PSigActionRec );
+{
+  Change action of process upon receipt of a signal.
+  Signum specifies the signal (all except SigKill and SigStop).
+  If Act is non-nil, it is used to specify the new action.
+  If OldAct is non-nil the previous action is saved there.
+}
+Var
+  sr : Syscallregs;
+begin
+  sr.reg2:=Signum;
+  sr.reg3:=Longint(act);
+  sr.reg4:=Longint(oldact);
+  SysCall(Syscall_nr_sigaction,sr);
+end; *)
+
+{
+  $Log: signal.inc,v $
+  Revision 1.1.2.2  2002/10/10 19:31:28  pierre
+   * update those files that are unused currently
+
+  Revision 1.1.2.1  2001/07/13 15:05:40  pierre
+   + first signal context tries
+
+}