mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-24 03:51:39 +02:00
* 64-bit FreeBSD port files
git-svn-id: trunk@7082 -
This commit is contained in:
parent
f47557dde3
commit
96ac89f6d5
@ -99,7 +99,9 @@ unit i_bsd;
|
||||
system : system_x86_64_freebsd;
|
||||
name : 'FreeBSD for x86-64';
|
||||
shortname : 'FreeBSD';
|
||||
flags : [tf_needs_symbol_size,tf_pic_uses_got,tf_files_case_sensitive,tf_use_function_relative_addresses{,tf_smartlink_sections}];
|
||||
flags : [tf_needs_symbol_size,tf_needs_dwarf_cfi,{Linux: tf_library_needs_pic,}tf_needs_symbol_type,
|
||||
tf_files_case_sensitive,tf_use_function_relative_addresses
|
||||
{ tf_pic_uses_got,tf_smartlink_sections}];
|
||||
cpu : cpu_x86_64;
|
||||
unit_env : 'BSDUNITS';
|
||||
extradefines : 'UNIX;HASUNIX;BSD';
|
||||
@ -124,13 +126,13 @@ unit i_bsd;
|
||||
Cprefix : '';
|
||||
newline : #10;
|
||||
dirsep : '/';
|
||||
assem : as_gas;
|
||||
assem : as_x86_64_elf64;
|
||||
assemextern : as_gas;
|
||||
link : nil;
|
||||
linkextern : nil;
|
||||
ar : ar_gnu_ar;
|
||||
res : res_none;
|
||||
dbg : dbg_stabs;
|
||||
dbg : dbg_dwarf2; //dbg_stabs;
|
||||
script : script_unix;
|
||||
endian : endian_little;
|
||||
alignment :
|
||||
@ -141,11 +143,11 @@ unit i_bsd;
|
||||
constalignmin : 0;
|
||||
constalignmax : 8;
|
||||
varalignmin : 0;
|
||||
varalignmax : 8;
|
||||
varalignmax : 16;
|
||||
localalignmin : 4;
|
||||
localalignmax : 8;
|
||||
localalignmax : 16;
|
||||
recordalignmin : 0;
|
||||
recordalignmax : 8;
|
||||
recordalignmax : 16;
|
||||
maxCrecordalign : 8
|
||||
);
|
||||
first_parm_offset : 16;
|
||||
|
||||
@ -22,113 +22,135 @@
|
||||
- More 6 and 7 param dosyscall because of the __syscall problem
|
||||
}
|
||||
|
||||
{ASMMODE GAS}
|
||||
{$ASMMODE GAS}
|
||||
|
||||
function fpsysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL0'];
|
||||
function fpsysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS0'];
|
||||
|
||||
asm
|
||||
movq sysnr, %rax { Syscall number -> rax. }
|
||||
syscall { Do the system call. }
|
||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||
movq %rax,%rcx
|
||||
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
|
||||
movq %rcx,Errno+8
|
||||
movl %edx,8(%r11)
|
||||
jmp .LNoThread
|
||||
.LThread:
|
||||
pushq %rcx
|
||||
pushq Errno
|
||||
pushq %rdx
|
||||
movq (%r11),%rdi
|
||||
call *%rax
|
||||
popq %rcx
|
||||
movq %rcx,(%rax)
|
||||
popq %rdx
|
||||
movl %edx,(%rax)
|
||||
.LNoThread:
|
||||
movq $-1,%rax
|
||||
movq %rax,%rdx
|
||||
.LSyscOK:
|
||||
end;
|
||||
|
||||
function fpsysCall(sysnr,param1 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
|
||||
function fpsysCall(sysnr,param1 : TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS1'];
|
||||
|
||||
asm
|
||||
movq sysnr, %rax { Syscall number -> rax. }
|
||||
movq param1, %rdi { shift arg1 - arg1. }
|
||||
syscall { Do the system call. }
|
||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||
movq %rax,%rcx
|
||||
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
|
||||
movq %rcx,Errno+8
|
||||
movl %edx,8(%r11)
|
||||
jmp .LNoThread
|
||||
.LThread:
|
||||
pushq %rcx
|
||||
pushq Errno
|
||||
pushq %rdx
|
||||
movq (%r11),%rdi
|
||||
call *%rax
|
||||
popq %rcx
|
||||
movq %rcx,(%rax)
|
||||
popq %rdx
|
||||
movl %edx,(%rax)
|
||||
.LNoThread:
|
||||
movq $-1,%rax
|
||||
movq %rax,%rdx
|
||||
.LSyscOK:
|
||||
end;
|
||||
|
||||
function fpsysCall(sysnr,param1,param2 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL2'];
|
||||
function fpsysCall(sysnr,param1,param2 : TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS2'];
|
||||
|
||||
asm
|
||||
movq sysnr, %rax { Syscall number -> rax. }
|
||||
movq param1, %rdi { shift arg1 - arg2. }
|
||||
movq param2, %rsi
|
||||
mov %rcx,%r10
|
||||
syscall { Do the system call. }
|
||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||
movq %rax,%rcx
|
||||
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
|
||||
movq %rcx,Errno+8
|
||||
movl %edx,8(%r11)
|
||||
jmp .LNoThread
|
||||
.LThread:
|
||||
pushq %rcx
|
||||
pushq Errno
|
||||
pushq %rdx
|
||||
movq (%r11),%rdi
|
||||
call *%rax
|
||||
popq %rcx
|
||||
movq %rcx,(%rax)
|
||||
popq %rdx
|
||||
movl %edx,(%rax)
|
||||
.LNoThread:
|
||||
movq $-1,%rax
|
||||
movq %rax,%rdx
|
||||
.LSyscOK:
|
||||
end;
|
||||
|
||||
function fpsysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
|
||||
function fpsysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS3'];
|
||||
|
||||
asm
|
||||
movq sysnr, %rax { Syscall number -> rax. }
|
||||
movq param1, %rdi { shift arg1 - arg3. }
|
||||
movq param2, %rsi
|
||||
movq param3, %rdx
|
||||
mov %rcx,%r10
|
||||
syscall { Do the system call. }
|
||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||
movq %rax,%rcx
|
||||
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
|
||||
movq %rcx,Errno+8
|
||||
movl %edx,8(%r11)
|
||||
jmp .LNoThread
|
||||
.LThread:
|
||||
pushq %rcx
|
||||
pushq Errno
|
||||
pushq %rdx
|
||||
movq (%r11),%rdi
|
||||
call *%rax
|
||||
popq %rcx
|
||||
movq %rcx,(%rax)
|
||||
popq %rdx
|
||||
movl %edx,(%rax)
|
||||
.LNoThread:
|
||||
movq $-1,%rax
|
||||
movq %rax,%rdx
|
||||
.LSyscOK:
|
||||
end;
|
||||
|
||||
function fpsysCall(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_DOSYS4'];
|
||||
|
||||
asm
|
||||
movq sysnr, %rax { Syscall number -> rax. }
|
||||
@ -136,28 +158,33 @@ asm
|
||||
movq param2, %rsi
|
||||
movq param3, %rdx
|
||||
movq param4, %r10
|
||||
mov %rcx,%r10
|
||||
syscall { Do the system call. }
|
||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||
movq %rax,%rcx
|
||||
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
|
||||
movq %rcx,Errno+8
|
||||
movl %edx,8(%r11)
|
||||
jmp .LNoThread
|
||||
.LThread:
|
||||
pushq %rcx
|
||||
pushq Errno
|
||||
pushq %rdx
|
||||
movq (%r11),%rdi
|
||||
call *%rax
|
||||
popq %rcx
|
||||
movq %rcx,(%rax)
|
||||
popq %rdx
|
||||
movl %edx,(%rax)
|
||||
.LNoThread:
|
||||
movq $-1,%rax
|
||||
movq %rax,%rdx
|
||||
.LSyscOK:
|
||||
end;
|
||||
|
||||
function fpsysCall(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_DOSYS5'];
|
||||
|
||||
asm
|
||||
movq sysnr, %rax { Syscall number -> rax. }
|
||||
@ -166,29 +193,34 @@ asm
|
||||
movq param3, %rdx
|
||||
movq param4, %r10
|
||||
movq param5, %r8
|
||||
mov %rcx,%r10
|
||||
syscall { Do the system call. }
|
||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||
movq %rax,%rcx
|
||||
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
|
||||
movq %rcx,Errno+8
|
||||
movl %edx,8(%r11)
|
||||
jmp .LNoThread
|
||||
.LThread:
|
||||
pushq %rcx
|
||||
pushq Errno
|
||||
pushq %rdx
|
||||
movq (%r11),%rdi
|
||||
call *%rax
|
||||
popq %rcx
|
||||
movq %rcx,(%rax)
|
||||
popq %rdx
|
||||
movl %edx,(%rax)
|
||||
.LNoThread:
|
||||
movq $-1,%rax
|
||||
movq %rax,%rdx
|
||||
.LSyscOK:
|
||||
end;
|
||||
|
||||
|
||||
function fpsysCall(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_DOSYS6'];
|
||||
|
||||
asm
|
||||
movq sysnr, %rax { Syscall number -> rax. }
|
||||
@ -198,96 +230,68 @@ asm
|
||||
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 %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
|
||||
movq %rcx,Errno+8
|
||||
movl %edx,8(%r11)
|
||||
jmp .LNoThread
|
||||
.LThread:
|
||||
pushq %rcx
|
||||
pushq Errno
|
||||
pushq %rdx
|
||||
movq (%r11),%rdi
|
||||
call *%rax
|
||||
popq %rcx
|
||||
movq %rcx,(%rax)
|
||||
popq %rdx
|
||||
movl %edx,(%rax)
|
||||
.LNoThread:
|
||||
movq $-1,%rax
|
||||
movq %rax,%rdx
|
||||
.LSyscOK:
|
||||
end;
|
||||
|
||||
function fpsysCall(sysnr,param1,param2,param3,param4,param5,param6,param7 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL7'];
|
||||
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
|
||||
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
|
||||
sub $0x18,%rsp
|
||||
movq param6,%rax // from caller stack to mine.
|
||||
movq %rax,0x8(%rsp)
|
||||
movl $0, 0(%rsp) // dummy or caller frame because ?
|
||||
mov $0xc6,%rax // __syscall
|
||||
mov %rcx,%r10
|
||||
syscall { Do the system call. }
|
||||
jge .LSyscOK { branch to exit if ok, errorhandler otherwise}
|
||||
movq %rax,%rcx
|
||||
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
|
||||
movq %rcx,Errno+8
|
||||
movl %edx,8(%r11)
|
||||
jmp .LNoThread
|
||||
.LThread:
|
||||
pushq %rcx
|
||||
pushq Errno
|
||||
pushq %rdx
|
||||
movq (%r11),%rdi
|
||||
call *%rax
|
||||
popq %rcx
|
||||
movq %rcx,(%rax)
|
||||
popq %rdx
|
||||
movl %edx,(%rax)
|
||||
.LNoThread:
|
||||
movq $-1,%rax
|
||||
movq %rax,%rdx
|
||||
.LSyscOK:
|
||||
popq %rax
|
||||
add $0x18,%rsp
|
||||
end;
|
||||
|
||||
|
||||
procedure actualsyscall; assembler; {inline requires a dummy push IIRC}
|
||||
asm
|
||||
syscall
|
||||
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:
|
||||
end;
|
||||
|
||||
|
||||
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 :)
|
||||
|
||||
asm
|
||||
movq param8,%rax
|
||||
push %rax
|
||||
movq param7,%rax
|
||||
push %rax
|
||||
movq $198, %rax
|
||||
mov %rcx,%r10
|
||||
call actualsyscall
|
||||
add $16,%rsp
|
||||
end;
|
||||
|
||||
|
||||
@ -39,9 +39,9 @@ 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,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,param7:TSysParam):int64;oldfpccall; external name 'FPC_DOSYS7';
|
||||
//function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):int64;oldfpccall; external name 'FPC_DOSYS7';
|
||||
|
||||
// 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__DOSYS';
|
||||
{$endif}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user