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.
Regards, Carl-Daniel