mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-16 13:29:22 +02:00
* little fixes in prep of x86_64 port.
git-svn-id: trunk@6979 -
This commit is contained in:
parent
c8ea0b0344
commit
793ef9fdf1
@ -538,7 +538,7 @@ function Fppread(fd: cint; buf: pchar; nbytes : size_t; offset:Toff): ssize_t; [
|
|||||||
begin
|
begin
|
||||||
|
|
||||||
{$ifdef CPU64}
|
{$ifdef CPU64}
|
||||||
Fppread:=do_syscall(syscall_nr_pread,Fd,TSysParam(buf),nbytes,TSysParam(OffSet});
|
Fppread:=do_syscall(syscall_nr_pread,Fd,TSysParam(buf),nbytes,TSysParam(OffSet));
|
||||||
{$else}
|
{$else}
|
||||||
Fppread:=do_syscall(syscall_nr_pread,Fd,TSysParam(buf),nbytes,
|
Fppread:=do_syscall(syscall_nr_pread,Fd,TSysParam(buf),nbytes,
|
||||||
{$ifdef 64bitfs}
|
{$ifdef 64bitfs}
|
||||||
@ -556,7 +556,7 @@ function Fppwrite(fd: cint;buf:pchar; nbytes : size_t; offset:Toff): ssize_t; [p
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
{$ifdef CPU64}
|
{$ifdef CPU64}
|
||||||
Fppwrite:=do_syscall(syscall_nr_pwrite,Fd,TSysParam(buf),nbytes,TSysParam(OffSet});
|
Fppwrite:=do_syscall(syscall_nr_pwrite,Fd,TSysParam(buf),nbytes,TSysParam(OffSet));
|
||||||
{$else}
|
{$else}
|
||||||
Fppwrite:=do_syscall(syscall_nr_pwrite,Fd,TSysParam(buf),nbytes,
|
Fppwrite:=do_syscall(syscall_nr_pwrite,Fd,TSysParam(buf),nbytes,
|
||||||
// ,0 = possible alignment here.
|
// ,0 = possible alignment here.
|
||||||
|
@ -71,23 +71,36 @@ FreeBSD: same implementation as NetBSD.
|
|||||||
}
|
}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Fplseek:=do_syscall(syscall_nr___syscall,syscall_nr_lseek,0,TSysParam(fd),0,lo(Offset),{0} hi(offset),Whence);
|
{$ifdef CPU64}
|
||||||
|
Fplseek:=do_syscall(syscall_nr___syscall,syscall_nr_lseek,TSysParam(fd),0,Offset,whence);
|
||||||
|
{$else}
|
||||||
|
Fplseek:=do_syscall(syscall_nr___syscall,syscall_nr_lseek,0,TSysParam(fd),0,lo(Offset),{0} hi(offset),Whence);
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function Fpftruncate(fd : cint; flength : off_t): cint; [public, alias : 'FPC_SYSC_FTRUNCATE'];
|
function Fpftruncate(fd : cint; flength : off_t): cint; [public, alias : 'FPC_SYSC_FTRUNCATE'];
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Fpftruncate:=Do_syscall(syscall_nr___syscall,syscall_nr_ftruncate,0,fd,0,lo(flength),hi(flength));
|
{$ifdef CPU64}
|
||||||
|
Fpftruncate:=Do_syscall(syscall_nr___syscall,syscall_nr_ftruncate, fd ,0 ,flength);
|
||||||
|
{$else}
|
||||||
|
Fpftruncate:=Do_syscall(syscall_nr___syscall,syscall_nr_ftruncate,0,fd,0,lo(flength),hi(flength));
|
||||||
|
{$endif}
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; [public, alias: 'FPC_SYSC_MMAP'];
|
Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; [public, alias: 'FPC_SYSC_MMAP'];
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Fpmmap:=pointer(longint(do_syscall(syscall_nr_mmap,TSysParam(Start),Len,Prot,Flags,fd,
|
{$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)));
|
||||||
|
{$else}
|
||||||
|
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}
|
||||||
{$ifdef FPC_LITTLE_ENDIAN} lo(offst),hi(offst){$endif},0
|
{$ifdef FPC_LITTLE_ENDIAN} lo(offst),hi(offst){$endif},0
|
||||||
)));
|
)));
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
|
@ -22,16 +22,16 @@
|
|||||||
- More 6 and 7 param dosyscall because of the __syscall problem
|
- More 6 and 7 param dosyscall because of the __syscall problem
|
||||||
}
|
}
|
||||||
|
|
||||||
{$ASMMODE GAS}
|
{ASMMODE GAS}
|
||||||
|
|
||||||
function do_sysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL0'];
|
function fpsysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL0'];
|
||||||
|
|
||||||
asm
|
asm
|
||||||
movq sysnr, %rax { Syscall number -> rax. }
|
movq sysnr, %rax { Syscall number -> rax. }
|
||||||
syscall { Do the system call. }
|
syscall { Do the system call. }
|
||||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||||
movq %rax,%rcx
|
movq %rax,%rcx
|
||||||
movq FPC_THREADVAR_RELOCATE,%rax
|
movq fpc_threadvar_relocate_proc,%rax
|
||||||
testq %rax,%rax
|
testq %rax,%rax
|
||||||
jne .LThread
|
jne .LThread
|
||||||
movq %rcx,Errno+8
|
movq %rcx,Errno+8
|
||||||
@ -44,11 +44,11 @@ asm
|
|||||||
movq %rcx,(%rax)
|
movq %rcx,(%rax)
|
||||||
.LNoThread:
|
.LNoThread:
|
||||||
movq $-1,%rax
|
movq $-1,%rax
|
||||||
movq rax,%rdx
|
movq %rax,%rdx
|
||||||
.LSyscOK:
|
.LSyscOK:
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function do_sysCall(sysnr,param1 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
|
function fpsysCall(sysnr,param1 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
|
||||||
|
|
||||||
asm
|
asm
|
||||||
movq sysnr, %rax { Syscall number -> rax. }
|
movq sysnr, %rax { Syscall number -> rax. }
|
||||||
@ -56,7 +56,7 @@ asm
|
|||||||
syscall { Do the system call. }
|
syscall { Do the system call. }
|
||||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||||
movq %rax,%rcx
|
movq %rax,%rcx
|
||||||
movq FPC_THREADVAR_RELOCATE,%rax
|
movq fpc_threadvar_relocate_proc,%rax
|
||||||
testq %rax,%rax
|
testq %rax,%rax
|
||||||
jne .LThread
|
jne .LThread
|
||||||
movq %rcx,Errno+8
|
movq %rcx,Errno+8
|
||||||
@ -69,11 +69,11 @@ asm
|
|||||||
movq %rcx,(%rax)
|
movq %rcx,(%rax)
|
||||||
.LNoThread:
|
.LNoThread:
|
||||||
movq $-1,%rax
|
movq $-1,%rax
|
||||||
movq rax,%rdx
|
movq %rax,%rdx
|
||||||
.LSyscOK:
|
.LSyscOK:
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function do_sysCall(sysnr,param1,param2 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL2'];
|
function fpsysCall(sysnr,param1,param2 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL2'];
|
||||||
|
|
||||||
asm
|
asm
|
||||||
movq sysnr, %rax { Syscall number -> rax. }
|
movq sysnr, %rax { Syscall number -> rax. }
|
||||||
@ -83,7 +83,7 @@ asm
|
|||||||
syscall { Do the system call. }
|
syscall { Do the system call. }
|
||||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||||
movq %rax,%rcx
|
movq %rax,%rcx
|
||||||
movq FPC_THREADVAR_RELOCATE,%rax
|
movq fpc_threadvar_relocate_proc,%rax
|
||||||
testq %rax,%rax
|
testq %rax,%rax
|
||||||
jne .LThread
|
jne .LThread
|
||||||
movq %rcx,Errno+8
|
movq %rcx,Errno+8
|
||||||
@ -96,11 +96,11 @@ asm
|
|||||||
movq %rcx,(%rax)
|
movq %rcx,(%rax)
|
||||||
.LNoThread:
|
.LNoThread:
|
||||||
movq $-1,%rax
|
movq $-1,%rax
|
||||||
movq rax,%rdx
|
movq %rax,%rdx
|
||||||
.LSyscOK:
|
.LSyscOK:
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function do_sysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
|
function fpsysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
|
||||||
|
|
||||||
asm
|
asm
|
||||||
movq sysnr, %rax { Syscall number -> rax. }
|
movq sysnr, %rax { Syscall number -> rax. }
|
||||||
@ -111,7 +111,7 @@ asm
|
|||||||
syscall { Do the system call. }
|
syscall { Do the system call. }
|
||||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||||
movq %rax,%rcx
|
movq %rax,%rcx
|
||||||
movq FPC_THREADVAR_RELOCATE,%rax
|
movq fpc_threadvar_relocate_proc,%rax
|
||||||
testq %rax,%rax
|
testq %rax,%rax
|
||||||
jne .LThread
|
jne .LThread
|
||||||
movq %rcx,Errno+8
|
movq %rcx,Errno+8
|
||||||
@ -124,11 +124,11 @@ asm
|
|||||||
movq %rcx,(%rax)
|
movq %rcx,(%rax)
|
||||||
.LNoThread:
|
.LNoThread:
|
||||||
movq $-1,%rax
|
movq $-1,%rax
|
||||||
movq rax,%rdx
|
movq %rax,%rdx
|
||||||
.LSyscOK:
|
.LSyscOK:
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function do_sysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL4'];
|
function fpsysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL4'];
|
||||||
|
|
||||||
asm
|
asm
|
||||||
movq sysnr, %rax { Syscall number -> rax. }
|
movq sysnr, %rax { Syscall number -> rax. }
|
||||||
@ -140,7 +140,7 @@ asm
|
|||||||
syscall { Do the system call. }
|
syscall { Do the system call. }
|
||||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||||
movq %rax,%rcx
|
movq %rax,%rcx
|
||||||
movq FPC_THREADVAR_RELOCATE,%rax
|
movq fpc_threadvar_relocate_proc,%rax
|
||||||
testq %rax,%rax
|
testq %rax,%rax
|
||||||
jne .LThread
|
jne .LThread
|
||||||
movq %rcx,Errno+8
|
movq %rcx,Errno+8
|
||||||
@ -153,11 +153,11 @@ asm
|
|||||||
movq %rcx,(%rax)
|
movq %rcx,(%rax)
|
||||||
.LNoThread:
|
.LNoThread:
|
||||||
movq $-1,%rax
|
movq $-1,%rax
|
||||||
movq rax,%rdx
|
movq %rax,%rdx
|
||||||
.LSyscOK:
|
.LSyscOK:
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function do_sysCall(sysnr,param1,param2,param3,param4,param5 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
|
function fpsysCall(sysnr,param1,param2,param3,param4,param5 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
|
||||||
|
|
||||||
asm
|
asm
|
||||||
movq sysnr, %rax { Syscall number -> rax. }
|
movq sysnr, %rax { Syscall number -> rax. }
|
||||||
@ -170,7 +170,7 @@ asm
|
|||||||
syscall { Do the system call. }
|
syscall { Do the system call. }
|
||||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||||
movq %rax,%rcx
|
movq %rax,%rcx
|
||||||
movq FPC_THREADVAR_RELOCATE,%rax
|
movq fpc_threadvar_relocate_proc,%rax
|
||||||
testq %rax,%rax
|
testq %rax,%rax
|
||||||
jne .LThread
|
jne .LThread
|
||||||
movq %rcx,Errno+8
|
movq %rcx,Errno+8
|
||||||
@ -183,12 +183,12 @@ asm
|
|||||||
movq %rcx,(%rax)
|
movq %rcx,(%rax)
|
||||||
.LNoThread:
|
.LNoThread:
|
||||||
movq $-1,%rax
|
movq $-1,%rax
|
||||||
movq rax,%rdx
|
movq %rax,%rdx
|
||||||
.LSyscOK:
|
.LSyscOK:
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL6'];
|
function fpsysCall(sysnr,param1,param2,param3,param4,param5,param6 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL6'];
|
||||||
|
|
||||||
asm
|
asm
|
||||||
movq sysnr, %rax { Syscall number -> rax. }
|
movq sysnr, %rax { Syscall number -> rax. }
|
||||||
@ -202,7 +202,7 @@ asm
|
|||||||
syscall { Do the system call. }
|
syscall { Do the system call. }
|
||||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||||
movq %rax,%rcx
|
movq %rax,%rcx
|
||||||
movq FPC_THREADVAR_RELOCATE,%rax
|
movq fpc_threadvar_relocate_proc,%rax
|
||||||
testq %rax,%rax
|
testq %rax,%rax
|
||||||
jne .LThread
|
jne .LThread
|
||||||
movq %rcx,Errno+8
|
movq %rcx,Errno+8
|
||||||
@ -215,16 +215,51 @@ asm
|
|||||||
movq %rcx,(%rax)
|
movq %rcx,(%rax)
|
||||||
.LNoThread:
|
.LNoThread:
|
||||||
movq $-1,%rax
|
movq $-1,%rax
|
||||||
movq rax,%rdx
|
movq %rax,%rdx
|
||||||
.LSyscOK:
|
.LSyscOK:
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function fpsysCall(sysnr,param1,param2,param3,param4,param5,param6,param7 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL7'];
|
||||||
|
|
||||||
|
asm
|
||||||
|
mov param7,%rax
|
||||||
|
pushq %rax
|
||||||
|
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
|
||||||
|
mov %rcx,%r10
|
||||||
|
syscall { Do the system call. }
|
||||||
|
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||||
|
movq %rax,%rcx
|
||||||
|
movq fpc_threadvar_relocate_proc,%rax
|
||||||
|
testq %rax,%rax
|
||||||
|
jne .LThread
|
||||||
|
movq %rcx,Errno+8
|
||||||
|
jmp .LNoThread
|
||||||
|
.LThread:
|
||||||
|
pushq %rcx
|
||||||
|
pushq Errno
|
||||||
|
call *%rax
|
||||||
|
popq %rcx
|
||||||
|
movq %rcx,(%rax)
|
||||||
|
.LNoThread:
|
||||||
|
movq $-1,%rax
|
||||||
|
movq %rax,%rdx
|
||||||
|
.LSyscOK:
|
||||||
|
popq %rax
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure actualsyscall; assembler; {inline requires a dummy push IIRC}
|
procedure actualsyscall; assembler; {inline requires a dummy push IIRC}
|
||||||
asm
|
asm
|
||||||
syscall
|
syscall
|
||||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||||
movq %rax,%rcx
|
movq %rax,%rcx
|
||||||
movq FPC_THREADVAR_RELOCATE,%rax
|
movq fpc_threadvar_relocate_proc,%rax
|
||||||
testq %rax,%rax
|
testq %rax,%rax
|
||||||
jne .LThread
|
jne .LThread
|
||||||
movq %rcx,Errno+8
|
movq %rcx,Errno+8
|
||||||
@ -237,11 +272,12 @@ procedure actualsyscall; assembler; {inline requires a dummy push IIRC}
|
|||||||
movq %rcx,(%rax)
|
movq %rcx,(%rax)
|
||||||
.LNoThread:
|
.LNoThread:
|
||||||
movq $-1,%rax
|
movq $-1,%rax
|
||||||
movq rax,%rdx
|
movq %rax,%rdx
|
||||||
.LSyscOK:
|
.LSyscOK:
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function do__sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7,Param8:TSysParam):TSysResult; oldfpccall; external name 'FPC_DOSYS8';
|
|
||||||
|
function fp_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7,Param8:TSysParam):TSysResult; assembler;assembler;[public,alias:'FPC_DOSYS8'];
|
||||||
// Hmm, we have to do something different :)
|
// Hmm, we have to do something different :)
|
||||||
|
|
||||||
asm
|
asm
|
||||||
@ -249,10 +285,9 @@ asm
|
|||||||
push %rax
|
push %rax
|
||||||
movq param7,%rax
|
movq param7,%rax
|
||||||
push %rax
|
push %rax
|
||||||
movq $syscall_nr__syscall, %rax
|
movq $198, %rax
|
||||||
mov %rcx,%r10
|
mov %rcx,%r10
|
||||||
call actualsyscall
|
call actualsyscall
|
||||||
add $16,%rsp
|
add $16,%rsp
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ function do_sysCall(sysnr,param1,param2,param3:TSysParam):TSysResult;oldfpccall;
|
|||||||
function do_sysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult;oldfpccall; external name 'FPC_DOSYS4';
|
function do_sysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult;oldfpccall; external name 'FPC_DOSYS4';
|
||||||
function do_sysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; oldfpccall; external name 'FPC_DOSYS5';
|
function do_sysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; oldfpccall; external name 'FPC_DOSYS5';
|
||||||
function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):int64;oldfpccall; external name 'FPC_DOSYS6';
|
function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):int64;oldfpccall; external name 'FPC_DOSYS6';
|
||||||
|
function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):int64;oldfpccall; external name 'FPC_DOSYS7';
|
||||||
|
|
||||||
// special
|
// special
|
||||||
function do__sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7,Param8:TSysParam):TSysResult; oldfpccall; external name 'FPC_DOSYS8';
|
function do__sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7,Param8:TSysParam):TSysResult; oldfpccall; external name 'FPC_DOSYS8';
|
||||||
|
Loading…
Reference in New Issue
Block a user