mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 22:49:17 +02:00
* fixed calling conventions for winx64
git-svn-id: trunk@3230 -
This commit is contained in:
parent
474ba9723c
commit
398cb8e0fe
@ -46,10 +46,16 @@ end ['RAX'];
|
|||||||
{$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
|
{$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
|
||||||
function get_caller_addr(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
|
function get_caller_addr(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||||
asm
|
asm
|
||||||
|
{$ifdef win64}
|
||||||
|
orq %rcx,%rcx
|
||||||
|
jz .Lg_a_null
|
||||||
|
movq 8(%rcx),%rax
|
||||||
|
{$else win64}
|
||||||
{ %rdi = framebp }
|
{ %rdi = framebp }
|
||||||
orq %rdi,%rdi
|
orq %rdi,%rdi
|
||||||
jz .Lg_a_null
|
jz .Lg_a_null
|
||||||
movq 8(%rdi),%rax
|
movq 8(%rdi),%rax
|
||||||
|
{$endif win64}
|
||||||
.Lg_a_null:
|
.Lg_a_null:
|
||||||
end ['RAX'];
|
end ['RAX'];
|
||||||
|
|
||||||
@ -57,10 +63,16 @@ end ['RAX'];
|
|||||||
{$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
|
{$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
|
||||||
function get_caller_frame(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
|
function get_caller_frame(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||||
asm
|
asm
|
||||||
|
{$ifdef win64}
|
||||||
|
orq %rcx,%rcx
|
||||||
|
jz .Lg_a_null
|
||||||
|
movq (%rcx),%rax
|
||||||
|
{$else win64}
|
||||||
{ %rdi = framebp }
|
{ %rdi = framebp }
|
||||||
orq %rdi,%rdi
|
orq %rdi,%rdi
|
||||||
jz .Lg_a_null
|
jz .Lg_a_null
|
||||||
movq (%rdi),%rax
|
movq (%rdi),%rax
|
||||||
|
{$endif win64}
|
||||||
.Lg_a_null:
|
.Lg_a_null:
|
||||||
end ['RAX'];
|
end ['RAX'];
|
||||||
|
|
||||||
@ -245,6 +257,22 @@ Procedure FillChar(var x;count:longint;value:byte);assembler;
|
|||||||
{ does a thread save inc/dec }
|
{ does a thread save inc/dec }
|
||||||
function declocked(var l : longint) : boolean;assembler;
|
function declocked(var l : longint) : boolean;assembler;
|
||||||
asm
|
asm
|
||||||
|
{$ifdef win64}
|
||||||
|
{
|
||||||
|
l: %rcx
|
||||||
|
}
|
||||||
|
{ this check should be done because a lock takes a lot }
|
||||||
|
{ of time! }
|
||||||
|
cmpb $0,IsMultithread
|
||||||
|
jz .Ldeclockednolock
|
||||||
|
lock
|
||||||
|
decl (%rcx)
|
||||||
|
jmp .Ldeclockedend
|
||||||
|
.Ldeclockednolock:
|
||||||
|
decl (%rcx)
|
||||||
|
.Ldeclockedend:
|
||||||
|
setzb %al
|
||||||
|
{$else win64}
|
||||||
{
|
{
|
||||||
l: %rdi
|
l: %rdi
|
||||||
}
|
}
|
||||||
@ -264,12 +292,29 @@ function declocked(var l : longint) : boolean;assembler;
|
|||||||
decl (%rdi)
|
decl (%rdi)
|
||||||
.Ldeclockedend:
|
.Ldeclockedend:
|
||||||
setzb %al
|
setzb %al
|
||||||
|
{$endif win64}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_DECLOCKED_INT64}
|
{$define FPC_SYSTEM_HAS_DECLOCKED_INT64}
|
||||||
function declocked(var l : int64) : boolean;assembler;
|
function declocked(var l : int64) : boolean;assembler;
|
||||||
asm
|
asm
|
||||||
|
{$ifdef win64}
|
||||||
|
{
|
||||||
|
l: %rcx
|
||||||
|
}
|
||||||
|
{ this check should be done because a lock takes a lot }
|
||||||
|
{ of time! }
|
||||||
|
cmpb $0,IsMultithread
|
||||||
|
jz .Ldeclockednolock
|
||||||
|
lock
|
||||||
|
decq (%rcx)
|
||||||
|
jmp .Ldeclockedend
|
||||||
|
.Ldeclockednolock:
|
||||||
|
decq (%rcx)
|
||||||
|
.Ldeclockedend:
|
||||||
|
setzb %al
|
||||||
|
{$else win64}
|
||||||
{
|
{
|
||||||
l: %rdi
|
l: %rdi
|
||||||
}
|
}
|
||||||
@ -289,6 +334,7 @@ function declocked(var l : int64) : boolean;assembler;
|
|||||||
decq (%rdi)
|
decq (%rdi)
|
||||||
.Ldeclockedend:
|
.Ldeclockedend:
|
||||||
setzb %al
|
setzb %al
|
||||||
|
{$endif win64}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -296,6 +342,21 @@ function declocked(var l : int64) : boolean;assembler;
|
|||||||
procedure inclocked(var l : longint);assembler;
|
procedure inclocked(var l : longint);assembler;
|
||||||
|
|
||||||
asm
|
asm
|
||||||
|
{$ifdef win64}
|
||||||
|
{
|
||||||
|
l: %rcx
|
||||||
|
}
|
||||||
|
{ this check should be done because a lock takes a lot }
|
||||||
|
{ of time! }
|
||||||
|
cmpb $0,IsMultithread
|
||||||
|
jz .Linclockednolock
|
||||||
|
lock
|
||||||
|
incl (%rcx)
|
||||||
|
jmp .Linclockedend
|
||||||
|
.Linclockednolock:
|
||||||
|
incl (%rcx)
|
||||||
|
.Linclockedend:
|
||||||
|
{$else win64}
|
||||||
{
|
{
|
||||||
l: %rdi
|
l: %rdi
|
||||||
}
|
}
|
||||||
@ -314,6 +375,7 @@ procedure inclocked(var l : longint);assembler;
|
|||||||
.Linclockednolock:
|
.Linclockednolock:
|
||||||
incl (%rdi)
|
incl (%rdi)
|
||||||
.Linclockedend:
|
.Linclockedend:
|
||||||
|
{$endif win64}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -321,6 +383,21 @@ procedure inclocked(var l : longint);assembler;
|
|||||||
procedure inclocked(var l : int64);assembler;
|
procedure inclocked(var l : int64);assembler;
|
||||||
|
|
||||||
asm
|
asm
|
||||||
|
{$ifdef win64}
|
||||||
|
{
|
||||||
|
l: %rcx
|
||||||
|
}
|
||||||
|
{ this check should be done because a lock takes a lot }
|
||||||
|
{ of time! }
|
||||||
|
cmpb $0,IsMultithread
|
||||||
|
jz .Linclockednolock
|
||||||
|
lock
|
||||||
|
incq (%rcx)
|
||||||
|
jmp .Linclockedend
|
||||||
|
.Linclockednolock:
|
||||||
|
incq (%rcx)
|
||||||
|
.Linclockedend:
|
||||||
|
{$else win64}
|
||||||
{
|
{
|
||||||
l: %rdi
|
l: %rdi
|
||||||
}
|
}
|
||||||
@ -339,6 +416,7 @@ procedure inclocked(var l : int64);assembler;
|
|||||||
.Linclockednolock:
|
.Linclockednolock:
|
||||||
incq (%rdi)
|
incq (%rdi)
|
||||||
.Linclockedend:
|
.Linclockedend:
|
||||||
|
{$endif win64}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user