Subject: pmax/mips HUGE modification
To: None <port-mips@NetBSD.ORG>
From: Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
List: port-mips
Date: 03/03/1997 13:43:30
Hi, all.

I have been involved with NetBSD/pmax since last summer, and
accumulated source code modifications in arch/{mips,pmax}.

The modification is toward cleanup on the core code of mips/pmax;
locore.S, trap.c, and so-on, reminding as generic as possible.
Though, because I don't have "R4000-NetBSD-capable" machine at hand,
my modification seems to hurt mips3 compatibility a little.  That's
the reason why I make this public to port-mips.  Anyone interested in
mips1/mips3 portability in NetBSD/mips out there, please incorporate
my modifications into NetBSD, and enhance as you wish.

I placed cxt-diff at;

	ftp.aist-nara.ac.jp:/pub/personal/nisimura/NetBSDpmax.diff

The diff can be applied recent version of NetBSD-current sys source tree.
I made the diff using 1997-2-15-time-stamped sys.tar.gz.

	$ cd <what-so-ever>/sys/arch
	$ patch -c < NetBSDpmax.diff

Here is the description of what I changed.

//// FILES WERE CHANGED ////
	pmax/pmax/machdep.c
	pmax/pmax/pmap.c
	pmax/pmax/vm_machdep.c
	pmax/pmax/locore_machdep.S
	mips/include/pcb.h
	mips/include/proc.h
	mips/include/reg.h
	mips/include/types.h
	mips/include/cpu.h
	mips/include/mips_opcode.h
	mips/include/locore.h
	mips/mips/genassym.c
	mips/mips/locore.S
	mips/mips/locore_r2000.S
	mips/mips/trap.c

//// LIST OF CHANGES (ORDER DOES NOT REFLECT CHRONOLOGICALS) ////

* proc_trampoline()::vm_machdep.c, locore.S
	Fork internal obscurness was gone.   Long lives fork!!

        fork()ed child returns to user process differently than
        fork()ing parent.  main() now never returns.

	NetBSD/mips now doesn't need to have __FORKBRAINDAMAGE
	any more in mips/include/types.h.
	__cpu_set_init_frame is gone too.

* mips/include/proc.h, pcb.h, reg.h
	Proc structure was slightly changed.  The ultimate goal is
	to move so-called "trapframe" from struct proc to the very
	top of kernel stack just like as other NetBSD port.  In other
	words, fixed address reference to UADDR is to be discarded.

	The modification is still underway because guards against TLB
	misses have not done yet for a few number of global variables
	references in locore.S critial sections.

* locore.S, trap()::trap.c
        Change onfault handling.  KernGenException now takes frame[PC] value
        instead of trap()'s return value.  pcb_onfault entry in PCB now
        holds onfault handler address just like as other NetBSD does.  Gone
        onfault_table[].

* SystemCall()::locore.S, syscall()::trap.c
        System call processing is now done separately from trap().

* trap()::trap.c
        trap() now has true struct frame in the 5th arg.

* trap()::trap.c
        Amazing.  Call by reference behaves weirdly.  To refer to trapframe
        component correctly, offset by 2 is required; f_regs[??+2].

* include/pcb.h
        change pcb_regs[71] into pcb_regs[38] and pcb_fpregs[33].
        pcb_regs[38] will be eventually elimiated.

* sendsig()::machdep.c
        change single register bcopy() into 2 bcopy()s in sigcontext; one
        for regular reg, another for FP reg.

* setregs()::machdep.c
        two bzero()s for clean initial register values; one for
        regular reg, another for FP reg.

* incomplete MINIDEBUG facility ported in mips/trap.c from NetBSD/pica.
	Better-than-nothing quality.  trapDump() routines are discarded
	because I experienced they were useless.


I failed to memorize all of my modifications (and their intensions).
The diff code tells truth.  I'm open-minded to change my modifications
for more general NetBSD/mips portabilities.
I hope my codes contribute the quality of NetBSD/mips.  Please, someone
responsible to maintain NetBSD source tree, verify my codes and incorporat
some of them into NetBSD.

Another story;  I will obtain R4000 based NEC computer in near future
in addition to DECstation 5000/25.  Then, I can jump on NetBSD/arc band
wagon.

Tohru Nishimura
Nara Institute of Science and Technology