flat assembler
Message board for the users of flat assembler.

Index > Windows > proc, disable frame setup?

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
revolution,

Use it as you wish and reload with lea ebp, [esp+X] when you need to access locals/parameters again.
Post 15 Feb 2010, 17:22
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17343
Location: In your JS exploiting you and your system
revolution
baldr wrote:
Use it as you wish and reload with lea ebp, [esp+X] when you need to access locals/parameters again.
Sure, but then you get the "what is esp pointing to?" problem again. If you are playing nicely with the macros then you won't have used push/pop and you will always remember to reload ebp before using invoke/ccall/cinvoke/stdcall with local parameters. And what if you still want to use the value in ebp for something? You have to save it somewhere, which brings us back to the "what is esp pointing to?" problem.
Post 15 Feb 2010, 17:33
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
revolution,

That's the problem: if you know where esp points, you can use it for addressing (and spend extra byte for each), or maintain ebp and forget it altogether.

Valid stack frame is useful for unwinding too (though it's rarely used in assembly).
Post 15 Feb 2010, 18:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17343
Location: In your JS exploiting you and your system
revolution
Yes, there are many disadvantages. This is why I made it an opt-in parameter in my macros. Only when you knew it would be beneficial and that potential traps were understood then one could use the ESP based frame. However the OP of this thread wanted to completely eliminate EBP frames. I tried to warn that this may not be a good idea. One has to consider all the potential problems, and decide whether or not it is good, at the granularity of the individual function, not on the whole program.
Post 15 Feb 2010, 19:05
View user's profile Send private message Visit poster's website Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
I'm at least going to try to keep ebp pointing to my "data segment" as much as I can, see if it is profitable. Would have been nice to be able to use es:[] or something in Windows.
Post 15 Feb 2010, 20:23
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
Cool trick!

I would use this for better clarity though...
Code:
ret 4*4    

Or even this way...
Code:
ret 16    

I just think hex should be used when appropriate
and the same goes for decimal or binary or whatever.
Just for clarity, but to each his own...
But anyway, nice work, i like it!
Post 18 Feb 2010, 09:53
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< 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. Also on YouTube, Twitter.

Website powered by rwasa.