Subject: Lots of changes...
To: None <port-pmax@NetBSD.ORG>
From: Ted Lemon <mellon@vix.com>
List: port-pmax
Date: 01/17/1995 23:28:32
I just checked in a bunch of new changes to the pmax kernel code.
If you build with COMPAT_09 defined, you should now be able to run
most 4.4BSD pmax binaries.   You should also be able to run ELF
binaries.   I included a change that Jonathan submitted to the soft
interrupt code, and I've changed the debugging so that all the same
registers that can be accessed from Ultrix can also be accessed from
NetBSD.   Core dumps will also be dumped in NetBSD format instead of
the old style.

The code now assumes that if your compiler doesn't use leading
underscores, it defines the preprocessor macro __NO_LEADING_UNDERSCORES__.
If your compiler is like this but doesn't predefine that macro, you
can either make it do that (with gcc, just edit
$prefix/lib/gcc-lib/<arch>/<ver>/specs), or hack
arch/pmax/conf/Makefile.pmax.

The code also supports GP addressing, and assumes that the compiler
will predefine __GP_SUPPORT__ if it is doing GP addressing (actually,
the tools I'm currently using *always* define __GP_SUPPORT__, which is
somewhat bogus).   I've also taken out the -G0 argument in
Makefile.pmax and replaced it with $(GP), so you should set GP=-G0 in
the Makefile if your assembler doesn't support GP addressing but your
compiler does (possibly e.g., gcc with a.out).

I've checked in a number of changes to the boot block code.   You
still won't be able to build a sufficiently small boot block without
some changes to lib/libsa which I need to submit to the core team for
approval.   For now, if you need boot blocks, I can give you boot
blocks that work on (I think) all TurboChannel machines, and Jonathan
has boot blocks which work on most TurboChannel machines and also on
PMAXen.   My boot blocks will load either NetBSD or 4.4BSD a.out
formats.

I'm going to start uploading pieces of the distribution I built some
time tomorrow (I'm doing builds right now, which kills my SLIP line).
In order to use this distribution, you will need to build a kernel
with the code I just committed, because all the executables are ELF
executables.   The distribution is 50 megabytes, so unfortunately
it'll take a while to upload over my 14.4k link.

Oh, I lied about the 4.4BSD mips a.out support.   Part of the change
is to a file that's not in the PMAX tree, so the core team has to
approve it before it goes in.   For now, I've included the patch
below.   Keep it around, since if it doesn't pass muster, you'll have
to back it out and I'll have to put equivalent code into machdep.c.

If you aren't able to build a kernel yet but would like to try one
out, drop me some mail and I'll see if I can build one for you.   I
make no promises, though - if I get five requests, I'll probably be
able to do them, but if I get fifteen, I won't...

Obviously, if you try to use this code and lose horribly, let me know
and I'll do my best to fix it.   Jonathan, I didn't put in your
interrupt masking change because I wasn't able to get it working on
the MAXine before I left.   I can't see any reason why it doesn't
work, but it doesn't.   If you have a MAXine and can try it out,
please do.   And thanks for all the other changes you've submitted -
they've been a big help.

			       _MelloN_

diff -c -2 -r1.13 exec_aout.c
*** 1.13	1994/08/01 18:49:49
--- exec_aout.c	1995/01/18 06:34:47
***************
*** 115,118 ****
--- 115,129 ----
  	epp->ep_entry = execp->a_entry;
  
+ 	return exec_aout_map_zmagic (p, epp, execp -> a_text,
+ 				     execp -> a_data, execp -> a_bss);
+ }
+ 
+ exec_aout_map_zmagic (p, epp, text, data, bss)
+      struct proc *p;
+      struct exec_package *epp;
+      u_long text;
+      u_long data;
+      u_long bss;
+ {
  	/*
  	 * check if vnode is in open for writing, because we want to
***************
*** 120,125 ****
  	 * reasons
  	 */
! 	if ((execp->a_text != 0 || execp->a_data != 0) &&
! 	    epp->ep_vp->v_writecount != 0) {
  #ifdef DIAGNOSTIC
  		if (epp->ep_vp->v_flag & VTEXT)
--- 131,135 ----
  	 * reasons
  	 */
! 	if ((text != 0 || data != 0) && epp->ep_vp->v_writecount != 0) {
  #ifdef DIAGNOSTIC
  		if (epp->ep_vp->v_flag & VTEXT)
***************
*** 131,145 ****
  
  	/* set up command for text segment */
! 	NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, execp->a_text,
  	    epp->ep_taddr, epp->ep_vp, 0, VM_PROT_READ|VM_PROT_EXECUTE);
  
  	/* set up command for data segment */
! 	NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, execp->a_data,
! 	    epp->ep_daddr, epp->ep_vp, execp->a_text,
  	    VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
  
  	/* set up command for bss segment */
! 	NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss,
! 	    epp->ep_daddr + execp->a_data, NULLVP, 0,
  	    VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
  
--- 141,155 ----
  
  	/* set up command for text segment */
! 	NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, text,
  	    epp->ep_taddr, epp->ep_vp, 0, VM_PROT_READ|VM_PROT_EXECUTE);
  
  	/* set up command for data segment */
! 	NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, data,
! 	    epp->ep_daddr, epp->ep_vp, text,
  	    VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
  
  	/* set up command for bss segment */
! 	NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, bss,
! 	    epp->ep_daddr + data, NULLVP, 0,
  	    VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
  
--
Ted Lemon							 mellon@vix.com
+1 415 477 5045

Fight to preserve your freedom to program: Join the League for
Programming Freedom!   For info, contact lpf@uunet.uu.net.