diff options
author | marco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-08-12 10:56:31 +0000 |
---|---|---|
committer | marco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-08-12 10:56:31 +0000 |
commit | 0f9a295ae61f40ace7ce011beffd753bb63935ce (patch) | |
tree | e26c357fe928cdf268867f500c229279417578bb /rtl/bsd/x86_64 | |
parent | 03022c86dbd3678a5d5a5b606a8d57320614eb3e (diff) | |
download | fpc-0f9a295ae61f40ace7ce011beffd753bb63935ce.tar.gz |
* 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: http://svn.freepascal.org/svn/fpc/trunk@15785 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'rtl/bsd/x86_64')
-rw-r--r-- | rtl/bsd/x86_64/syscall.inc | 49 | ||||
-rw-r--r-- | rtl/bsd/x86_64/syscallh.inc | 2 |
2 files changed, 4 insertions, 47 deletions
diff --git a/rtl/bsd/x86_64/syscall.inc b/rtl/bsd/x86_64/syscall.inc index 1b95196601..a0722f5912 100644 --- a/rtl/bsd/x86_64/syscall.inc +++ b/rtl/bsd/x86_64/syscall.inc @@ -219,7 +219,6 @@ asm .LSyscOK: end; - function fpsysCall(sysnr,param1,param2,param3,param4,param5,param6 : TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS6']; asm @@ -232,7 +231,6 @@ asm 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 @@ -257,50 +255,11 @@ asm .LSyscOK: 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']; - -asm - movq sysnr,%rax { Syscall number -> rax. } - 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']; +function fp_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7 : TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS7']; asm - sub $0x10,%rsp + subq $0x10,%rsp movq sysnr,%rax { Syscall number -> rax. } movq param1,%rdi { shift arg1 - arg6. } movq param2,%rsi @@ -309,7 +268,7 @@ asm movq param5,%r8 movq param6,%r9 movq param7,%r11 - movq %r11,(%rsp) + movq %r11,8(%rsp) syscall { Do the system call. } jnb .LSyscOK { branch to exit if ok, errorhandler otherwise} movq %rax,%rdx @@ -334,6 +293,6 @@ asm .LNoThread: movq $-1,%rax .LSyscOK: - add $0x10,%rsp + addq $0x10,%rsp end; diff --git a/rtl/bsd/x86_64/syscallh.inc b/rtl/bsd/x86_64/syscallh.inc index 74179afeb7..20011d87ab 100644 --- a/rtl/bsd/x86_64/syscallh.inc +++ b/rtl/bsd/x86_64/syscallh.inc @@ -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,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} |