Subject: Re: mac68k and gcc 4
To: Dave Huang <khym@azeotrope.org>
From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
List: port-mac68k
Date: 09/04/2006 02:02:15
Just a few uninformed comments...

At 3:22 Uhr -0500 3.9.2006, Dave Huang wrote:
>I tried building a -current mac68k kernel with the newly-imported gcc
>4, and ran into a few errors, most of which I'm not too sure about
>how to solve.

[...]

>I run into another problem in macrom.c:
>/usr/src.local/sys/arch/mac68k/mac68k/macrom.c: In function 'mrg_aline_super':
>/usr/src.local/sys/arch/mac68k/mac68k/macrom.c:728: error: unknown
>register name 'fp' in 'asm'
>
>/* 	put a0 in a0 */
>/* 	put a1 in a1 */
>/* 	put d0 in d0 */
>/* 	put d1 in d1 */
>/*	put trapaddr in a2 */
>/* save a6 */
>/* 	call the damn routine */
>/* restore a6 */
>/* 	store d0 in d0bucket */
>/* 	store a0 in d0bucket */
>/* This will change a2,a1,d1,d0,a0 and possibly a6 */
>
>	__asm volatile (
>	"	movl	%2@,%%d0	\n"
>	"	movl	%2@(4),%%d1	\n"
>	"	movl	%2@(32),%%a0	\n"
>	"	movl	%2@(36),%%a1	\n"
>	"	movl	%3,%%a2		\n"
>	"	jbsr	%%a2@		\n"
>	"	movl	%%a0,%0		\n"
>	"	movl	%%d0,%1"
>
>		: "=g" (a0bucket), "=g" (d0bucket)
>
>		: "a" (&frame->f_regs), "g" (trapaddr)
>
>		: "d0","d1","a0","a1","a2",
>#ifdef __ELF__
>			  "fp"
>#else
>			  "a6"
>#endif
>
>I don't know why the clobber register spec is "fp" for ELF and "a6"
>otherwise...

The pre-ELF as(1) was considerably older (and had changes not fed back to
GNU as) than the ELF as(1) from binutils that replaced it. What does the
netbsd-4 info page for as(1) say?

>isn't "fp" just an alias for "a6"? I tried changing it to
>use "a6" unconditionally, but that doesn't work either:
>
>/usr/src.local/sys/arch/mac68k/mac68k/macrom.c: In function 'mrg_aline_super':
>/usr/src.local/sys/arch/mac68k/mac68k/macrom.c:763: error: %a6 cannot be
>used in asm here
>
>The comments say "save a6" and "restore a6", but I don't see where
>that happens.

Nor do I. Ask Allen Briggs, since according to 'cvs annotate' he added the
comments.  ;)

> They also say that it'll possibly change A6, but I don't
>see when that would happen either.

Ask Scott Reynolds, since... see above. Although Allen may be easier to reach.

> Are there some ROM toolbox calls
>that will modify A6? That seems like it'd be a bad thing for a
>subroutine to not restore the frame pointer...
>
>Anyways, I don't know if it's the right thing to do, but I just
>removed fp/a6 from the list of clobbered registers.
>
>That gets us past macrom.c and on to this:

[...]

Did you get a working kernel in the end? I have an idle Quadra 650 around
that I could drop a snapshot of netbsd-4 onto...

	hauke

--
"It's never straight up and down"     (DEVO)