From c474b95dfcb780807fbc982182cabe6a586e05f1 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Tue, 21 Apr 2020 06:04:49 +0000 Subject: [PATCH] * disable some x86_64 specific assembly routines git-svn-id: trunk@44921 - --- rtl/win64/system.pp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rtl/win64/system.pp b/rtl/win64/system.pp index 7d5125f31b..63a281a1d0 100644 --- a/rtl/win64/system.pp +++ b/rtl/win64/system.pp @@ -105,7 +105,9 @@ Const implementation +{$ifdef CPUX86_64} {$asmmode att} +{$endif CPUX86_64} var {$ifdef VER3_0} @@ -131,11 +133,13 @@ asm end; {$endif FPC_USE_WIN64_SEH} +{$if defined(CPUX86_64)} {$define FPC_SYSTEM_HAS_STACKTOP} function StackTop: pointer; assembler;nostackframe; asm movq %gs:(8),%rax end; +{$endif} { include system independent routines } {$I system.inc} @@ -219,6 +223,7 @@ procedure Exe_entry(constref info: TEntryInformation);[public,alias:'_FPC_EXE_En install_exception_handlers; {$endif FPC_USE_WIN64_SEH} ExitCode:=0; +{$ifdef CPUX86_64} asm xorq %rax,%rax movw %ss,%ax @@ -246,6 +251,9 @@ procedure Exe_entry(constref info: TEntryInformation);[public,alias:'_FPC_EXE_En {$endif VER3_0} movq %rsi,%rbp end ['RSI','RBP']; { <-- specifying RSI allows compiler to save/restore it properly } +{$else CPUX86_64} + info.PascalMain(); +{$endif CPUX86_64} { if we pass here there was no error ! } system_exit; end; @@ -352,10 +360,12 @@ procedure JumpToHandleErrorFrame; error : longint; begin // save ebp + {$ifdef CPUX86_64} asm movq (%rbp),%rax movq %rax,rbp end; + {$endif} if exceptLevel>0 then dec(exceptLevel); @@ -368,6 +378,7 @@ procedure JumpToHandleErrorFrame; if resetFPU[exceptLevel] then SysResetFPU; { build a fake stack } + {$ifdef CPUX86_64} asm movq rbp,%r8 movq rip,%rdx @@ -381,6 +392,7 @@ procedure JumpToHandleErrorFrame; jmpl HandleErrorAddrFrame {$endif SYSTEMEXCEPTIONDEBUG} end; + {$endif} end;