Recent

Author Topic: GLScene VectorGeometry.pas (formerly Geometry.pas) bug  (Read 3391 times)

sapper

  • New Member
  • *
  • Posts: 35
GLScene VectorGeometry.pas (formerly Geometry.pas) bug
« on: October 26, 2014, 05:34:09 am »
The ASM block in the initialization may need to be changed if used.

Code: [Select]
      asm
         pusha
         mov  eax, $80000000
         db $0F,$A2               /// cpuid
         cmp  eax, $80000000
         jbe @@No3DNow
         mov  eax, $80000001
         db $0F,$A2               /// cpuid
         test edx, $80000000
         jz @@No3DNow
         mov vSIMD, 1
@@No3DNow:
         popa
      end;


Because of http://wiki.lazarus.freepascal.org/User_Changes_2.6.0#Operation_size_of_pushf.2Fpopf.2Fpusha.2Fpopa_in_Intel-style_inline_assembly

Quote
Operation size of pushf/popf/pusha/popa in Intel-style inline assembly

    Old behaviour: The default operation size of the pushf/popf/pusha/popa in Intel-style inline assembly was the native size (32 bit on i386, 64 bit on x86-64).
    New behaviour: The default operation size of these opcodes is now always 16 bit in Intel-style inline assembly. In AT&T-style inline assembly, the size remains the native size.
    Reason: This is how the behaviour of these opcodes is defined in the Intel manuals, and it is also Delphi-compatible. The behaviour was not changed in AT&T-inline assembly because that dialect defines the default size of these operations as the native size.
    Remedy: Explicitly specify the size when using such operations, e.g. pushfd, popfq, pushad, ... Note that pusha*/popa* do not exist on x86-64, and neither do pushfd/popfd (the compiler previously however erroneously accepted these opcodes when compiling for x86-64).

This ASM code caused a very annoying bug for me in Delphi.

See this thread.

https://forums.embarcadero.com/thread.jspa?threadID=109450&tstart=0


I do not know how to report the bug/feature request so if someone could do that I would appreciate it.

 

TinyPortal © 2005-2018