Einzelnen Beitrag anzeigen

Benutzerbild von jaenicke
jaenicke

Registriert seit: 10. Jun 2003
Ort: Berlin
9.362 Beiträge
 
Delphi 11 Alexandria
 
#10

AW: XE2 neue calling convention

  Alt 13. Sep 2011, 05:16
In der Hilfe steht das so:
Zitat:
The first four parameters to inline assembler functions are passed via RCX, RDX, R8, and R9 respectively, except for floating-point arguments which use XMMO, XMM1, XMM2, XMM3. The math coprocessor is not normally used from x64 code. Registers used for function parameters can be modified freely.
Nebenbei kannst du statt das Register für das Ergebnis direkt anzusprechen auch @Result benutzen.

Ich habe es gerade kurz ausprobiert, bei mir geht es auch mit RCX und RDX und deine Variante knallt. Auswertung:

xe2parameterasm.jpg

Das geht bei mir:
Delphi-Quellcode:
  function IsClass(AObject: Pointer; AClass: TClass): Boolean;
  asm // safer replacement for Delphi's "is" operator
          MOV @Result,0
  @@1: TEST RCX,RCX
          JE @@3
          MOV RCX,[RCX]
          TEST RCX,RCX
          JE @@3
          CMP RCX,RDX
          JE @@2
          MOV RCX,[RCX].vmtParent
          JMP @@1
  @@2: MOV @Result,1
  @@3:
  end;
Sebastian Jänicke
Alle eigenen Projekte sind eingestellt, ebenso meine Homepage, Downloadlinks usw. im Forum bleiben aktiv!
  Mit Zitat antworten Zitat