mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-25 18:01:53 +02:00
* patch from Christopher Key (via Alonso Cardenas Marquez) to fix mmap
syscall. Recent versions of FreeBSD check the seventh parameter, and
that code wasn't correct in FPC.
git-svn-id: trunk@15785 -
This commit is contained in:
parent
8e8a573707
commit
c59973d149
@ -94,7 +94,7 @@ Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
{$ifdef CPU64}
|
{$ifdef CPU64}
|
||||||
Fpmmap:=pointer(ptruint(do__syscall(TSysParam(syscall_nr_mmap),TSysParam(Start),TSysParam(Len),TSysParam(Prot),TSysParam(Flags),TSysParam(fd),TSysParam(offst),0,0)));
|
Fpmmap:=pointer(ptruint(do_syscall(TSysParam(syscall_nr_mmap),TSysParam(Start),TSysParam(Len),TSysParam(Prot),TSysParam(Flags),TSysParam(fd),0,TSysParam(offst))));
|
||||||
{$else}
|
{$else}
|
||||||
Fpmmap:=pointer(ptruint(do_syscall(syscall_nr_mmap,TSysParam(Start),Len,Prot,Flags,fd,
|
Fpmmap:=pointer(ptruint(do_syscall(syscall_nr_mmap,TSysParam(Start),Len,Prot,Flags,fd,
|
||||||
{$ifdef FPC_BIG_ENDIAN} hi(offst),lo(offst){$endif}
|
{$ifdef FPC_BIG_ENDIAN} hi(offst),lo(offst){$endif}
|
||||||
|
|||||||
@ -219,7 +219,6 @@ asm
|
|||||||
.LSyscOK:
|
.LSyscOK:
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function fpsysCall(sysnr,param1,param2,param3,param4,param5,param6 : TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS6'];
|
function fpsysCall(sysnr,param1,param2,param3,param4,param5,param6 : TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS6'];
|
||||||
|
|
||||||
asm
|
asm
|
||||||
@ -232,7 +231,6 @@ asm
|
|||||||
movq param6,%r9
|
movq param6,%r9
|
||||||
syscall { Do the system call. }
|
syscall { Do the system call. }
|
||||||
jnb .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
jnb .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||||
|
|
||||||
movq %rax,%rdx
|
movq %rax,%rdx
|
||||||
{$ifdef FPC_PIC}
|
{$ifdef FPC_PIC}
|
||||||
movq fpc_threadvar_relocate_proc@GOTPCREL(%rip),%rax
|
movq fpc_threadvar_relocate_proc@GOTPCREL(%rip),%rax
|
||||||
@ -257,50 +255,11 @@ asm
|
|||||||
.LSyscOK:
|
.LSyscOK:
|
||||||
|
|
||||||
end;
|
end;
|
||||||
// edi esi edx ecx r8 r9 stack
|
|
||||||
function fp_sysCall(sysnr,param1,param2,param3,param4,param5,param6 : TSysParam):TSysResult; assembler;[public,alias:'FPC__DOSYS'];
|
function fp_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7 : TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS7'];
|
||||||
|
|
||||||
asm
|
asm
|
||||||
movq sysnr,%rax { Syscall number -> rax. }
|
subq $0x10,%rsp
|
||||||
movq param1,%rdi { shift arg1 - arg6. }
|
|
||||||
movq param2,%rsi
|
|
||||||
movq param3,%rdx
|
|
||||||
movq param4,%r10
|
|
||||||
movq param5,%r8
|
|
||||||
movq param6,%r9
|
|
||||||
syscall { Do the system call. }
|
|
||||||
jnb .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
|
||||||
movq %rax,%rdx
|
|
||||||
{$ifdef FPC_PIC}
|
|
||||||
movq fpc_threadvar_relocate_proc@GOTPCREL(%rip),%rax
|
|
||||||
movq (%rax),%rax
|
|
||||||
movq Errno@GOTPCREL(%rip),%r11
|
|
||||||
{$else FPC_PIC}
|
|
||||||
movq fpc_threadvar_relocate_proc,%rax
|
|
||||||
leaq Errno,%r11
|
|
||||||
{$endif FPC_PIC}
|
|
||||||
testq %rax,%rax
|
|
||||||
jne .LThread
|
|
||||||
movl %edx,8(%r11)
|
|
||||||
jmp .LNoThread
|
|
||||||
.LThread:
|
|
||||||
pushq %rdx
|
|
||||||
movq (%r11),%rdi
|
|
||||||
call *%rax
|
|
||||||
popq %rdx
|
|
||||||
movl %edx,(%rax)
|
|
||||||
.LNoThread:
|
|
||||||
movq $-1,%rax
|
|
||||||
.LSyscOK:
|
|
||||||
add $0x18,%rsp
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
// edi esi edx ecx r8 r9 stack stack
|
|
||||||
function fp_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7 : TSysParam):TSysResult; assembler;[public,alias:'FPC__DOSYS7'];
|
|
||||||
|
|
||||||
asm
|
|
||||||
sub $0x10,%rsp
|
|
||||||
movq sysnr,%rax { Syscall number -> rax. }
|
movq sysnr,%rax { Syscall number -> rax. }
|
||||||
movq param1,%rdi { shift arg1 - arg6. }
|
movq param1,%rdi { shift arg1 - arg6. }
|
||||||
movq param2,%rsi
|
movq param2,%rsi
|
||||||
@ -309,7 +268,7 @@ asm
|
|||||||
movq param5,%r8
|
movq param5,%r8
|
||||||
movq param6,%r9
|
movq param6,%r9
|
||||||
movq param7,%r11
|
movq param7,%r11
|
||||||
movq %r11,(%rsp)
|
movq %r11,8(%rsp)
|
||||||
syscall { Do the system call. }
|
syscall { Do the system call. }
|
||||||
jnb .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
jnb .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||||
movq %rax,%rdx
|
movq %rax,%rdx
|
||||||
@ -334,6 +293,6 @@ asm
|
|||||||
.LNoThread:
|
.LNoThread:
|
||||||
movq $-1,%rax
|
movq $-1,%rax
|
||||||
.LSyscOK:
|
.LSyscOK:
|
||||||
add $0x10,%rsp
|
addq $0x10,%rsp
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,5 @@ function do_sysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResu
|
|||||||
function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):int64; external name 'FPC_DOSYS6';
|
function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):int64; external name 'FPC_DOSYS6';
|
||||||
function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):int64; external name 'FPC_DOSYS7';
|
function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):int64; external name 'FPC_DOSYS7';
|
||||||
|
|
||||||
// special
|
|
||||||
function do__sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7,Param8:TSysParam):TSysResult; external name 'FPC__DOSYS';
|
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user