Re: x86 D flag: what's its status thru the program?

Denis Zaitsev <[email protected]> Mon, 5 Jul 2004 22:26:48 +0600
Newsgroups org.kernel.vger.linux-gcc
Message-ID <[email protected]>
On Mon, Jul 05, 2004 at 03:23:44PM +0200, Lukasz Michal Rak wrote:
> 
> 	Hi all!
> 
>  The convention is that the D flag in IA32 is cleared. So if you call a
> subroutine you have to clear D flag before making call.

Do you mean that 'I have to clear the D flag if I had set it somewhere
before?'  Else what is the sense of the convention?

> The subroutine can change the state of D flag, but before returning
> the routine has to clear the D flag.

If the subroutine can change the flag, that it will violate the
convention, won't it?  And what is the strength of the convention,
again?

>  Hope I helped.

Thanks, but I still don't understand something.  Again: if every
procedure keeps the flag clear at exit, then why the same every
procedure clears it at entry?  In a suspicion, that caller has changed
the flag against the rules?

>  Regards,
> 
> 			Lukasz
> 
> 
> > Is this Direction flag (for the movs instructions) has some assumed
> > value (say, as after cld)?  I ask because the many program sources
> > show interesting behaviour: from one side, this flag is always set
> > before the string insns (cld or std), but from the other side, if the
> > programs does std then it always does cld after.  So, nobody leaves it
> > set, but nevertheless, everybody set it clear.  Why?
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-gcc" in
> > the body of a message to [email protected]
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
>