mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 19:43:15 +01:00
* Return values of get_caller_addr and get_caller_frame was undefined for nil argument.
Moreover, these function have nothing to do with assembler at all. git-svn-id: trunk@19502 -
This commit is contained in:
parent
8e41ecfd54
commit
9b2614684e
@ -40,36 +40,20 @@ end;
|
||||
|
||||
|
||||
{$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
|
||||
function get_caller_addr(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||
asm
|
||||
{$ifdef win64}
|
||||
orq %rcx,%rcx
|
||||
jz .Lg_a_null
|
||||
movq 8(%rcx),%rax
|
||||
{$else win64}
|
||||
{ %rdi = framebp }
|
||||
orq %rdi,%rdi
|
||||
jz .Lg_a_null
|
||||
movq 8(%rdi),%rax
|
||||
{$endif win64}
|
||||
.Lg_a_null:
|
||||
function get_caller_addr(framebp:pointer):pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||
begin
|
||||
get_caller_addr:=framebp;
|
||||
if assigned(framebp) then
|
||||
get_caller_addr:=PPointer(framebp)[1];
|
||||
end;
|
||||
|
||||
|
||||
{$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
|
||||
function get_caller_frame(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||
asm
|
||||
{$ifdef win64}
|
||||
orq %rcx,%rcx
|
||||
jz .Lg_a_null
|
||||
movq (%rcx),%rax
|
||||
{$else win64}
|
||||
{ %rdi = framebp }
|
||||
orq %rdi,%rdi
|
||||
jz .Lg_a_null
|
||||
movq (%rdi),%rax
|
||||
{$endif win64}
|
||||
.Lg_a_null:
|
||||
function get_caller_frame(framebp:pointer):pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||
begin
|
||||
get_caller_frame:=framebp;
|
||||
if assigned(framebp) then
|
||||
get_caller_frame:=PPointer(framebp)^;
|
||||
end;
|
||||
|
||||
// The following assembler procedures are disabled for FreeBSD due to
|
||||
|
||||
Loading…
Reference in New Issue
Block a user