Prechádzať zdrojové kódy

first m68k netbsd files

pierre 24 rokov pred
rodič
commit
9d6d7822b3
3 zmenil súbory, kde vykonal 323 pridanie a 0 odobranie
  1. 80 0
      rtl/netbsd/m68k/cprt0.as
  2. 173 0
      rtl/netbsd/m68k/cpusys.inc
  3. 70 0
      rtl/netbsd/m68k/prt0.as

+ 80 - 0
rtl/netbsd/m68k/cprt0.as

@@ -0,0 +1,80 @@
+|
+|   $Id$
+|   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_SYSBSD_ENVP
+        move.l   %d0,__environ
+        move.l   4(%sp),%d0
+        move.l   %d0,U_SYSBSD_ARGV
+        move.l   (%sp),%d0
+        move.l   %d0,U_SYSBSD_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_SYSBSD_EXITCODE,%d1
+        move.l   %d1,-(%sp)
+        jsr      exit
+        moveq.l  #1,%d0
+|       No, leave the exit code on stack as NetBSD expects it
+|       move.l   (%sp)+,%d1
+        trap     #0
+        addq.l   #4,%sp
+        bra      _haltproc
+
+
+|       Is this still needed ??
+|        .data
+|        .align	4
+|        .globl	___fpc_brk_addr
+|___fpc_brk_addr:
+|       .long	0
+
+
+|
+| $Log$
+| Revision 1.1.2.1  2001-08-10 11:00:59  pierre
+|  first m68k netbsd files
+|
+| 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
+|
+|
+

+ 173 - 0
rtl/netbsd/m68k/cpusys.inc

@@ -0,0 +1,173 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by Michael Van Canneyt,
+    member of the Free Pascal development team.
+
+    CPU dependent part of syscall for NetBSD
+
+    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.
+
+ **********************************************************************}
+
+
+procedure actualsyscall; assembler;{$ifdef TEST_INLINE}inline;{$endif TEST_INLINE}
+    asm
+         trap  #0
+         bcs   @LErrorcode
+         clr.l d1
+         rts
+@LErrorcode:
+         move.l d0,d1
+         move.l #-1,d0
+   end;
+
+
+function Do_SysCall(sysnr:LONGINT):longint; assembler;
+
+asm
+  move.l  sysnr,d0
+  bsr     actualsyscall
+  move.l  d1,Errno
+end;
+
+function Do_SysCall(sysnr,param1:longint):longint; assembler;
+
+ asm
+  move.l Param1,-(sp)
+  move.l sysnr,d0
+  bsr    actualsyscall
+  addq.l #4,sp
+  move.l d1,Errno
+ end;
+
+{ Can this happen, where ?? PM }
+function Do_SysCall(sysnr,param1:integer):longint;
+(*assembler;
+ asm
+  movzwl sysnr,%eax
+  pushw Param1
+  move.l sysnr,-(sp)
+  bsr   actualsyscall
+  addl  $2,sp
+  move.l d1,Errno
+ end; *)
+begin
+  RunError(218);
+end;
+
+
+function Do_SysCall(sysnr,param1,param2:LONGINT):longint; assembler;
+
+ asm
+   move.l Param2,-(sp)
+   move.l Param1,-(sp)
+   move.l sysnr,d0
+   bsr    actualsyscall
+   add.l  #8,sp
+   move.l d1,Errno
+ end;
+
+function Do_SysCall(sysnr,param1,param2,param3:LONGINT):longint; assembler;
+
+ asm
+   move.l Param3,-(sp)
+   move.l Param2,-(sp)
+   move.l Param1,-(sp)
+   move.l sysnr,d0
+   bsr    actualsyscall
+   add.l  #12,sp
+   move.l d1,Errno
+ end;
+
+function Do_SysCall(sysnr,param1,param2,param3,param4:LONGINT):longint; assembler;
+
+asm
+   move.l Param4,-(sp)
+   move.l Param3,-(sp)
+   move.l Param2,-(sp)
+   move.l Param1,-(sp)
+   move.l sysnr,d0
+   bsr    actualsyscall
+   add.l  #16,sp
+   move.l d1,Errno
+end;
+
+
+function Do_SysCall(sysnr,param1,param2,param3,param4,param5:LONGINT):longint;  assembler;
+
+ asm
+   move.l Param5,-(sp)
+   move.l Param4,-(sp)
+   move.l Param3,-(sp)
+   move.l Param2,-(sp)
+   move.l Param1,-(sp)
+   move.l sysnr,d0
+   bsr    actualsyscall
+   add.l  #20,sp
+   move.l d1,Errno
+ end;
+
+function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6:LONGINT):longint;  assembler;
+
+asm
+   move.l Param6,-(sp)
+   move.l Param5,-(sp)
+   move.l Param4,-(sp)
+   move.l Param3,-(sp)
+   move.l Param2,-(sp)
+   move.l Param1,-(sp)
+   move.l sysnr,d0
+   bsr    actualsyscall
+   add.l  #24,sp
+   move.l d1,Errno
+end;
+
+
+function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:LONGINT):longint;  assembler;
+
+asm
+   move.l Param7,-(sp)
+   move.l Param6,-(sp)
+   move.l Param5,-(sp)
+   move.l Param4,-(sp)
+   move.l Param3,-(sp)
+   move.l Param2,-(sp)
+   move.l Param1,-(sp)
+   move.l sysnr,d0
+   bsr    actualsyscall
+   add.l  #28,sp
+   move.l d1,Errno
+end;
+
+Function Sys_Lseek(F:longint;Off:longint;Whence:longint): int64; assembler;
+{this one is special for the return value being 64-bit..}
+{ syscall: "lseek" ret: "off_t" args: "int" "int" "off_t" "int"  }
+ asm
+  move.l Whence,-(sp)
+  pea    (0)         // high word of offset
+  move.l Off,-(sp)   //low word of offset
+  pea    (0)
+  move.l F,-(sp)
+  move.l #syscall_nr_lseek,d0
+  trap  #0
+  add.l  #20,sp
+  bcs   @LLseekErrorcode
+  rts         // return value is in d1/d0
+@LLseekErrorcode:
+  move.l d0,Errno
+  move.l #-1,d0  // set d0 and d1 to -1
+  move.l #-1,d1
+ end;
+
+{
+ $Log$
+ Revision 1.1.2.1  2001-08-10 11:00:59  pierre
+  first m68k netbsd files
+
+}

+ 70 - 0
rtl/netbsd/m68k/prt0.as

@@ -0,0 +1,70 @@
+|
+|   $Id$
+|   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 Free Pascal
+|
+        .file   "prt0.as"
+	.text
+        .globl  __entry
+__entry:
+        .globl  _start
+_start:
+        move.l   (%sp),%d0
+        move.l   %d0,U_SYSBSD_ARGC
+        lea      4(%sp),%a0
+        move.l   %a0,U_SYSBSD_ARGV
+        lea      8(%sp,%d0*4),%a0
+        move.l   %a0,U_SYSBSD_ENVP
+        jsr      PASCALMAIN
+
+        .globl   _haltproc
+_haltproc:
+        moveq.l  #1,%d0
+        clr.l    %d1
+        move.w   U_SYSBSD_EXITCODE,%d1
+        move.l   %d1,-(%sp)
+        trap     #0
+        addq.l   #4,%sp
+        bra      _haltproc
+
+
+        .data
+	.align	4
+	.globl	___fpc_brk_addr
+___fpc_brk_addr:
+	.long	0
+
+
+|
+| $Log$
+| Revision 1.1.2.1  2001-08-10 11:00:59  pierre
+|  first m68k netbsd files
+|
+| Revision 1.1.2.5  2001/08/03 15:13:49  pierre
+|  * forgot % prefix in last patch
+|
+| Revision 1.1.2.4  2001/08/03 14:40:29  pierre
+|  * EXITCODE is a word var so we need to load it with move.w
+|
+| Revision 1.1.2.3  2001/07/30 16:18:31  pierre
+|  * convert to normal GNU as syntax
+|
+| Revision 1.1.2.2  2001/07/17 12:30:53  pierre
+|  * fix argv vand envp setting
+|
+| Revision 1.1.2.1  2001/07/13 15:13:47  pierre
+|  + add and fix some comments
+|
+|
+