[coreboot] [PATCH] fix stage0_i586.S in v3

Patrick Georgi patrick at georgi-clan.de
Fri Apr 4 08:33:40 CEST 2008


Am Freitag, den 04.04.2008, 08:04 +0200 schrieb Carl-Daniel Hailfinger:
> On 04.04.2008 04:40, Stefan Reinauer wrote:
> > The idea to this patch is from Patrick Georgi but I reimplemented it
> > from scratch since I can't reach the other box for a few days. It
> > fixes stage0_i586.S assembling on the latest official GNU binutils
> > version. Without this patch the compilation fails with:

> > /Users/stepan/Devel/coreboot-v3/arch/x86/stage0_i586.S:345: Error:
> > expecting operand after ','; got nothing

> Sorry, that patch only papers over the bug. If we ever decide to use
> CAR
> at another location, this will break again and we'll have to duplicate
> some of the code you touched in the patch. I'd prefer to know why a
> division fails, but a subtractoin succeeds.
parentheses fail in the gnuas macros. for some reason, when copying the
arguments, gnu as (in that defective version) stops after the first
closing ')', making the whole statement invalid.

My change (which this is based on) actually removed them all except the
outermost level, but gnuas seems to be clever enough to remove unneeded
parens before passing things on. That's possible if there are only 
subtractions, but not when mixed with divisions like in the original
version.

The original code says this:
 extractmask (((\carsize - \windowoffset) / 0x1000) - 4), %eax

extractmask is a macro with 2 arguments, segs [== (((\carsize -
\windowoffset) / 0x1000) - 4)] and reg [== %eax].
At some point, extractmask does:
.if \segs <= 0

which should expand to
.if (((\carsize - \windowoffset) / 0x1000) - 4) <= 0

but which - due to the bug - really expands to
.if (((\carsize -  \windowoffset) <= 0

et voila: "missing ')'"


Regards,
Patrick Georgi





More information about the coreboot mailing list