flat assembler
Message board for the users of flat assembler.

Index > Windows > What Gets Clobered?

Author
Thread Post new topic Reply to topic
calm_observer



Joined: 08 Jan 2005
Posts: 17
Location: New Nexico, USA
calm_observer
What registers get 'clobered' by windows functions? For sure, eax, ecx, and edx do, but what about ebx? Also I know that esi and edi have to be preserved in a winproc proceedure and it should be safe to assume ebp is preserved.

eax...clobered
ebx...??&?
ecx...clobered
edx...clobered
edi...save and restore in winproc otherwise safe?
esi...save and restore in winproc otherwise safe?
ebp...safe

_________________
EDUCATION, n.
That which discloses to the wise and disguises from the foolish their lack of understanding.
Post 21 Feb 2005, 17:15
View user's profile Send private message Reply with quote
calm_observer



Joined: 08 Jan 2005
Posts: 17
Location: New Nexico, USA
calm_observer
surely someone has an answer for ebx, edi and esi?...johnfound?
Post 22 Feb 2005, 19:25
View user's profile Send private message Reply with quote
r22



Joined: 27 Dec 2004
Posts: 805
r22
ebx, edi and esi are protected by 99% of windows functions (IE pushed before and pop'd after if used)

mov esi, 99h
mov ebx, 99h
mov edi, 99h
call [WINDOWS API]
;ESI = EDI = EBX
Post 23 Feb 2005, 04:49
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
calm_observer



Joined: 08 Jan 2005
Posts: 17
Location: New Nexico, USA
calm_observer
thanks r22...do you have any links on this subject? Or actually any links you think may be of use? Thanks again.
Post 23 Feb 2005, 17:20
View user's profile Send private message Reply with quote
drocon



Joined: 14 Nov 2004
Posts: 8
drocon
i can't think up of an API that doesn't preserve the three for normal use, it's stdcall standard (and common sense). if you're just coding low, ebp can also be used as a general-purpose register (and quite handy too). esi/edi should be saved for string operations, so ebx/ebp could be used. it's all preference.
Post 24 Feb 2005, 06:59
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
And remember that you need to preserve ebx,esi,edi,ebp yourself in callbacks, as well as the direction flag.
Post 24 Feb 2005, 16:26
View user's profile Send private message Visit poster's website Reply with quote
calm_observer



Joined: 08 Jan 2005
Posts: 17
Location: New Nexico, USA
calm_observer
thanks drocon and f0dder...
Post 24 Feb 2005, 17:55
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.