* fixed fork for sparc

This commit is contained in:
florian 2004-08-22 12:34:11 +00:00
parent 877551b144
commit 241587174e
2 changed files with 49 additions and 2 deletions

View File

@ -255,6 +255,7 @@ begin
end;
{$ifndef FPC_SYSTEM_HAS_FPFORK}
function Fpfork : pid_t; [public, alias : 'FPC_SYSC_FORK'];
{
This function issues the 'fork' System call. the program is duplicated in memory
@ -268,6 +269,7 @@ function Fpfork : pid_t; [public, alias : 'FPC_SYSC_FORK'];
Begin
Fpfork:=Do_syscall(SysCall_nr_fork);
End;
{$endif FPC_SYSTEM_HAS_FPFORK}
// Look at execve variants later, when overloaded is determined.
{
@ -543,7 +545,10 @@ end;
{
$Log$
Revision 1.29 2004-08-18 21:03:35 florian
Revision 1.30 2004-08-22 12:34:11 florian
* fixed fork for sparc
Revision 1.29 2004/08/18 21:03:35 florian
* sparc uses wait4 as well
Revision 1.28 2004/05/31 20:25:04 peter

View File

@ -18,6 +18,45 @@
{$UNDEF SYSCALL_DEBUG}
{$ENDIF SYS_LINUX}
{$define FPC_SYSTEM_HAS_FPFORK}
{
behaviour of result of fork on sparc/linux is different than on other
linux flavours
}
function Fpfork : pid_t; [public, alias : 'FPC_SYSC_FORK'];assembler;
asm
mov 2,%g1
ta 0x10
bcc .LSyscOK
nop
sethi %hi(fpc_threadvar_relocate_proc),%o2
or %o2,%lo(fpc_threadvar_relocate_proc),%o2
ld [%o2],%o3
subcc %o3,%g0,%g0
bne .LThread
nop
sethi %hi(Errno+4),%o2
ba .LNoThread
or %o2,%lo(Errno+4),%o2
.LThread:
sethi %hi(Errno),%o0
ld [%o3],%o4
or %o0,%lo(Errno),%o0
call %o4
.LNoThread:
st %o0,[%o2]
ba .LReturn
mov -1,%i0
.LSyscOK:
// o1 contains 1 in the parent
// and 0 in the child
sub %o1, 1, %o1
and %o0, %o1, %i0
.LReturn:
end;
{*****************************************************************************
--- Main:The System Call Self ---
*****************************************************************************}
@ -269,7 +308,10 @@ end;
{
$Log$
Revision 1.13 2004-07-02 19:29:19 peter
Revision 1.14 2004-08-22 12:34:11 florian
* fixed fork for sparc
Revision 1.13 2004/07/02 19:29:19 peter
* fixed errno setting
Revision 1.12 2004/06/30 21:15:51 florian