Browse Source

* Fixed assembler blocks to comply with x86_64 ABIs, which normally do not allow to change stack pointer at arbitrary locations. Register RBX is now saved/restored by compiler in function prologue, due to its presence in list of modified registers.

git-svn-id: trunk@34908 -
sergei 8 years ago
parent
commit
4ddbb7cd26
1 changed files with 2 additions and 6 deletions
  1. 2 6
      rtl/x86_64/cpu.pp

+ 2 - 6
rtl/x86_64/cpu.pp

@@ -135,12 +135,10 @@ unit cpu;
         _ebx : longint;
       begin
         asm
-           pushq %rbx
            movl $0x00000001,%eax
            cpuid
            movl %ecx,_ecx
-           popq %rbx
-        end;
+        end ['rax','rbx','rcx','rdx'];
         _InterlockedCompareExchange128Support:=(_ecx and $2000)<>0;
         _AESSupport:=(_ecx and $2000000)<>0;
 
@@ -157,13 +155,11 @@ unit cpu;
         _FMASupport:=_AVXSupport and ((_ecx and $1000)<>0);
 
         asm
-           pushq %rbx
            movl $7,%eax
            movl $0,%ecx
            cpuid
            movl %ebx,_ebx
-           popq %rbx
-        end;
+        end ['rax','rbx','rcx','rdx'];
         _AVX2Support:=_AVXSupport and ((_ebx and $20)<>0);
       end;