inline assembler modify esp

Kimmo Fredriksson kfredrik@cs.joensuu.fi
Thu Nov 27 20:06:00 GMT 2003


On Thu, 27 Nov 2003 y2bismil@engmail.uwaterloo.ca wrote:

<snip>

> pushfl modifies the stack so some stack operations hardcoded by GCC are causing
> problems.  If somefunctioncall is inlined, that helps a lot.
>
> I was thinking of doing something like this (rough syntax).
> ***************************
> int a;
> pushfl
> popl a
>
> somefunctioncall(a, b, c)
>
> pushl a
> popfl
> ***************************
>
> The only issue with that is that this type of coding (pushfl, popfl) are
> assembler defines used all over the place.  Sometimes in a hierachy of such
> calls.  These cases will have to be done on a 1 to 1 basis.

Is somefunctioncall something you have written by yourself? If so, why not
make that function save/restore the flags? And if the functions are
inlined, and you call several of them in a row, maybe gcc optimizes some
pops/pushs away... Maybe not an answer to your question, just wondering...


>
> Yamin
>
> ----------------------------------------
> This mail sent through www.mywaterloo.ca
>



More information about the Gcc-help mailing list