#define save_flags(x) \
__asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */ :"memory")
#define restore_flags(x) \
__asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory")
I wonder why we need a "memory" here. can anybody enlighten me?
Getting rid of it would allow gcc to store
the flags in a register instead of in a memory location.
Writing pushf/popf (or general push/pop) macros would
require some (probably small) changes in gcc. gcc currently
neither allows the (correct) "=<" cxontraints, nor actually
uses the information correctly. try:
register int esp asm("esp"); esp-=4;
it will not always work...
---------------------------------------------------------------------
for a pentium-optimizing gcc, look at http://www.goof.com/pcg
-----==-
----==-- _
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / mlehmann@hildesheim.sgh-net.de
-=====/_/_//_/\_,_/ /_/\_\ pcg@goof.com
The choice of a GNU generation