flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
RedGhost 29 Sep 2006, 22:40
When you have a DLLEXPORT it doesn't declare its convention, you declare that in the HLL
![]() basic "proc" with a "ret" in it is stdcall anyways. _________________ redghost.ca |
|||
![]() |
|
okasvi 30 Sep 2006, 13:55
RedGhost wrote: basic "proc" with a "ret" in it is stdcall anyways. wrong, you still have to preserve right registers, Code: ;stdcall-calling convention is the default, other one that ;fasm macros support is cdecl-calling convention proc StdCallProc uses esi edi ebx, params ;do something and return result in eax ;of course you can leave esi, edi or ebx out of 'uses *' if you dont use of them... ret endp _________________ When We Ride On Our Enemies support reverse smileys |: |
|||
![]() |
|
DustWolf 30 Sep 2006, 16:01
okasvi wrote: you still have to preserve right registers, That works great for me, thanks! ![]() |
|||
![]() |
|
RedGhost 30 Sep 2006, 18:12
okasvi wrote:
Considering it is a proc for my own use, I normally don't bother ![]() Also, the register preserving is Windows specific and not specific to the stdcall convention. Which is platform independant. _________________ redghost.ca |
|||
![]() |
|
UCM 30 Sep 2006, 21:09
Actually, register preserving *is* part of stdcall.
|
|||
![]() |
|
RedGhost 01 Oct 2006, 09:12
UCM wrote: Actually, register preserving *is* part of stdcall. Quote:
All I see is that there is no promise that ecx, ecx, or edx will be preserved across the call, when infact esi, edi and ebx go unmentioned. _________________ redghost.ca |
|||
![]() |
|
okasvi 01 Oct 2006, 20:38
RedGhost wrote:
You shouldnt rely on wikipedia that much... Quote: Registers EAX, ECX, and EDX are preserved for use within the function. Return values are stored in the EAX register. oh and I suggest reading http://www.agner.org/optimize/calling_conventions.pdf especially part "6. Register Usage", it has an table that shows ebx, esi, edi, and ebp are 'callee-saves' registers in win32/linux/bsd/mac stdcall... _________________ When We Ride On Our Enemies support reverse smileys |: |
|||
![]() |
|
RedGhost 01 Oct 2006, 20:52
okasvi wrote:
ecx, edx and eax getting trashed is exactly what I said above..... "there is no promise they will get preserved..." and I've done enough reversing in my time to know that from HLL generation push ebx or push esi followed by a pop before return is something you rarely see (: Infact most winapi don't even do this. _________________ redghost.ca |
|||
![]() |
|
okasvi 01 Oct 2006, 21:12
umm, who said ecx, edx, and eax would get preserved? I thought we were having debate if ebp, ebx, esi, edi are preserved or not... I'd like to see an win32api func which trashes ebp, ebx, esi or edi....
|
|||
![]() |
|
Maverick 02 Oct 2006, 05:28
RedGhost wrote: ..I've done enough reversing in my time to know that from HLL generation push ebx or push esi followed by a pop before return is something you rarely see (: Infact most winapi don't even do this. If they don't is just because they do not modify those registers. There's no need to save/restore something you don't modify, research before making assumptions. Or show some compiler generated code that trashes EBX or ESI, as you said above. _________________ Greets, Fabio |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.