Subject: Re: sparc/sparc64
To: None <soren@t.dk, thorpej@nas.nasa.gov>
From: Chris Torek <torek@BSDI.COM>
List: port-sparc
Date: 07/07/1998 21:59:03
>I think a lot of merging can be done w/ sparc vs. sparc64 ...

For comparison (and maybe to hold down some divergence too), the
BSD/OS Ultrasparc code currently shares the sparc/include directory
(via a symlink, actually -- sparc_v9/include is a symlink to
../sparc/include), then uses #ifdef's for some stuff so that by default,
most users get V8-style data structures.  I renamed things like
"struct pcb" to "struct pcb_v8", for instance, and added a "pcb_v9",
and have:

	/*
	 * If only we could define the token <struct pcb> ... this method is
	 * a horrible hack, but avoids repeating the "struct" definition.
	 */
	#ifndef pcb
	#if defined(__sparc_v9__) || defined(SPARCV9)
	#define pcb     pcb_v9
	#else
	#define pcb     pcb_v8
	#endif /* v9 */
	#endif /* pcb */

in pcb.h; reg.h has:

	#include <machine/reg.v8.h>
	#include <machine/reg.v9.h>

	/*
	 * Oh me oh my... the wonders of compatibilty.
	 */
	#if defined(__sparc_v9__) || defined(SPARCV9)
	#define trapframe       trapframe_v9
	#define memfault_regs   memfault_regs_v9
	#define fpstate         fpstate_v9
	#else
	#define trapframe       trapframe_v8
	#define memfault_regs   memfault_regs_v8
	#define fpstate         fpstate_v8
	#endif

and then defines both an "rwindow32" and an "rwindow64", and so on.
("Gross, but effective.")

Chris