Re: preserving flags across inline assembler blocks




ah. I missed the part about *inline*. You will then have to just consider
the calling convention used, and worry mainly about the registers you use
within the __asm block, as well as the ESP and EBP unless you need to switch
stacks.

But you should also be aware that register values are not guaranteed to be
preserved across separate __asm blocks. If you need this, then preserve the
EAX, EBX, ECX, EDX, ESI, EDI registers.
The __asm block inherits whatever register values result from the normal
flow of control. If you use the STD or CLD instructions to change
direction, you will need to restore the original direction flag.


snow.


"Bertrand Augereau" wrote:
> Well he speaks of asm inline blocks, not asm functions, I guess.
> And he wants to know if he has to preserve all the flags, or if it is not
> necessary, which is a different matter.


.



Relevant Pages

  • Re: Pushing 1-byte bool?
    ... asm block really shouldn't be messing with it or, rather, if you do mess ... The input constraints following the second colon force gcc to put the ... I chose these particular registers because the x86 ... assembly code since the called function is free to do so (and hence gcc ...
    (comp.lang.asm.x86)
  • Re: Test whether rdmsr instruction is supported.
    ... using declspecthen registers should be saved. ... Yes and no:) If you are changing ECX in _asm block inside class function, ... class functions and compiler does not save it. ...
    (microsoft.public.development.device.drivers)
  • Re: register assignments in C code
    ... to allow direct access to specific registers eg ... cf. "Variables in Specified Registers" ... use in a #asm block then you might be able to accomplish what you describe ...
    (comp.sys.arm)
  • Re: register assignments in C code
    ... to allow direct access to specific registers eg ... cf. "Variables in Specified Registers" ... the compiler doesn't know about banked registers in FIQ ... use in a #asm block then you might be able to accomplish what you describe ...
    (comp.sys.arm)
  • Re: What is the gain of "inline"
    ... The "inline" directive slows down a program by bloating its code. ... compiler (if they are to be, in fact, located on the stack). ... in the branch delay slot, ... having to spill any values in any caller-save/scratch registers; ...
    (comp.lang.c)