mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 23:19:29 +02:00
* use the actual _haltproc procedure, defined in the startup code on OpenBSD
* fixed the x86_64 syscall invocation in the OpenBSD _haltproc git-svn-id: trunk@41762 -
This commit is contained in:
parent
7638a9b7e1
commit
01669ebf70
@ -105,17 +105,25 @@ end;
|
||||
procedure normalexit(status: cint); cdecl; external 'c' name 'exit';
|
||||
{$endif}
|
||||
|
||||
{$if defined(openbsd)}
|
||||
procedure haltproc; cdecl; external name '_haltproc';
|
||||
{$endif}
|
||||
|
||||
procedure System_exit;
|
||||
{$ifndef darwin}
|
||||
begin
|
||||
Fpexit(cint(ExitCode));
|
||||
end;
|
||||
{$else darwin}
|
||||
{$if defined(darwin)}
|
||||
begin
|
||||
{ make sure the libc atexit handlers are called, needed for e.g. profiling }
|
||||
normalexit(cint(ExitCode));
|
||||
end;
|
||||
{$endif darwin}
|
||||
{$elseif defined(openbsd)}
|
||||
begin
|
||||
haltproc;
|
||||
end;
|
||||
{$else}
|
||||
begin
|
||||
Fpexit(cint(ExitCode));
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
||||
Function ParamCount: Longint;
|
||||
|
@ -127,21 +127,9 @@ ___start:
|
||||
|
||||
_haltproc:
|
||||
movq $1,%rax
|
||||
movzwq operatingsystem_result(%rip),%rbx
|
||||
pushq %rbx
|
||||
call .Lactualsyscall
|
||||
addq $8,%rsp
|
||||
movzwq operatingsystem_result(%rip),%rdi
|
||||
syscall
|
||||
jmp _haltproc
|
||||
|
||||
.Lactualsyscall:
|
||||
int $0x80
|
||||
jb .LErrorcode
|
||||
xor %rbx,%rbx
|
||||
ret
|
||||
.LErrorcode:
|
||||
movq %rax,%rbx
|
||||
movq $-1,%rax
|
||||
ret
|
||||
.LFE9:
|
||||
.size ___start, .-___start
|
||||
.type _strrchr, @function
|
||||
|
@ -68,20 +68,9 @@ procedure _FPC_proc___start(argc: LongInt; argv: PPChar; envp: Pointer; para1, p
|
||||
procedure _FPC_proc_haltproc; assembler; nostackframe; public name '_haltproc';
|
||||
asm
|
||||
movq $1,%rax
|
||||
movl operatingsystem_result(%rip),%ebx
|
||||
pushq %rbx
|
||||
call .Lactualsyscall
|
||||
addq $8,%rsp
|
||||
movl operatingsystem_result(%rip),%edi
|
||||
syscall
|
||||
jmp _FPC_proc_haltproc
|
||||
|
||||
.Lactualsyscall:
|
||||
int $0x80
|
||||
jb .LErrorcode
|
||||
xor %rbx,%rbx
|
||||
ret
|
||||
.LErrorcode:
|
||||
movq %rax,%rbx
|
||||
movq $-1,%rax
|
||||
end;
|
||||
|
||||
function _strrchr(str: PChar; character: LongInt): PChar; public name '_strrchr';
|
||||
|
Loading…
Reference in New Issue
Block a user