Mail Archives: djgpp/1997/11/30/00:48:54
On Tue, 25 Nov 1997 11:15:54 +0200 in comp.os.msdos.djgpp Henri Ossi <henri DOT ossi AT mail DOT htk DOT fi> wrote:
: A quick question.
: Do I have to push and pop all the registers, which I use in inline asm?
: What about return values?
: Can I leave a number in ax to tell the calling function, if there was
: any errors (etc)?
: Or do I have to use a variable to store the number and then use
: "return"?
I suggest you refer to Brennan's Guide to AT&T Inline Assembler:
http://brennan.home.ml.org/djgpp/djgpp_asm.html
In basic assembler you need to preserve all registers. In extended
assembler you can clobber them if you like, but you must tell gcc that
you're doing it -- see Brennan's section on extended assembler, or the
documentation for gcc.
To return a value I think you should go via a variable -- I don't
think gcc guarrantees that it won't change the value of %ax. The
simplest way to do this is, again, through extended assembler.
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
- Raw text -