mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 00:08:12 +02:00
* fixed some calling conventions in assembler routines for win64
git-svn-id: trunk@3250 -
This commit is contained in:
parent
9bca90c81b
commit
0b0ed3f0f2
@ -18,7 +18,17 @@
|
||||
{$define FPC_UNIT_HAS_STRCOPY}
|
||||
{ Created from glibc: libc/sysdeps/x86_64/strcpy.S Version 1.2 }
|
||||
function strcopy(dest,source : pchar) : pchar;assembler;
|
||||
{$ifdef win64}
|
||||
var
|
||||
rdi,rsi : int64;
|
||||
{$endif win64}
|
||||
asm
|
||||
{$ifdef win64}
|
||||
movq %rsi,rsi
|
||||
movq %rdi,rdi
|
||||
movq %rdx, %rsi
|
||||
movq %rcx, %rdi
|
||||
{$endif win64}
|
||||
movq %rsi, %rcx { Source register. }
|
||||
andl $7, %ecx { mask alignment bits }
|
||||
movq %rdi, %rdx { Duplicate destination pointer. }
|
||||
@ -139,13 +149,27 @@ asm
|
||||
|
||||
.LFPC_STRCOPY_4:
|
||||
movq %rdi, %rax { Source is return value. }
|
||||
{$ifdef win64}
|
||||
movq rsi,%rsi
|
||||
movq rdi,%rdi
|
||||
{$endif win64}
|
||||
end;
|
||||
|
||||
|
||||
{$define FPC_UNIT_HAS_STRCOMP}
|
||||
{ Created from glibc: libc/sysdeps/x86_64/strcmp.S Version 1.2 }
|
||||
function StrComp(Str1, Str2: PChar): SizeInt;assembler;
|
||||
{$ifdef win64}
|
||||
var
|
||||
rdi,rsi : int64;
|
||||
{$endif win64}
|
||||
asm
|
||||
{$ifdef win64}
|
||||
movq %rsi,rsi
|
||||
movq %rdi,rdi
|
||||
movq %rdx, %rsi
|
||||
movq %rcx, %rdi
|
||||
{$endif win64}
|
||||
.LFPC_STRCMP_LOOP:
|
||||
movb (%rdi), %al
|
||||
cmpb (%rsi), %al
|
||||
@ -163,5 +187,9 @@ asm
|
||||
movq $-1, %rcx
|
||||
cmovbq %rcx, %rax
|
||||
.Lexit:
|
||||
{$ifdef win64}
|
||||
movq rsi,%rsi
|
||||
movq rdi,%rdi
|
||||
{$endif win64}
|
||||
end;
|
||||
|
||||
|
@ -16,7 +16,12 @@
|
||||
Implemented using the code from glibc: libc/sysdeps/x86_64/strlen.S Version 1.2
|
||||
}
|
||||
asm
|
||||
{ win64 has different calling conventions }
|
||||
{$ifdef win64}
|
||||
movq %rcx, %rdi { Duplicate source pointer. }
|
||||
{$else win64}
|
||||
movq %rdi, %rcx { Duplicate source pointer. }
|
||||
{$endif win64}
|
||||
andl $7, %ecx { mask alignment bits }
|
||||
movq %rdi, %rax { duplicate destination. }
|
||||
jz .LFPC_STRLEN_1 { aligned => start loop }
|
||||
|
Loading…
Reference in New Issue
Block a user