[coreboot] [PATCH] cld before call

Robert Millan rmh at aybabtu.com
Wed Jul 29 02:44:52 CEST 2009

On Wed, Jul 29, 2009 at 02:21:38AM +0200, Carl-Daniel Hailfinger wrote:
> On 29.07.2009 00:36, Robert Millan wrote:
> > The Multiboot spec is a bit too permissive about this, as it doesn't
> > specify the state of direction flag when payload is called.  Some payloads
> > (we found this in ReactOS FreeLDR) assume it is cleared, and fail otherwise.
> >
> > We adjusted GRUB to be sure it's always cleared.  I think coreboot should do
> > the same.  Here's a patch for v3.
> >   
> AFAIK this patch is unneeded. The GCC ABI on x86 and x86_64 states that
> the direction flag must always be cleared before running any gcc
> compiled code, so if you need to execute cld in the middle of C code, it
> means that all C code before that cld had undefined behaviour.
> The correct place for cld is early asm startup code before any C code
> gets executed.

Isn't C code allowed to set it back?

Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."

More information about the coreboot mailing list