mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 05:59:30 +02:00
- i386-linux RTL: removed assembler startup files, which are unused since version 2.0.x.
git-svn-id: trunk@32972 -
This commit is contained in:
parent
1aec09f8cd
commit
7381c66161
6
.gitattributes
vendored
6
.gitattributes
vendored
@ -8922,12 +8922,6 @@ rtl/linux/errnostr.inc svneol=native#text/plain
|
||||
rtl/linux/fpcylix.pp svneol=native#text/plain
|
||||
rtl/linux/fpmake.inc svneol=native#text/plain
|
||||
rtl/linux/i386/bsyscall.inc svneol=native#text/plain
|
||||
rtl/linux/i386/cprt0.as svneol=native#text/plain
|
||||
rtl/linux/i386/cprt21.as svneol=native#text/plain
|
||||
rtl/linux/i386/dllprt0.as svneol=native#text/plain
|
||||
rtl/linux/i386/gprt0.as svneol=native#text/plain
|
||||
rtl/linux/i386/gprt21.as svneol=native#text/plain
|
||||
rtl/linux/i386/prt0.as svneol=native#text/plain
|
||||
rtl/linux/i386/si_c.inc svneol=native#text/plain
|
||||
rtl/linux/i386/si_c21.inc svneol=native#text/plain
|
||||
rtl/linux/i386/si_c21g.inc svneol=native#text/plain
|
||||
|
@ -344,11 +344,7 @@ CPU_UNITS=
|
||||
SYSINIT_UNITS=
|
||||
LOADERS=prt0 dllprt0 cprt0 gprt0
|
||||
ifeq ($(ARCH),i386)
|
||||
ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
|
||||
override LOADERS=
|
||||
else
|
||||
override LOADERS+=cprt21 gprt21
|
||||
endif
|
||||
CPU_UNITS=x86 ports cpu mmx
|
||||
SYSINIT_UNITS=si_prc si_c21g si_c21 si_c si_dll si_uc
|
||||
endif
|
||||
|
@ -65,11 +65,7 @@ SYSINIT_UNITS=
|
||||
LOADERS=prt0 dllprt0 cprt0 gprt0
|
||||
|
||||
ifeq ($(ARCH),i386)
|
||||
ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
|
||||
override LOADERS=
|
||||
else
|
||||
override LOADERS+=cprt21 gprt21
|
||||
endif
|
||||
CPU_UNITS=x86 ports cpu mmx
|
||||
SYSINIT_UNITS=si_prc si_c21g si_c21 si_c si_dll si_uc
|
||||
endif
|
||||
|
@ -1,109 +0,0 @@
|
||||
#
|
||||
# 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
|
||||
#
|
||||
#
|
||||
# Stack layout at program start:
|
||||
#
|
||||
# nil
|
||||
# envn
|
||||
# ....
|
||||
# .... ENVIRONMENT VARIABLES
|
||||
# env1
|
||||
# env0
|
||||
# nil
|
||||
# argn
|
||||
# ....
|
||||
# .... COMMAND LINE OPTIONS
|
||||
# arg1
|
||||
# arg0
|
||||
# argc <--- esp
|
||||
#
|
||||
|
||||
.file "cprt0.as"
|
||||
.text
|
||||
.globl _start
|
||||
.type _start,@function
|
||||
_start:
|
||||
/* First locate the start of the environment variables */
|
||||
popl %ecx /* Get argc in ecx */
|
||||
movl %esp,%ebx /* Esp now points to the arguments */
|
||||
leal 4(%esp,%ecx,4),%eax /* The start of the environment is: esp+4*eax+8 */
|
||||
andl $0xfffffff8,%esp /* Align stack */
|
||||
|
||||
movl %eax,operatingsystem_parameter_envp /* Move the environment pointer */
|
||||
movl %ecx,operatingsystem_parameter_argc /* Move the argument counter */
|
||||
movl %ebx,operatingsystem_parameter_argv /* Move the argument pointer */
|
||||
|
||||
movl %eax,__environ /* libc environ */
|
||||
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
|
||||
call __libc_init /* init libc */
|
||||
movzwl __fpu_control,%eax
|
||||
pushl %eax
|
||||
call __setfpucw
|
||||
popl %eax
|
||||
pushl $_fini
|
||||
call atexit
|
||||
popl %eax
|
||||
call _init
|
||||
|
||||
popl %eax
|
||||
popl %eax
|
||||
|
||||
/* Save initial stackpointer */
|
||||
movl %esp,__stkptr
|
||||
|
||||
xorl %ebp,%ebp
|
||||
call PASCALMAIN /* start the program */
|
||||
|
||||
.globl _haltproc
|
||||
.type _haltproc,@function
|
||||
_haltproc:
|
||||
_haltproc2: # GAS <= 2.15 bug: generates larger jump if a label is exported
|
||||
movzwl operatingsystem_result,%ebx
|
||||
pushl %ebx
|
||||
call exit
|
||||
xorl %eax,%eax
|
||||
incl %eax /* eax=1, exit call */
|
||||
popl %ebx
|
||||
int $0x80
|
||||
jmp _haltproc2
|
||||
|
||||
.data
|
||||
|
||||
.bss
|
||||
.type __stkptr,@object
|
||||
.size __stkptr,4
|
||||
.global __stkptr
|
||||
__stkptr:
|
||||
.skip 4
|
||||
|
||||
.type operatingsystem_parameters,@object
|
||||
.size operatingsystem_parameters,12
|
||||
operatingsystem_parameters:
|
||||
.skip 3*4
|
||||
|
||||
.global operatingsystem_parameter_envp
|
||||
.global operatingsystem_parameter_argc
|
||||
.global operatingsystem_parameter_argv
|
||||
.set operatingsystem_parameter_envp,operatingsystem_parameters+0
|
||||
.set operatingsystem_parameter_argc,operatingsystem_parameters+4
|
||||
.set operatingsystem_parameter_argv,operatingsystem_parameters+8
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
@ -1,125 +0,0 @@
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# Stack layout at program start:
|
||||
#
|
||||
# nil
|
||||
# envn
|
||||
# ....
|
||||
# .... ENVIRONMENT VARIABLES
|
||||
# env1
|
||||
# env0
|
||||
# nil
|
||||
# argn
|
||||
# ....
|
||||
# .... COMMAND LINE OPTIONS
|
||||
# arg1
|
||||
# arg0
|
||||
# argc <--- esp
|
||||
#
|
||||
|
||||
.file "prt1.as"
|
||||
.text
|
||||
.globl _start
|
||||
.type _start,@function
|
||||
_start:
|
||||
/* First locate the start of the environment variables */
|
||||
|
||||
popl %esi
|
||||
|
||||
movl %esp,%ebx /* Points to the arguments */
|
||||
movl %esi,%eax
|
||||
incl %eax
|
||||
shll $2,%eax
|
||||
addl %esp,%eax
|
||||
andl $0xfffffff0,%esp /* Align stack to 16 bytes */
|
||||
|
||||
movl %eax,operatingsystem_parameter_envp /* Move the environment pointer */
|
||||
movl %esi,operatingsystem_parameter_argc /* Move the argument counter */
|
||||
movl %ebx,operatingsystem_parameter_argv /* Move the argument pointer */
|
||||
|
||||
xorl %ebp,%ebp
|
||||
pushl %edi /* __libc_start_main takes 7 arguments -> push 1 extra to keep 16 byte stack alignment */
|
||||
pushl %esp
|
||||
pushl %edx
|
||||
pushl $_fini_dummy
|
||||
pushl $_init_dummy
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl $main
|
||||
call __libc_start_main
|
||||
hlt
|
||||
|
||||
/* fake main routine which will be run from libc */
|
||||
main:
|
||||
/* save return address */
|
||||
popl %eax
|
||||
movl %eax,___fpc_ret
|
||||
movl %ebx,___fpc_ret_ebx
|
||||
movl %ebp,___fpc_ret_ebp
|
||||
pushl %eax
|
||||
|
||||
/* Save initial stackpointer */
|
||||
movl %esp,__stkptr
|
||||
|
||||
/* start the program */
|
||||
xorl %ebp,%ebp
|
||||
/* jmp to keep stack alignment */
|
||||
jmp PASCALMAIN
|
||||
|
||||
.globl _haltproc
|
||||
.type _haltproc,@function
|
||||
_haltproc:
|
||||
movzwl operatingsystem_result,%eax
|
||||
|
||||
movl ___fpc_ret,%edx /* return to libc */
|
||||
movl ___fpc_ret_ebp,%ebp
|
||||
movl ___fpc_ret_ebx,%ebx
|
||||
push %edx
|
||||
_init_dummy:
|
||||
_fini_dummy:
|
||||
ret
|
||||
|
||||
.data
|
||||
.align 4
|
||||
|
||||
___fpc_ret: /* return address to libc */
|
||||
.long 0
|
||||
___fpc_ret_ebx:
|
||||
.long 0
|
||||
___fpc_ret_ebp:
|
||||
.long 0
|
||||
|
||||
.bss
|
||||
.type __stkptr,@object
|
||||
.size __stkptr,4
|
||||
.global __stkptr
|
||||
__stkptr:
|
||||
.skip 4
|
||||
|
||||
.type operatingsystem_parameters,@object
|
||||
.size operatingsystem_parameters,12
|
||||
operatingsystem_parameters:
|
||||
.skip 3*4
|
||||
|
||||
.global operatingsystem_parameter_envp
|
||||
.global operatingsystem_parameter_argc
|
||||
.global operatingsystem_parameter_argv
|
||||
.set operatingsystem_parameter_envp,operatingsystem_parameters+0
|
||||
.set operatingsystem_parameter_argc,operatingsystem_parameters+4
|
||||
.set operatingsystem_parameter_argv,operatingsystem_parameters+8
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
@ -1,78 +0,0 @@
|
||||
#
|
||||
# This file is part of the Free Pascal run time library.
|
||||
# Copyright (c) 2001 by Peter Vreman
|
||||
#
|
||||
# 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 shared library startup code for Free Pascal
|
||||
#
|
||||
|
||||
.file "dllprt0.as"
|
||||
.text
|
||||
.globl _startlib
|
||||
.type _startlib,@function
|
||||
_startlib:
|
||||
.globl FPC_SHARED_LIB_START
|
||||
.type FPC_SHARED_LIB_START,@function
|
||||
FPC_SHARED_LIB_START:
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
subl $8, %esp /* align back to 16 bytes if it was before the call */
|
||||
|
||||
movl 8(%ebp),%eax
|
||||
movl 12(%ebp),%ecx
|
||||
movl 16(%ebp),%edx
|
||||
|
||||
movl %edx,operatingsystem_parameter_envp /* Move the environment pointer */
|
||||
movl %eax,operatingsystem_parameter_argc /* Move the argument counter */
|
||||
movl %ecx,operatingsystem_parameter_argv /* Move the argument pointer */
|
||||
|
||||
movb $1,operatingsystem_islibrary
|
||||
|
||||
/* Save initial stackpointer */
|
||||
movl %esp,__stkptr
|
||||
|
||||
call PASCALMAIN
|
||||
|
||||
leave
|
||||
ret
|
||||
|
||||
.globl _haltproc
|
||||
.type _haltproc,@function
|
||||
_haltproc:
|
||||
_haltproc2: # GAS <= 2.15 bug: generates larger jump if a label is exported
|
||||
subl $12, %esp /* align back to 16 bytes if it was before the call */
|
||||
call lib_exit
|
||||
xorl %eax,%eax
|
||||
incl %eax /* eax=1, exit call */
|
||||
movzwl operatingsystem_result,%ebx
|
||||
int $0x80
|
||||
jmp _haltproc2
|
||||
|
||||
.bss
|
||||
.type __stkptr,@object
|
||||
.size __stkptr,4
|
||||
.global __stkptr
|
||||
__stkptr:
|
||||
.skip 4
|
||||
|
||||
.type operatingsystem_parameters,@object
|
||||
.size operatingsystem_parameters,12
|
||||
operatingsystem_parameters:
|
||||
.skip 3*4
|
||||
|
||||
.global operatingsystem_parameter_envp
|
||||
.global operatingsystem_parameter_argc
|
||||
.global operatingsystem_parameter_argv
|
||||
.set operatingsystem_parameter_envp,operatingsystem_parameters+0
|
||||
.set operatingsystem_parameter_argc,operatingsystem_parameters+4
|
||||
.set operatingsystem_parameter_argv,operatingsystem_parameters+8
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
@ -1,91 +0,0 @@
|
||||
#
|
||||
# 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 with profiling support for Free Pascal
|
||||
# Note: Needs linking with -lgmon and -lc
|
||||
#
|
||||
|
||||
.file "gprt1.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,operatingsystem_parameter_envp /* Move the environment pointer */
|
||||
movl %ecx,operatingsystem_parameter_argc /* Move the argument counter */
|
||||
movl %ebx,operatingsystem_parameter_argv /* Move the argument pointer */
|
||||
|
||||
finit /* initialize fpu */
|
||||
fwait
|
||||
fldcw ___fpucw
|
||||
|
||||
pushl $_etext /* Initialize gmon */
|
||||
pushl $_start
|
||||
call monstartup
|
||||
addl $8,%esp
|
||||
pushl $_mcleanup
|
||||
call atexit
|
||||
addl $4,%esp
|
||||
|
||||
/* Save initial stackpointer */
|
||||
movl %esp,__stkptr
|
||||
|
||||
xorl %ebp,%ebp
|
||||
call PASCALMAIN
|
||||
|
||||
.globl _haltproc
|
||||
.type _haltproc,@function
|
||||
_haltproc:
|
||||
_haltproc2: # GAS <= 2.15 bug: generates larger jump if a label is exported
|
||||
movzwl operatingsystem_result,%ebx
|
||||
pushl %ebx
|
||||
call exit /* call libc exit, this will */
|
||||
/* write the gmon.out */
|
||||
movl $252,%eax /* exit_group */
|
||||
popl %ebx
|
||||
int $0x80
|
||||
jmp _haltproc2
|
||||
|
||||
.data
|
||||
___fpucw:
|
||||
.long 0x1332
|
||||
|
||||
.bss
|
||||
.type __stkptr,@object
|
||||
.size __stkptr,4
|
||||
.global __stkptr
|
||||
__stkptr:
|
||||
.skip 4
|
||||
|
||||
.type operatingsystem_parameters,@object
|
||||
.size operatingsystem_parameters,12
|
||||
operatingsystem_parameters:
|
||||
.skip 3*4
|
||||
|
||||
.global operatingsystem_parameter_envp
|
||||
.global operatingsystem_parameter_argc
|
||||
.global operatingsystem_parameter_argv
|
||||
.set operatingsystem_parameter_envp,operatingsystem_parameters+0
|
||||
.set operatingsystem_parameter_argc,operatingsystem_parameters+4
|
||||
.set operatingsystem_parameter_argv,operatingsystem_parameters+8
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
@ -1,143 +0,0 @@
|
||||
#
|
||||
# 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 %esi
|
||||
|
||||
movl %esp,%ebx /* Points to the arguments */
|
||||
movl %esi,%eax
|
||||
incl %eax
|
||||
shll $2,%eax
|
||||
addl %esp,%eax
|
||||
andl $0xfffffff0,%esp /* Align stack to 16 bytes */
|
||||
|
||||
movl %eax,operatingsystem_parameter_envp /* Move the environment pointer */
|
||||
movl %esi,operatingsystem_parameter_argc /* Move the argument counter */
|
||||
movl %ebx,operatingsystem_parameter_argv /* Move the argument pointer */
|
||||
|
||||
xorl %ebp,%ebp
|
||||
pushl %eax /* __libc_start_main takes 7 arguments -> push 1 extra to keep 16 byte stack alignment */
|
||||
pushl %esp
|
||||
pushl %edx
|
||||
pushl $_fini_dummy
|
||||
pushl $_init_dummy
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl $cmain
|
||||
call __libc_start_main
|
||||
hlt
|
||||
|
||||
/* fake main routine which will be run from libc */
|
||||
cmain:
|
||||
/* save return address */
|
||||
popl %eax
|
||||
movl %eax,___fpc_ret
|
||||
movl %ebx,___fpc_ret_ebx
|
||||
movl %esi,___fpc_ret_esi
|
||||
movl %edi,___fpc_ret_edi
|
||||
pushl %eax
|
||||
|
||||
/* align stack to 16 bytes before call */
|
||||
subl $12, %esp
|
||||
|
||||
call __gmon_start__
|
||||
|
||||
/* restore stack */
|
||||
addl $12, %esp
|
||||
|
||||
/* Save initial stackpointer */
|
||||
movl %esp,__stkptr
|
||||
|
||||
/* start the program (jmp to keep stack alignment) */
|
||||
jmp PASCALMAIN
|
||||
hlt
|
||||
|
||||
.globl _haltproc
|
||||
.type _haltproc,@function
|
||||
_haltproc:
|
||||
movzwl operatingsystem_result,%eax
|
||||
|
||||
movl ___fpc_ret,%edx /* return to libc */
|
||||
movl ___fpc_ret_ebx,%ebx
|
||||
movl ___fpc_ret_esi,%esi
|
||||
movl ___fpc_ret_edi,%edi
|
||||
push %edx
|
||||
_init_dummy:
|
||||
_fini_dummy:
|
||||
ret
|
||||
|
||||
.globl __gmon_start__
|
||||
.type __gmon_start__,@function
|
||||
__gmon_start__:
|
||||
pushl %ebp
|
||||
movl __monstarted,%eax
|
||||
leal 0x1(%eax),%edx
|
||||
movl %esp,%ebp
|
||||
movl %edx,__monstarted
|
||||
testl %eax,%eax
|
||||
jnz .Lnomonstart
|
||||
pushl $etext /* Initialize gmon */
|
||||
pushl $_start
|
||||
call monstartup
|
||||
addl $8,%esp
|
||||
pushl $_mcleanup
|
||||
call atexit
|
||||
addl $4,%esp
|
||||
.Lnomonstart:
|
||||
movl %ebp,%esp
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
.data
|
||||
.align 4
|
||||
|
||||
___fpc_ret: /* return address to libc */
|
||||
.long 0
|
||||
___fpc_ret_ebx:
|
||||
.long 0
|
||||
___fpc_ret_esi:
|
||||
.long 0
|
||||
___fpc_ret_edi:
|
||||
.long 0
|
||||
|
||||
.bss
|
||||
.lcomm __monstarted,4
|
||||
|
||||
.type __stkptr,@object
|
||||
.size __stkptr,4
|
||||
.global __stkptr
|
||||
__stkptr:
|
||||
.skip 4
|
||||
|
||||
.type operatingsystem_parameters,@object
|
||||
.size operatingsystem_parameters,12
|
||||
operatingsystem_parameters:
|
||||
.skip 3*4
|
||||
|
||||
.global operatingsystem_parameter_envp
|
||||
.global operatingsystem_parameter_argc
|
||||
.global operatingsystem_parameter_argv
|
||||
.set operatingsystem_parameter_envp,operatingsystem_parameters+0
|
||||
.set operatingsystem_parameter_argc,operatingsystem_parameters+4
|
||||
.set operatingsystem_parameter_argv,operatingsystem_parameters+8
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
@ -1,112 +0,0 @@
|
||||
#
|
||||
# This file is part of the Free Pascal run time library.
|
||||
# Copyright (c) 1999-2004 by Michael Van Canneyt, Peter Vreman,
|
||||
# & Daniel Mantione, 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
|
||||
#
|
||||
# The code in this file is the default startup code, it is used unless
|
||||
# libc is linked in, profiling is enabled or you are compiling a shared
|
||||
# library.
|
||||
#
|
||||
#
|
||||
# Stack layout at program start:
|
||||
#
|
||||
# nil
|
||||
# envn
|
||||
# ....
|
||||
# .... ENVIRONMENT VARIABLES
|
||||
# env1
|
||||
# env0
|
||||
# nil
|
||||
# argn
|
||||
# ....
|
||||
# .... COMMAND LINE OPTIONS
|
||||
# arg1
|
||||
# arg0
|
||||
# argc <--- esp
|
||||
#
|
||||
|
||||
.file "prt0.as"
|
||||
.text
|
||||
.globl _start
|
||||
.type _start,@function
|
||||
_start:
|
||||
/* First locate the start of the environment variables */
|
||||
popl %ecx /* Get argc in ecx */
|
||||
movl %esp,%ebx /* Esp now points to the arguments */
|
||||
leal 4(%esp,%ecx,4),%eax /* The start of the environment is: esp+4*eax+4 */
|
||||
andl $0xfffffff0,%esp /* Align stack to 16 bytes */
|
||||
|
||||
leal operatingsystem_parameters,%edi
|
||||
stosl /* Move the environment pointer */
|
||||
xchg %ecx,%eax
|
||||
stosl /* Move the argument counter */
|
||||
xchg %ebx,%eax
|
||||
stosl /* Move the argument pointer */
|
||||
|
||||
|
||||
fninit /* initialize fpu */
|
||||
fwait
|
||||
fldcw ___fpucw
|
||||
|
||||
# /* Initialize gs for thread local storage */
|
||||
# movw %ds,%ax
|
||||
# movw %ax,%gs
|
||||
|
||||
/* Save initial stackpointer */
|
||||
movl %esp,__stkptr
|
||||
|
||||
xorl %ebp,%ebp
|
||||
call PASCALMAIN
|
||||
|
||||
.globl _haltproc
|
||||
.type _haltproc,@function
|
||||
_haltproc:
|
||||
_haltproc2: # GAS <= 2.15 bug: generates larger jump if a label is exported
|
||||
movl $252,%eax /* exit_group */
|
||||
movzwl operatingsystem_result,%ebx
|
||||
int $0x80
|
||||
movl $1,%eax /* exit */
|
||||
movzwl operatingsystem_result,%ebx
|
||||
int $0x80
|
||||
jmp _haltproc2
|
||||
|
||||
.data
|
||||
.type __fpucw,@object
|
||||
.size __fpucw,4
|
||||
.global __fpucw
|
||||
___fpucw:
|
||||
.long 0x1332
|
||||
|
||||
.bss
|
||||
.type __stkptr,@object
|
||||
.size __stkptr,4
|
||||
.global __stkptr
|
||||
__stkptr:
|
||||
.skip 4
|
||||
|
||||
.type operatingsystem_parameters,@object
|
||||
.size operatingsystem_parameters,12
|
||||
operatingsystem_parameters:
|
||||
.skip 3*4
|
||||
|
||||
.global operatingsystem_parameter_envp
|
||||
.global operatingsystem_parameter_argc
|
||||
.global operatingsystem_parameter_argv
|
||||
.set operatingsystem_parameter_envp,operatingsystem_parameters+0
|
||||
.set operatingsystem_parameter_argc,operatingsystem_parameters+4
|
||||
.set operatingsystem_parameter_argv,operatingsystem_parameters+8
|
||||
|
||||
//.section .threadvar,"aw",@nobits
|
||||
.comm ___fpc_threadvar_offset,4
|
||||
.section .note.GNU-stack,"",%progbits
|
Loading…
Reference in New Issue
Block a user