Inline assembler (Visual Studio): PUSHAD/FD & POPAD/FD nötig?
-
Hi!
Ist es nötig, in einem inline assembler-Block am Anfang PUSHAD/FD und am Ende POPAD/FD zu schreiben? Oder kann man einfach munter losschieben?
int a = 0; __asm { mov eax, a inc eax mov a, eax }
Ich verstehe nicht viel davon, aber ist garantiert, dass das Register eax frei ist, wird es durch diese inline-Anweisungen nicht vielleicht für die weitere Exekution verwurschtelt?
Danke im Voraus!
-
Dieser Thread wurde von Moderator/in rüdiger aus dem Forum Rund um die Programmierung in das Forum Assembler verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
Von http://msdn.microsoft.com/en-us/library/k1a8ss06(VS.71).aspx
When using __asm to write assembly language in C/C++ functions, you don't need to preserve the EAX, EBX, ECX, EDX, ESI, or EDI registers. For example, in the POWER2.C example in Writing Functions with Inline Assembly, the power2 function doesn't preserve the value in the EAX register. However, using these registers will affect code quality because the register allocator cannot use them to store values across __asm blocks. In addition, by using EBX, ESI or EDI in inline assembly code, you force the compiler to save and restore those registers in the function prologue and epilogue.