mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 23:19:24 +02:00
* initial implementation of c startup code for sparc64-linux
git-svn-id: trunk@36673 -
This commit is contained in:
parent
bd57ca99a8
commit
8ce6140476
@ -24,9 +24,6 @@ procedure libc_init; external name '__libc_init';
|
||||
procedure libc_setfpucw; external name '__setfpucw';
|
||||
procedure libc_start_main; external name '__libc_start_main';
|
||||
|
||||
const
|
||||
BIAS = 2047;
|
||||
|
||||
function fpc_getgot : pointer; [external name 'FPC_GETGOT'];
|
||||
|
||||
{******************************************************************************
|
||||
@ -35,11 +32,85 @@ function fpc_getgot : pointer; [external name 'FPC_GETGOT'];
|
||||
|
||||
procedure _FPC_libc_start; assembler; nostackframe; public name '_start';
|
||||
asm
|
||||
{ first stack frame }
|
||||
mov %g0, %fp
|
||||
{ space for arguments }
|
||||
sub %sp, 6*8, %sp
|
||||
{$ifdef FPC_PIC}
|
||||
call FPC_GETGOT
|
||||
nop
|
||||
{$endif FPC_PIC}
|
||||
{ extract argc }
|
||||
ldx [%sp+STACK_BIAS+22*8], %o2
|
||||
{$ifdef FPC_PIC}
|
||||
{$else FPC_PIC}
|
||||
sethi %hi(operatingsystem_parameter_argc),%o1
|
||||
or %o1,%lo(operatingsystem_parameter_argc),%o1
|
||||
{$endif FPC_PIC}
|
||||
st %o2, [%o1]
|
||||
{ extract argv }
|
||||
{$ifdef FPC_PIC}
|
||||
{$else FPC_PIC}
|
||||
add %sp, STACK_BIAS+23*8, %o0
|
||||
sethi %hi(operatingsystem_parameter_argv),%o1
|
||||
or %o1,%lo(operatingsystem_parameter_argv),%o1
|
||||
{$endif FPC_PIC}
|
||||
stx %o0, [%o1]
|
||||
|
||||
{ envp=argv+(argc+1)*8 }
|
||||
inc %o2
|
||||
sllx %o2, 3, %o2
|
||||
add %o2, %o0, %o2
|
||||
{$ifdef FPC_PIC}
|
||||
{$else FPC_PIC}
|
||||
sethi %hi(operatingsystem_parameter_envp),%o1
|
||||
or %o1,%lo(operatingsystem_parameter_envp),%o1
|
||||
{$endif FPC_PIC}
|
||||
stx %o2, [%o1]
|
||||
|
||||
{ Save initial stackpointer }
|
||||
{$ifdef FPC_PIC}
|
||||
{$else FPC_PIC}
|
||||
sethi %hi(initialstkptr),%o1
|
||||
or %o1,%lo(initialstkptr),%o1
|
||||
{$endif FPC_PIC}
|
||||
stx %sp, [%o1]
|
||||
|
||||
{ prepare parameters to call __libc_start_main }
|
||||
ldx [%sp+STACK_BIAS+22*8], %o1
|
||||
add %sp, STACK_BIAS+23*8, %o0
|
||||
|
||||
{$ifdef FPC_PIC}
|
||||
{$else FPC_PIC}
|
||||
sethi %hi(PASCALMAIN), %o0
|
||||
or %o0, %lo(PASCALMAIN), %o0
|
||||
{$endif FPC_PIC}
|
||||
|
||||
{$ifdef FPC_PIC}
|
||||
{$else FPC_PIC}
|
||||
sethi %hi(libc_init_proc), %o3
|
||||
or %o3, %lo(libc_init_proc), %o3
|
||||
{$endif FPC_PIC}
|
||||
|
||||
{$ifdef FPC_PIC}
|
||||
{$else FPC_PIC}
|
||||
sethi %hi(libc_fini_proc), %o4
|
||||
or %o4, %lo(libc_fini_proc), %o4
|
||||
{$endif FPC_PIC}
|
||||
|
||||
{ shared library termination function }
|
||||
mov %g1, %o5
|
||||
|
||||
call libc_start_main
|
||||
nop
|
||||
|
||||
{ we shuld never return here }
|
||||
unimp
|
||||
end;
|
||||
|
||||
|
||||
procedure _FPC_libc_haltproc(e: longint); cdecl; public name '_haltproc';
|
||||
begin
|
||||
libc_exit(e);
|
||||
{ try to exit_group }
|
||||
while true do
|
||||
asm
|
||||
|
Loading…
Reference in New Issue
Block a user