Re: sun2 and playstation2 ports to be moved into Attic

[email protected] Fri, 13 Nov 2009 10:54:33 -0500
Newsgroups gmane.os.netbsd.ports.m68k,gmane.os.netbsd.current,gmane.os.netbsd.ports.sun2
Message-ID <[email protected]>
[added port-sun2 and port-m68k]

>> What's different between it and other m68k ports? I've never seen a
>> clear explanation.
>
> There isn't much of a difference. You have to support an 68010
> and the SUN MMU (which is similar to the sun3 MMU).

The older m68010 is missing some instructions and addressing
modes that the later m68k CPUs have, which gcc (last I looked,
a long time ago) required for -fPIC:

#1  No PC-relative call instruction with a 32-bit displacement.
     (In the non-PIC case, the jsr instruction can take an absolute
     32-bit address.)

#2  No register plus 32-bit displacement effective address form, used
     to get addresses of globals from the GOT.  (In the non-PIC case,
     there is an absolute 32-bit address form for addresses of globals.)

However, SunOS did have shared libraries on the m68010.  If I remember
right, their solutions for the above were:

#1  Put the 32-bit displacement into an address register (%a0,
     destroyed by the calling convention anyways) and use a jsr
     with the PC+register addressing mode.

#2  Put the 32-bit displacement into an address register (probably
     the same one you want to load the GOT entry into) and then load
     the GOT entry using the PC+register addressing mode.

Maybe in the last few years somebody got gcc -m68000 -fPIC to work,
maybe for an embedded m68k that has the same shortcomings as the m68010?
I think that gcc -m68000 -fpic already did work, but most modern libraries
are probably too big for that.  Which brings me to:

#3  The m68010 virtual address space is only 16MB.  One nice thing about
     static libraries is only the .o files that you need end up in your
     process' address space.  You have to take all of a shared library.
     This was probably not much of an issue on SunOS/sun2 because libraries
     were smaller back then.

--
Matt Fredette (former sun2 portmaster)