mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 12:59:15 +02:00
* Made a stupid mistake in r19460: restoring rbp from rbp-relative reference will obviously crash. This went unnoticed however, because PASCALMAIN does not return and wrong code is never executed. Fixed by storing rbp in non-volatile register instead of local var.
git-svn-id: trunk@19501 -
This commit is contained in:
parent
80b5100bf6
commit
8e41ecfd54
@ -181,7 +181,6 @@ var
|
|||||||
procedure Exe_entry;[public,alias:'_FPC_EXE_Entry'];
|
procedure Exe_entry;[public,alias:'_FPC_EXE_Entry'];
|
||||||
var
|
var
|
||||||
ST : pointer;
|
ST : pointer;
|
||||||
save_rbp: pointer;
|
|
||||||
begin
|
begin
|
||||||
IsLibrary:=false;
|
IsLibrary:=false;
|
||||||
{ install the handlers for exe only ?
|
{ install the handlers for exe only ?
|
||||||
@ -189,7 +188,6 @@ procedure Exe_entry;[public,alias:'_FPC_EXE_Entry'];
|
|||||||
install_exception_handlers;
|
install_exception_handlers;
|
||||||
ExitCode:=0;
|
ExitCode:=0;
|
||||||
asm
|
asm
|
||||||
movq %rbp,save_rbp
|
|
||||||
movq %rsp,%rax
|
movq %rsp,%rax
|
||||||
movq %rax,st
|
movq %rax,st
|
||||||
end;
|
end;
|
||||||
@ -198,10 +196,11 @@ procedure Exe_entry;[public,alias:'_FPC_EXE_Entry'];
|
|||||||
xorq %rax,%rax
|
xorq %rax,%rax
|
||||||
movw %ss,%ax
|
movw %ss,%ax
|
||||||
movl %eax,_SS(%rip)
|
movl %eax,_SS(%rip)
|
||||||
|
movq %rbp,%rsi
|
||||||
xorq %rbp,%rbp
|
xorq %rbp,%rbp
|
||||||
call PASCALMAIN
|
call PASCALMAIN
|
||||||
movq save_rbp,%rbp
|
movq %rsi,%rbp
|
||||||
end;
|
end ['RSI','RBP']; { <-- specifying RSI allows compiler to save/restore it properly }
|
||||||
{ if we pass here there was no error ! }
|
{ if we pass here there was no error ! }
|
||||||
system_exit;
|
system_exit;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user