From a22e8f54c4522e44d1459dd5449cf4eb3be761d4 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 15 Oct 2000 09:09:23 +0000 Subject: [PATCH] * startup code also needed syslinux->system updates --- rtl/linux/Makefile | 6 ++-- rtl/linux/Makefile.fpc | 6 ++-- rtl/linux/i386/cprt0.as | 35 +++++--------------- rtl/linux/i386/cprt21.as | 32 +++++------------- rtl/linux/i386/gprt0.as | 35 +++++--------------- rtl/linux/i386/gprt21.as | 36 +++++--------------- rtl/linux/i386/prt0.as | 35 +++++--------------- rtl/linux/i386/prt0_10.as | 69 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 117 insertions(+), 137 deletions(-) create mode 100644 rtl/linux/i386/prt0_10.as diff --git a/rtl/linux/Makefile b/rtl/linux/Makefile index ececf170cd..c49621070c 100644 --- a/rtl/linux/Makefile +++ b/rtl/linux/Makefile @@ -125,8 +125,10 @@ UNITPREFIX=rtl ifeq ($(findstring 1.0.,$(FPC_VERSION)),) SYSTEMUNIT=system +PRT0=prt0 else SYSTEMUNIT=syslinux +PRT0=prt0_10 endif # Paths @@ -1278,8 +1280,8 @@ vpath %$(PASEXT) $(INC) $(PROCINC) $(UNIXINC) # Loaders # -prt0$(OEXT) : $(CPU_TARGET)/prt0.as - $(AS) -o prt0$(OEXT) $(CPU_TARGET)/prt0.as +prt0$(OEXT) : $(CPU_TARGET)/$(PRT0).as + $(AS) -o prt0$(OEXT) $(CPU_TARGET)/$(PRT0).as gprt0$(OEXT) : $(CPU_TARGET)/gprt0.as $(AS) -o gprt0$(OEXT) $(CPU_TARGET)/gprt0.as diff --git a/rtl/linux/Makefile.fpc b/rtl/linux/Makefile.fpc index 9c4ec87c65..47a1743137 100644 --- a/rtl/linux/Makefile.fpc +++ b/rtl/linux/Makefile.fpc @@ -47,8 +47,10 @@ UNITPREFIX=rtl ifeq ($(findstring 1.0.,$(FPC_VERSION)),) SYSTEMUNIT=system +PRT0=prt0 else SYSTEMUNIT=syslinux +PRT0=prt0_10 endif # Paths @@ -88,8 +90,8 @@ vpath %$(PASEXT) $(INC) $(PROCINC) $(UNIXINC) # Loaders # -prt0$(OEXT) : $(CPU_TARGET)/prt0.as - $(AS) -o prt0$(OEXT) $(CPU_TARGET)/prt0.as +prt0$(OEXT) : $(CPU_TARGET)/$(PRT0).as + $(AS) -o prt0$(OEXT) $(CPU_TARGET)/$(PRT0).as gprt0$(OEXT) : $(CPU_TARGET)/gprt0.as $(AS) -o gprt0$(OEXT) $(CPU_TARGET)/gprt0.as diff --git a/rtl/linux/i386/cprt0.as b/rtl/linux/i386/cprt0.as index 72c448dfa8..1d5639239d 100644 --- a/rtl/linux/i386/cprt0.as +++ b/rtl/linux/i386/cprt0.as @@ -30,9 +30,9 @@ _start: addl %esp,%eax andl $0xfffffff8,%esp /* Align stack */ - movl %eax,U_SYSLINUX_ENVP /* Move the environment pointer */ - movl %ecx,U_SYSLINUX_ARGC /* Move the argument counter */ - movl %ebx,U_SYSLINUX_ARGV /* Move the argument pointer */ + movl %eax,U_SYSTEM_ENVP /* Move the environment pointer */ + movl %ecx,U_SYSTEM_ARGC /* Move the argument counter */ + movl %ebx,U_SYSTEM_ARGV /* Move the argument pointer */ movl %eax,__environ /* libc environ */ @@ -60,7 +60,7 @@ _start: .type _haltproc,@function _haltproc: xorl %ebx,%ebx /* load and save exitcode */ - movw U_SYSLINUX_EXITCODE,%bx + movw U_SYSTEM_EXITCODE,%bx pushl %ebx call exit /* call libc exit, this will */ @@ -83,28 +83,9 @@ ___fpc_brk_addr: # # $Log$ -# Revision 1.1 2000-07-13 06:30:55 michael +# Revision 1.2 2000-10-15 09:09:23 peter +# * startup code also needed syslinux->system updates +# +# Revision 1.1 2000/07/13 06:30:55 michael # + Initial import # -# Revision 1.4 2000/02/08 12:39:48 peter -# * removed curbrk -# -# 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/11/08 23:07:48 peter -# * removed aout entries -# -# Revision 1.3 1998/11/04 10:16:25 peter -# + xorl ebp,ebp 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 -# -# diff --git a/rtl/linux/i386/cprt21.as b/rtl/linux/i386/cprt21.as index 97854fd290..6c5583ba59 100644 --- a/rtl/linux/i386/cprt21.as +++ b/rtl/linux/i386/cprt21.as @@ -32,9 +32,9 @@ _start: addl %esp,%eax andl $0xfffffff8,%esp /* Align stack */ - movl %eax,U_SYSLINUX_ENVP /* Move the environment pointer */ - movl %esi,U_SYSLINUX_ARGC /* Move the argument counter */ - movl %ebx,U_SYSLINUX_ARGV /* Move the argument pointer */ + movl %eax,U_SYSTEM_ENVP /* Move the environment pointer */ + movl %esi,U_SYSTEM_ARGC /* Move the argument counter */ + movl %ebx,U_SYSTEM_ARGV /* Move the argument pointer */ xorl %ebp,%ebp pushl %edi @@ -63,7 +63,7 @@ main: .type _haltproc,@function _haltproc: xorl %eax,%eax /* load and save exitcode */ - movw U_SYSLINUX_EXITCODE,%ax + movw U_SYSTEM_EXITCODE,%ax movl ___fpc_ret,%edx /* return to libc */ movl ___fpc_ret_ebx,%ebx @@ -87,25 +87,9 @@ ___fpc_ret_ebx: # # $Log$ -# Revision 1.1 2000-07-13 06:30:55 michael +# Revision 1.2 2000-10-15 09:09:23 peter +# * startup code also needed syslinux->system updates +# +# 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 ebp,ebp 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 -# -# diff --git a/rtl/linux/i386/gprt0.as b/rtl/linux/i386/gprt0.as index ada8229486..46f09e3404 100644 --- a/rtl/linux/i386/gprt0.as +++ b/rtl/linux/i386/gprt0.as @@ -31,9 +31,9 @@ _start: addl %esp,%eax andl $0xfffffff8,%esp /* Align stack */ - movl %eax,U_SYSLINUX_ENVP /* Move the environment pointer */ - movl %ecx,U_SYSLINUX_ARGC /* Move the argument counter */ - movl %ebx,U_SYSLINUX_ARGV /* Move the argument pointer */ + movl %eax,U_SYSTEM_ENVP /* Move the environment pointer */ + movl %ecx,U_SYSTEM_ARGC /* Move the argument counter */ + movl %ebx,U_SYSTEM_ARGV /* Move the argument pointer */ finit /* initialize fpu */ fwait @@ -54,7 +54,7 @@ _start: .type _haltproc,@function _haltproc: xorl %ebx,%ebx /* load and save exitcode */ - movw U_SYSLINUX_EXITCODE,%bx + movw U_SYSTEM_EXITCODE,%bx pushl %ebx call exit /* call libc exit, this will */ @@ -78,28 +78,9 @@ ___fpc_brk_addr: # # $Log$ -# Revision 1.1 2000-07-13 06:30:55 michael +# Revision 1.2 2000-10-15 09:09:23 peter +# * startup code also needed syslinux->system updates +# +# Revision 1.1 2000/07/13 06:30:55 michael # + Initial import # -# Revision 1.9 2000/02/08 12:39:48 peter -# * removed curbrk -# -# Revision 1.8 2000/01/07 16:41:42 daniel -# * copyright 2000 -# -# Revision 1.7 2000/01/07 16:32:28 daniel -# * copyright 2000 added -# -# Revision 1.6 1999/11/08 23:07:48 peter -# * removed aout entries -# -# Revision 1.5 1998/11/04 10:16:27 peter -# + xorl ebp,ebp to indicate end of backtrace -# -# Revision 1.4 1998/10/14 21:28:48 peter -# * initialize fpu so sigfpe is finally generated for fpu errors -# -# Revision 1.3 1998/08/08 14:42:10 peter -# * added missing ___fpc_sbrk and logs -# -# diff --git a/rtl/linux/i386/gprt21.as b/rtl/linux/i386/gprt21.as index 2fa814de54..d791102f27 100644 --- a/rtl/linux/i386/gprt21.as +++ b/rtl/linux/i386/gprt21.as @@ -32,9 +32,9 @@ _start: addl %esp,%eax andl $0xfffffff8,%esp /* Align stack */ - movl %eax,U_SYSLINUX_ENVP /* Move the environment pointer */ - movl %esi,U_SYSLINUX_ARGC /* Move the argument counter */ - movl %ebx,U_SYSLINUX_ARGV /* Move the argument pointer */ + movl %eax,U_SYSTEM_ENVP /* Move the environment pointer */ + movl %esi,U_SYSTEM_ARGC /* Move the argument counter */ + movl %ebx,U_SYSTEM_ARGV /* Move the argument pointer */ movl %edi,%eax xorl %ebp,%ebp @@ -68,7 +68,7 @@ cmain: .type _haltproc,@function _haltproc: xorl %eax,%eax /* load and save exitcode */ - movw U_SYSLINUX_EXITCODE,%ax + movw U_SYSTEM_EXITCODE,%ax movl ___fpc_ret,%edx /* return to libc */ movl ___fpc_ret_ebx,%ebx @@ -122,29 +122,9 @@ ___fpc_ret_edi: # # $Log$ -# Revision 1.1 2000-07-13 06:30:55 michael +# Revision 1.2 2000-10-15 09:09:23 peter +# * startup code also needed syslinux->system updates +# +# Revision 1.1 2000/07/13 06:30:55 michael # + Initial import # -# Revision 1.4 2000/01/07 16:41:42 daniel -# * copyright 2000 -# -# Revision 1.3 2000/01/07 16:32:28 daniel -# * copyright 2000 added -# -# Revision 1.2 1999/05/03 23:30:29 peter -# * small update -# * uses gprt1 again for gprt21 becuase gprt21.as crashes -# -# 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 ebp,ebp 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 -# -# diff --git a/rtl/linux/i386/prt0.as b/rtl/linux/i386/prt0.as index 39ebae7fa3..9cefcc0d77 100644 --- a/rtl/linux/i386/prt0.as +++ b/rtl/linux/i386/prt0.as @@ -30,9 +30,9 @@ _start: addl %esp,%eax andl $0xfffffff8,%esp /* Align stack */ - movl %eax,U_SYSLINUX_ENVP /* Move the environment pointer */ - movl %ecx,U_SYSLINUX_ARGC /* Move the argument counter */ - movl %ebx,U_SYSLINUX_ARGV /* Move the argument pointer */ + movl %eax,U_SYSTEM_ENVP /* Move the environment pointer */ + movl %ecx,U_SYSTEM_ARGC /* Move the argument counter */ + movl %ebx,U_SYSTEM_ARGV /* Move the argument pointer */ finit /* initialize fpu */ fwait @@ -46,7 +46,7 @@ _start: _haltproc: movl $1,%eax /* exit call */ xorl %ebx,%ebx - movw U_SYSLINUX_EXITCODE,%bx + movw U_SYSTEM_EXITCODE,%bx int $0x80 jmp _haltproc @@ -63,28 +63,9 @@ ___fpc_brk_addr: # # $Log$ -# Revision 1.1 2000-07-13 06:30:55 michael +# Revision 1.2 2000-10-15 09:09:24 peter +# * startup code also needed syslinux->system updates +# +# Revision 1.1 2000/07/13 06:30:55 michael # + Initial import # -# Revision 1.9 2000/02/08 12:39:48 peter -# * removed curbrk -# -# Revision 1.8 2000/01/07 16:41:42 daniel -# * copyright 2000 -# -# Revision 1.7 2000/01/07 16:32:28 daniel -# * copyright 2000 added -# -# Revision 1.6 1999/11/08 23:07:48 peter -# * removed aout entries -# -# Revision 1.5 1998/11/04 10:16:29 peter -# + xorl ebp,ebp to indicate end of backtrace -# -# Revision 1.4 1998/10/14 21:28:50 peter -# * initialize fpu so sigfpe is finally generated for fpu errors -# -# Revision 1.3 1998/08/08 14:42:12 peter -# * added missing ___fpc_sbrk and logs -# -# diff --git a/rtl/linux/i386/prt0_10.as b/rtl/linux/i386/prt0_10.as new file mode 100644 index 0000000000..4fd220bbb2 --- /dev/null +++ b/rtl/linux/i386/prt0_10.as @@ -0,0 +1,69 @@ +# +# $Id$ +# 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 */ + popl %ecx + movl %esp,%ebx /* Points to the arguments */ + movl %ecx,%eax + incl %eax + shll $2,%eax + addl %esp,%eax + andl $0xfffffff8,%esp /* Align stack */ + + movl %eax,U_SYSLINUX_ENVP /* Move the environment pointer */ + movl %ecx,U_SYSLINUX_ARGC /* Move the argument counter */ + movl %ebx,U_SYSLINUX_ARGV /* Move the argument pointer */ + + finit /* initialize fpu */ + fwait + fldcw ___fpucw + + xorl %ebp,%ebp + call PASCALMAIN + + .globl _haltproc + .type _haltproc,@function +_haltproc: + movl $1,%eax /* exit call */ + xorl %ebx,%ebx + movw U_SYSLINUX_EXITCODE,%bx + int $0x80 + jmp _haltproc + +.data + .align 4 +___fpucw: + .long 0x1332 + + .globl ___fpc_brk_addr /* heap management */ + .type ___fpc_brk_addr,@object + .size ___fpc_brk_addr,4 +___fpc_brk_addr: + .long 0 + +# +# $Log$ +# Revision 1.1 2000-10-15 09:09:24 peter +# * startup code also needed syslinux->system updates +# +# \ No newline at end of file