sun3 port updated. netboot integrated.

This commit is contained in:
glass 1993-10-12 05:17:41 +00:00
parent 63a052d489
commit 8585a64107
34 changed files with 1401 additions and 196 deletions

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/m68k/m68k/copy.s,v 1.3 1993/08/28 15:37:25 glass Exp $
* $Header: /cvsroot/src/sys/arch/m68k/m68k/copy.s,v 1.4 1993/10/12 05:25:41 glass Exp $
*/
.text
@ -44,6 +44,8 @@ ENTRY(copyinstr)
movl #Lcisflt1,a0@(PCB_ONFAULT) | set up to catch faults
movl sp@(4),a0 | a0 = fromaddr
movl sp@(8),a1 | a1 = toaddr
moveq #FC_USERD, d1
movec d1, sfc
moveq #0,d0
movw sp@(14),d0 | d0 = maxlength
jlt Lcisflt1 | negative count, error
@ -56,6 +58,8 @@ Lcisloop:
jne Lcisflt2 | ran out of room, error
moveq #0,d0 | got a null, all done
Lcisdone:
moveq #FC_CONTROL, d1
movec d1, sfc
tstl sp@(16) | return length desired?
jeq Lcisret | no, just return
subl sp@(4),a0 | determine how much was copied
@ -84,6 +88,8 @@ ENTRY(copyoutstr)
movl #Lcosflt1,a0@(PCB_ONFAULT) | set up to catch faults
movl sp@(4),a0 | a0 = fromaddr
movl sp@(8),a1 | a1 = toaddr
moveq #FC_USERD, d1
movec d1, dfc
moveq #0,d0
movw sp@(14),d0 | d0 = maxlength
jlt Lcosflt1 | negative count, error
@ -96,6 +102,8 @@ Lcosloop:
jne Lcosflt2 | ran out of room, error
moveq #0,d0 | got a null, all done
Lcosdone:
moveq #FC_CONTROL, d1
movec d1, dfc
tstl sp@(16) | return length desired?
jeq Lcosret | no, just return
subl sp@(4),a0 | determine how much was copied
@ -157,6 +165,8 @@ ENTRY(copyin)
movl d2,sp@- | scratch register
movl _curpcb,a0 | current pcb
movl #Lciflt,a0@(PCB_ONFAULT) | set up to catch faults
moveq #FC_USERD, d1
movec d1, sfc
movl sp@(16),d2 | check count
jlt Lciflt | negative, error
jeq Lcidone | zero, done
@ -192,6 +202,8 @@ Lcibloop:
Lcidone:
moveq #0,d0 | success
Lciexit:
moveq #FC_CONTROL, d1
movec d1, sfc
movl _curpcb,a0 | current pcb
clrl a0@(PCB_ONFAULT) | clear fault catcher
movl sp@+,d2 | restore scratch reg
@ -210,6 +222,8 @@ ENTRY(copyout)
movl d2,sp@- | scratch register
movl _curpcb,a0 | current pcb
movl #Lcoflt,a0@(PCB_ONFAULT) | catch faults
moveq #FC_USERD, d1
movec d1, dfc
movl sp@(16),d2 | check count
jlt Lcoflt | negative, error
jeq Lcodone | zero, done
@ -245,6 +259,8 @@ Lcobloop:
Lcodone:
moveq #0,d0 | success
Lcoexit:
moveq #FC_CONTROL, d1
movec d1, dfc
movl _curpcb,a0 | current pcb
clrl a0@(PCB_ONFAULT) | clear fault catcher
movl sp@+,d2 | restore scratch reg
@ -257,6 +273,8 @@ Lcoflt:
* {fu,su},{byte,sword,word}
*/
TWOENTRY(fuword,fuiword)
moveq #FC_USERD, d1
movec d1, sfc
movl sp@(4),a0 | address to read
movl _curpcb,a1 | current pcb
movl #Lfserr,a1@(PCB_ONFAULT) | where to return to on a fault
@ -264,6 +282,8 @@ TWOENTRY(fuword,fuiword)
jra Lfsdone
ENTRY(fusword)
moveq #FC_USERD, d1
movec d1, sfc
movl sp@(4),a0
movl _curpcb,a1 | current pcb
movl #Lfserr,a1@(PCB_ONFAULT) | where to return to on a fault
@ -272,6 +292,8 @@ ENTRY(fusword)
jra Lfsdone
TWOENTRY(fubyte,fuibyte)
moveq #FC_USERD, d1
movec d1, sfc
movl sp@(4),a0 | address to read
movl _curpcb,a1 | current pcb
movl #Lfserr,a1@(PCB_ONFAULT) | where to return to on a fault
@ -282,10 +304,14 @@ TWOENTRY(fubyte,fuibyte)
Lfserr:
moveq #-1,d0 | error indicator
Lfsdone:
moveq #FC_CONTROL, d1
movec d1, sfc
clrl a1@(PCB_ONFAULT) | clear fault address
rts
TWOENTRY(suword,suiword)
moveq #FC_USERD, d1
movec d1, dfc
movl sp@(4),a0 | address to write
movl sp@(8),d0 | value to put there
movl _curpcb,a1 | current pcb
@ -295,6 +321,8 @@ TWOENTRY(suword,suiword)
jra Lfsdone
ENTRY(susword)
moveq #FC_USERD, d1
movec d1, dfc
movl sp@(4),a0 | address to write
movw sp@(10),d0 | value to put there
movl _curpcb,a1 | current pcb
@ -304,6 +332,8 @@ ENTRY(susword)
jra Lfsdone
TWOENTRY(subyte,suibyte)
moveq #FC_USERD, d1
movec d1, dfc
movl sp@(4),a0 | address to write
movb sp@(11),d0 | value to put there
movl _curpcb,a1 | current pcb
@ -311,3 +341,5 @@ TWOENTRY(subyte,suibyte)
movsb d0,a0@ | do write to user space
moveq #0,d0 | indicate no fault
jra Lfsdone

View File

@ -1,35 +1,25 @@
<$Revision: 1.4 $>
<$Revision: 1.5 $>
This is to be a summary of the status of code, its problems,
and the directions it should and take in the future.
Summary: Tries to exec init but can't since there I don't have one compiled
for it. Does see icode syscalls though.
The major bugs:
the clock interrupts are coming at a rate 100 times greater than
they are programmed for. When the clock interrupts are going
at this rate, and the clock interrupt is calling hardclock(),
it makes no progress beyond enablertclock(). this bug is
priority one. Until this works, we won't be able to get
nfsdiskless operation to work at all.
trap code. the assembly part of the trap handling code is
not currently being used, because at until its time for the
fork(), it doesn't do much and the sun3 monitor diagnostics
are better than anything in the trap code. (note: buserr must
get special delay code for timeouts, and the memory error register
needs to be mapped (i think the mapping is commented out in
obio_internal_configure())
This code has been hosted under SunOs. Its not clear whether
the sun boot blocks can load kernels linked with our a.out, etc.
This is a question that *must* be answered.
This is a question that *must* be answered. This problem will
be alleviated by the sun3 port of 'netboot' which is almost finished.
I'm not running a current tree, because i can't afford a slip
connection at the moment.
I'm not running a current tree, because I can't afford a slip
connection at the moment. Soon to change.
there is an insane hack in 'swapnfs', and the
TIMESINK.nfsdiskless stuff because we don't have any way of
getting nfsdiskless information yet.
getting nfsdiskless information yet. This will go away as soon as
'netboot' works.
my tree doesn't have the non-contig phys memory changes. This port
needs them on the 3/50 or maybe its the 3/60 where the framebuffer
@ -37,7 +27,6 @@ The major bugs:
is that the kernel is still *relatively* small.
Note:
the only ok config file is 'TIMESINK'. the others need to be updated.
Core code: (i.e sun3/sun3, sun3/include)
@ -92,7 +81,7 @@ Device driver support:
----------------------
Missing functionality:
OBIO probe support
OBIO probe support needed
match/probe re-computation of default parameters
OBIO space collision avoidance
@ -149,10 +138,7 @@ Currently requires sun bootblks, secondary boot support, etc. Needs
to be replaced with attention paid to NetBSD's as yet un-developed
NFS diskless architecture.
Some code exists from Sprite for using PROM's exported drivers for
bootstrapping. This would have to be re-written and added to some
small NFS code perhaps from LBL's bootbootp stuff, etc. Lots of work
to be done here.
'netboot' is the NFS diskless solution, but the port doesn't work yet.
Compatibility:
--------------

View File

@ -129,7 +129,7 @@ genassym:
${SUN3}/sun3/genassym.c
depend: assym.s param.c
mkdep ${COPTS} ${CFILES} ioconf.c param.c ${SUN3}/sun3/locore.s
mkdep ${COPTS} ${CFILES} ioconf.c param.c
mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${SUN3}/sun3/genassym.c
links:

View File

@ -12,8 +12,10 @@ options NFSDISKLESS_SERVER = "{0x10, 0x2, { 0x8, 0x1, 0x80, 0x20, 0x95, 0x8D}}"
options NFSDISKLESS_SWAP_SADDR = "NFSDISKLESS_SERVER"
options NFSDISKLESS_ROOT_SADDR = "NFSDISKLESS_SERVER"
options NFSDISKLESS_SWAP_FH = "{ 0x0, 0x0, 0x7, 0x21, 0x0, 0x0, 0x0, 0x1, 0x0, 0x8, 0x0, 0x0, 0x64, 0xb9, 0x4, 0xdf, 0x1, 0xaf, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x50, 0xcc, 0x76, 0xc5, 0xe5, 0x29, 0x0, 0x0}"
options NFSDISKLESS_ROOT_FH = "{0x0, 0x0, 0x7, 0x21, 0x0, 0x0, 0x0, 0x1, 0x0, 0x8, 0x0, 0x0, 0x64, 0x98, 0x53, 0xaf, 0x37, 0xd5, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x50, 0xcc, 0x76, 0xc5, 0xe5, 0x29, 0x0, 0x0}"
options NFSDISKLESS_SWAP_FH = "{0x0, 0x0, 0x7, 0x21, 0x0, 0x0, 0x0, 0x1, 0x0, 0x8, 0x0, 0x0, 0x64, 0xb9, 0x4, 0xdf, 0x1, 0xaf, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x50, 0xcc, 0x76, 0xc5, 0xe5, 0x29, 0x0, 0x0 }"
#options NFSDISKLESS_SWAP_FH = "{ 0x0, 0x0, 0x7, 0x21, 0x0, 0x0, 0x0, 0x1, 0x0, 0x8, 0x0, 0x0, 0x64, 0xb9, 0x4, 0xdf, 0x1, 0xaf, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x50, 0xcc, 0x76, 0xc5, 0xe5, 0x29, 0x0, 0x0}"
options NFSDISKLESS_ROOT_FH = "{ 0x0, 0x0, 0x7, 0x21, 0x0, 0x0, 0x0, 0x1, 0x0, 0x8, 0x0, 0x0, 0xaf, 0xf1, 0x26, 0xba, 0x1f, 0xeb, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x50, 0xcc, 0x76, 0xc5, 0xe5, 0x29, 0x0, 0x0 }"
#options NFSDISKLESS_ROOT_FH = "{0x0, 0x0, 0x7, 0x21, 0x0, 0x0, 0x0, 0x1, 0x0, 0x8, 0x0, 0x0, 0x64, 0x98, 0x53, 0xaf, 0x37, 0xd5, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x50, 0xcc, 0x76, 0xc5, 0xe5, 0x29, 0x0, 0x0}"
options NFSDISKLESS_SWAP_HOST = "solipsist"
options NFSDISKLESS_ROOT_HOST = "solipsist"
options NFSDISKLESS_HARDWIRE

View File

@ -202,7 +202,7 @@ ledrinit(ler2)
ler2->ler2_rmd[i].rmd3 = 0;
}
for (i = 0; i < LETBUF; i++) {
a = LANCE_ADDR(&ler2->ler2_rbuf[i][0]);
a = LANCE_ADDR(&ler2->ler2_tbuf[i][0]);
#if 0
if (!ISQUADALIGN(a))
panic("rbuf not quad aligned");

View File

@ -22,7 +22,6 @@ static struct obio_internal {
int obio_rw;
} obio_internal_dev[] = {
{&eeprom_va, OBIO_EEPROM, ALL, OBIO_EEPROM_SIZE ,1},
{(vm_offset_t *) &interrupt_reg, OBIO_INTERREG, ALL, OBIO_INTERREG_SIZE,1},
{&memerr_va, OBIO_MEMERR, ALL, OBIO_MEMERR_SIZE ,1},
{NULL, 0, 0, 0 ,0}
/* {&ecc_va, OBIO_MEMERR, ALL, OBIO_MEMERR_SIZE }, */

View File

@ -145,7 +145,6 @@ int promstart(tp)
int s;
int c;
mon_printf("promstart called\n");
s = spltty();
if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) goto out;
if (RB_LEN(&tp->t_out) <= tp->t_lowat) {
@ -188,7 +187,6 @@ promcnprobe(cp)
{
int prommajor;
mon_printf("prom console probed (start)\n");
/* locate the major number */
for (prommajor = 0; prommajor < nchrdev; prommajor++)
if (cdevsw[prommajor].d_open == promopen)
@ -198,7 +196,6 @@ promcnprobe(cp)
cp->cn_pri = CN_NORMAL; /* will always exist but you don't
* want to use it unless you have to
*/
mon_printf("prom console probed (end)\n");
}
promcninit(cp)

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/include/Attic/control.h,v 1.6 1993/08/28 15:35:58 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/include/Attic/control.h,v 1.7 1993/10/12 05:21:24 glass Exp $
*/
/*
@ -71,7 +71,6 @@
#include <sys/types.h>
#ifdef KERNEL
void control_copy_byte __P((char *, char *, int ));
unsigned char get_control_byte __P((char *));
@ -92,5 +91,3 @@ unsigned char get_segmap __P((vm_offset_t));
void set_segmap __P((vm_offset_t va, unsigned char));
void set_temp_seg_addr __P((vm_offset_t va));
#endif

View File

@ -77,6 +77,9 @@
#define UPAGES 3 /* pages of u-area */
#define CLOCK_VA (0x0FFE0000+(UPAGES*NBPG*2))
#define INTERREG_VA (0x0FFE0000+(UPAGES*NBPG*2)+NBPG)
/*
* Constants related to network buffer management.
* MCLBYTES must be no larger than CLBYTES (the software page size), and,

View File

@ -77,6 +77,9 @@
#define UPAGES 3 /* pages of u-area */
#define CLOCK_VA (0x0FFE0000+(UPAGES*NBPG*2))
#define INTERREG_VA (0x0FFE0000+(UPAGES*NBPG*2)+NBPG)
/*
* Constants related to network buffer management.
* MCLBYTES must be no larger than CLBYTES (the software page size), and,

View File

@ -0,0 +1,34 @@
.include <../../common/netboot/Makefile>
CFLAGS += -I../../common -I. -DDEBUG -Dsun3
CC = gcc
AS = gas
NOMAN =
OBJS+= start.o
SRCS+= le_poll.c machdep.c sunos_exec.c
CLEANFILES += genassym netboot.nm assym.s a.out netboot.o
LINKADDR= 240000
genassym: genassym.c
${CC} ${CFLAGS} -Dmc68020 -Dsun3 -o genassym genassym.c
netboot: $(START_OBJ) $(OBJS)
$(LD) -n -o netboot.o -e start -N -T $(LINKADDR) $(START_OBJ) $(OBJS) $(LIBC)
cp netboot.o a.out
strip a.out
dd if=a.out of=$@ ibs=32 skip=1
rm -f a.out
netboot.nm:
nm -n netboot > netboot.nm
assym.s: genassym
./genassym >assym.s
start.o: start.s assym.s
${CPP} -E ${COPTS} $< | ${AS} -o $@
install: netboot
cp netboot /tftpboot/boot.sun3
.include <bsd.prog.mk>

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 1993 Adam Glass
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Glass.
* 4. The name of the Author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/netboot/Attic/conf.c,v 1.1 1993/10/12 05:22:43 glass Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netinet/in_systm.h>
#include "netboot/netboot.h"
#include "netboot/netif.h"
#include "config.h"
extern struct netif le_netif;
struct netif *netiftab[] = {
&le_netif
};
int n_netif = sizeof(netiftab)/ sizeof(netiftab[0]);

View File

@ -0,0 +1,19 @@
/* configuration information for base-line code */
#include "../include/mon.h"
#ifndef GENASSYM /* XXX */
#define printf mon_printf
#endif
#define machdep_exec_override(x,y) 1
#define machdep_exec(x,y) sunos_exec(x,y)
#define machdep_netbsd_exec(x,y) 1
#define COMMON_ETHERADDR
#define FIXED_LOAD_ADDR 0x4000
#define BOOT_LOAD_ADDR 0x240000
caddr_t dvma_malloc __P((unsigned int));

View File

@ -0,0 +1,85 @@
/*
* Copyright (c) 1993 Adam Glass
* Copyright (c) 1982, 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)genassym.c 7.8 (Berkeley) 5/7/91
* genassym.c,v 1.2 1993/05/22 07:57:23 cgd Exp
*/
#define KERNEL
#include "sys/cdefs.h"
#include "sys/errno.h"
#include "machine/memmap.h"
#include "machine/cpu.h"
#include "machine/trap.h"
#include "machine/psl.h"
#include "machine/pte.h"
#include "machine/control.h"
#include "machine/mon.h"
#include "machine/param.h"
#define GENASSYM
#include "config.h"
int main(argc, argv)
int argc;
char *argv[];
{
/* 68k isms */
printf("#define\tPSL_LOWIPL %d\n", PSL_LOWIPL);
printf("#define\tPSL_HIGHIPL %d\n", PSL_HIGHIPL);
printf("#define\tPSL_IPL7 %d\n", PSL_IPL7);
printf("#define\tPSL_USER %d\n", PSL_USER);
printf("#define\tSPL1 %d\n", PSL_S | PSL_IPL1);
printf("#define\tFC_CONTROL %d\n", FC_CONTROL);
/* sun3 control space isms */
printf("#define\tCONTEXT_0 %d\n", CONTEXT_0);
printf("#define\tCONTEXT_REG %d\n", CONTEXT_REG);
printf("#define\tCONTEXT_NUM %d\n", CONTEXT_NUM);
printf("#define\tSEGMAP_BASE %d\n", SEGMAP_BASE);
printf("#define\tNBPG %d\n", NBPG);
printf("#define\tNBSG %d\n", NBSG);
/* sun3 memory map */
printf("#define\tMAINMEM_MONMAP %d\n", MAINMEM_MONMAP);
printf("#define\tMONSHORTSEG %d\n", MONSHORTSEG);
printf("#define\tEFAULT %d\n", EFAULT);
printf("#define\tENAMETOOLONG %d\n", ENAMETOOLONG);
printf("#define\tFIXED_LOAD_ADDR %d\n", FIXED_LOAD_ADDR);
exit(0);
}

View File

@ -0,0 +1,508 @@
/*
* Copyright (c) 1993 Adam Glass
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Glass.
* 4. The name of the Author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/netboot/Attic/le_poll.c,v 1.1 1993/10/12 05:23:31 glass Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include "netboot/netboot.h"
#include "netboot/netif.h"
#include "config.h"
#include "machine/obio.h"
#include "../dev/if_lereg.h"
#include "../dev/if_le_subr.h"
int le_debug = 1;
int le_probe();
int le_match();
void le_init();
int le_get();
int le_put();
void le_end();
struct netif_stats le_stats;
struct netif le_netif = {
"le", /* netif_bname */
0, /* netif_unit */
0, /* netif_exhausted */
le_match, /* netif_match */
le_probe, /* netif_probe */
le_init, /* netif_init */
le_get, /* netif_get */
le_put, /* netif_put */
le_end, /* netif_end */
&le_stats
};
struct le_configuration {
unsigned int obio_addr;
int used;
} le_config[] = {
{OBIO_AMD_ETHER, 0}
};
int nle_config = sizeof(le_config)/(sizeof(le_config[0]));
#define LE_UNIT le_netif.netif_unit
struct {
struct lereg1 *sc_r1; /* LANCE registers */
struct lereg2 *sc_r2; /* RAM */
int next_rmd;
int next_tmd;
} le_softc;
int le_match(machdep_hint, unitp)
void *machdep_hint;
int *unitp;
{
char *name;
int i, val = 0;
name = machdep_hint;
if (name && !strncmp(le_netif.netif_bname, name,2))
val += 10;
for (i = 0; i < nle_config; i++) {
if (le_config[i].used) continue;
*unitp = i;
if (le_debug)
printf("le%d: le_match --> %d\n", i, val+1);
le_config[i].used++;
return val+1;
}
if (le_debug)
printf("le%d: le_match --> 0\n", i);
return 0;
}
int le_probe(machdep_hint)
void *machdep_hint;
{
/* the set unit is the current unit */
if (le_debug)
printf("le%d: le_probe called\n", LE_UNIT);
return 0;
}
void le_sanity_check(str)
char *str;
{
struct lereg1 *ler1 = le_softc.sc_r1;
struct lereg2 *ler2 = le_softc.sc_r2;
unsigned int a;
int i;
for (i = 0; i < LERBUF; i++) {
a = LANCE_ADDR(&ler2->ler2_rbuf[i]);
if ((ler2->ler2_rmd[i].rmd0 != (a & LE_ADDR_LOW_MASK)) ||
(ler2->ler2_rmd[i].rmd1_hadr != (a >> 16))) {
printf("le%d: ler2_rmd[%d] addrs bad\n", LE_UNIT, i);
printf("le%d: string: %s\n", LE_UNIT, str);
panic("addrs trashed\n");
}
}
for (i = 0; i < LETBUF; i++) {
a = LANCE_ADDR(&ler2->ler2_tbuf[i]);
if ((ler2->ler2_tmd[i].tmd0 != (a & LE_ADDR_LOW_MASK)) ||
(ler2->ler2_tmd[i].tmd1_hadr != (a >> 16))) {
printf("le%d: ler2_tmd[%d] addrs bad\n", LE_UNIT, i);
printf("le%d: string: %s\n", LE_UNIT, str);
panic("addrs trashed\n");
}
}
}
void le_mem_summary()
{
struct lereg1 *ler1 = le_softc.sc_r1;
struct lereg2 *ler2 = le_softc.sc_r2;
int i;
printf("le%d: obio addr = %x\n", LE_UNIT, ler1);
printf("le%d: dvma addr = %x\n", LE_UNIT, ler2);
#if 0
ler1->ler1_rap = LE_CSR0;
ler1->ler1_rdp = LE_STOP;
printf("le%d: csr0 = %x\n", LE_UNIT, ler1->ler1_rdp);
ler1->ler1_rap = LE_CSR1;
printf("le%d: csr1 = %x\n", LE_UNIT, ler1->ler1_rdp);
ler1->ler1_rap = LE_CSR2;
printf("le%d: csr2 = %x\n", LE_UNIT, ler1->ler1_rdp);
ler1->ler1_rap = LE_CSR3;
printf("le%d: csr3 = %x\n", LE_UNIT, ler1->ler1_rdp);
#endif
printf("le%d: ladrf0 = %x\n", LE_UNIT, ler2->ler2_ladrf0);
printf("le%d: ladrf1 = %x\n", LE_UNIT, ler2->ler2_ladrf1);
printf("le%d: ler2_rdra = %x\n", LE_UNIT, ler2->ler2_rdra);
printf("le%d: ler2_rlen = %x\n", LE_UNIT, ler2->ler2_rlen);
printf("le%d: ler2_tdra = %x\n", LE_UNIT, ler2->ler2_tdra);
printf("le%d: ler2_tlen = %x\n", LE_UNIT, ler2->ler2_tlen);
for (i = 0; i < LERBUF; i++) {
printf("le%d: ler2_rmd[%d].rmd0 (ladr) = %x\n", LE_UNIT, i,
ler2->ler2_rmd[i].rmd0);
printf("le%d: ler2_rmd[%d].rmd1_bits = %x\n", LE_UNIT, i,
ler2->ler2_rmd[i].rmd1_bits);
printf("le%d: ler2_rmd[%d].rmd1_hadr = %x\n", LE_UNIT, i,
ler2->ler2_rmd[i].rmd1_hadr);
printf("le%d: ler2_rmd[%d].rmd2 (-bcnt) = %x\n", LE_UNIT, i,
ler2->ler2_rmd[i].rmd2);
printf("le%d: ler2_rmd[%d].rmd3 (mcnt) = %x\n", LE_UNIT, i,
ler2->ler2_rmd[i].rmd3);
printf("le%d: ler2_rbuf[%d] addr = %x\n", LE_UNIT, i,
&ler2->ler2_rbuf[i]);
}
for (i = 0; i < LETBUF; i++) {
printf("le%d: ler2_tmd[%d].tmd0 = %x\n", LE_UNIT, i,
ler2->ler2_tmd[i].tmd0);
printf("le%d: ler2_tmd[%d].tmd1_bits = %x\n", LE_UNIT, i,
ler2->ler2_tmd[i].tmd1_bits);
printf("le%d: ler2_tmd[%d].tmd1_hadr = %x\n", LE_UNIT, i,
ler2->ler2_tmd[i].tmd1_hadr);
printf("le%d: ler2_tmd[%d].tmd2 (bcnt) = %x\n", LE_UNIT, i,
ler2->ler2_tmd[i].tmd2);
printf("le%d: ler2_tmd[%d].tmd3 = %x\n", LE_UNIT, i,
ler2->ler2_tmd[i].tmd3);
printf("le%d: ler2_tbuf[%d] addr = %x\n", LE_UNIT, i,
&ler2->ler2_tbuf[i]);
}
}
void le_error(str, ler1)
char *str;
struct lereg1 *ler1;
{
/* ler1->ler1_rap = LE_CSRO done in caller */
if (ler1->ler1_rdp & LE_BABL)
panic("le%d: been babbling, found by '%s'\n", LE_UNIT, str);
if (ler1->ler1_rdp & LE_CERR) {
le_stats.collision_error++;
ler1->ler1_rdp = LE_CERR;
}
if (ler1->ler1_rdp & LE_MISS) {
le_stats.missed++;
ler1->ler1_rdp = LE_MISS;
}
if (ler1->ler1_rdp & LE_MERR) {
printf("le%d: memory error in '%s'\n", LE_UNIT, str);
le_mem_summary();
panic("bye");
}
}
void le_reset(myea)
u_char *myea;
{
struct lereg1 *ler1 = le_softc.sc_r1;
struct lereg2 *ler2 = le_softc.sc_r2;
unsigned int a;
int timo = 100000, stat, i;
if (le_debug)
printf("le%d: le_reset called\n", LE_UNIT);
ler1->ler1_rap = LE_CSR0;
ler1->ler1_rdp = LE_STOP; /* do nothing until we are finished */
bzero(ler2, sizeof(*ler2));
ler2->ler2_mode = LE_MODE;
ler2->ler2_padr[0] = myea[1];
ler2->ler2_padr[1] = myea[0];
ler2->ler2_padr[2] = myea[3];
ler2->ler2_padr[3] = myea[2];
ler2->ler2_padr[4] = myea[5];
ler2->ler2_padr[5] = myea[4];
ler2->ler2_ladrf0 = 0;
ler2->ler2_ladrf1 = 0;
a = LANCE_ADDR(ler2->ler2_rmd);
#ifdef RECV_DEBUG
ler2->ler2_rlen = 0 | (a >> 16);
#undef LERBUF
#define LERBUF 1
#else
ler2->ler2_rlen = LE_RLEN | (a >> 16);
#endif
ler2->ler2_rdra = a & LE_ADDR_LOW_MASK;
a = LANCE_ADDR(ler2->ler2_tmd);
ler2->ler2_tlen = LE_TLEN | (a >> 16);
ler2->ler2_tdra = a & LE_ADDR_LOW_MASK;
ler1->ler1_rap = LE_CSR1;
a = LANCE_ADDR(ler2);
ler1->ler1_rdp = a & LE_ADDR_LOW_MASK;
ler1->ler1_rap = LE_CSR2;
ler1->ler1_rdp = a >> 16;
for (i = 0; i < LERBUF; i++) {
a = LANCE_ADDR(&ler2->ler2_rbuf[i]);
ler2->ler2_rmd[i].rmd0 = a & LE_ADDR_LOW_MASK;
ler2->ler2_rmd[i].rmd1_bits = LE_OWN;
ler2->ler2_rmd[i].rmd1_hadr = a >> 16;
if (le_debug)
printf("le rbuf[%d] = %x%x\n", i, a >>16, a & LE_ADDR_LOW_MASK);
ler2->ler2_rmd[i].rmd2 = -LEMTU;
ler2->ler2_rmd[i].rmd3 = 0;
}
for (i = 0; i < LETBUF; i++) {
a = LANCE_ADDR(&ler2->ler2_tbuf[i]);
ler2->ler2_tmd[i].tmd0 = a & LE_ADDR_LOW_MASK;
ler2->ler2_tmd[i].tmd1_bits = 0;
ler2->ler2_tmd[i].tmd1_hadr = a >> 16;
if (le_debug)
printf("le tbuf[%d] = %x%x\n", i, a >>16, a & LE_ADDR_LOW_MASK );
ler2->ler2_tmd[i].tmd2 = 0;
ler2->ler2_tmd[i].tmd3 = 0;
}
ler1->ler1_rap = LE_CSR3;
ler1->ler1_rdp = LE_BSWP;
ler1->ler1_rap = LE_CSR0;
ler1->ler1_rdp = LE_INIT;
do {
if (--timo == 0) {
printf("le%d: init timeout, stat = 0x%x\n",
le_netif.netif_unit, stat);
break;
}
stat = ler1->ler1_rdp;
} while ((stat & LE_IDON) == 0);
ler1->ler1_rdp = LE_IDON;
le_softc.next_rmd = 0;
le_softc.next_tmd = 0;
ler1->ler1_rap = LE_CSR0;
ler1->ler1_rdp = LE_STRT;
le_mem_summary();
}
int le_poll(desc, pkt, len)
struct iodesc *desc;
void *pkt;
int len;
{
struct lereg1 *ler1 = le_softc.sc_r1;
struct lereg2 *ler2 = le_softc.sc_r2;
unsigned int a;
int length;
struct lermd *rmd;
printf("next_rmd on poll attempt %d\n", le_softc.next_rmd);
ler1->ler1_rap = LE_CSR0;
if ((ler1->ler1_rdp & LE_RINT) == 0)
return 0;
ler1->ler1_rdp = LE_RINT;
rmd = &ler2->ler2_rmd[le_softc.next_rmd];
if (le_debug) {
printf("next_rmd %d\n", le_softc.next_rmd);
printf("rmd->rmd1_bits %x\n", rmd->rmd1_bits);
printf("rmd->rmd2 %x, rmd->rmd3 %x\n", rmd->rmd2, rmd->rmd3);
printf("rmd->rbuf msg %d buf %d\n", rmd->rmd3, -rmd->rmd2 );
}
if (rmd->rmd1_bits & LE_OWN)
panic("le_poll: rmd still owned by lance");
if (ler1->ler1_rdp & LE_SERR)
le_error("le_poll", ler1);
if (rmd->rmd1_bits & LE_ERR) {
printf("le%d_poll: rmd status 0x%x\n", rmd->rmd1_bits);
length = 0;
goto cleanup;
}
if ((rmd->rmd1_bits & (LE_STP|LE_ENP)) != (LE_STP|LE_ENP))
panic("le_poll: chained packet\n");
length = rmd->rmd3;
printf("le_poll: length %d\n", length);
if (length >= LEMTU) {
length = 0;
panic("csr0 when bad things happen: %x\n", ler1->ler1_rdp);
goto cleanup;
}
if (!length) goto cleanup;
length -= 4;
if (length > 0)
bcopy(&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length);
cleanup:
le_sanity_check("before forced rmd sanity");
a = LANCE_ADDR(&ler2->ler2_rbuf[le_softc.next_rmd]);
rmd->rmd0 = a & LE_ADDR_LOW_MASK;
rmd->rmd1_hadr = a >> 16;
rmd->rmd2 = -LEMTU;
le_softc.next_rmd =
(le_softc.next_rmd == (LERBUF - 1)) ? 0 : (le_softc.next_rmd + 1);
printf("new next_rmd %d\n", le_softc.next_rmd);
le_sanity_check("after forced rmd sanity");
rmd->rmd1_bits = LE_OWN;
return length;
}
int le_put(desc, pkt, len)
struct iodesc *desc;
void *pkt;
int len;
{
volatile struct lereg1 *ler1 = le_softc.sc_r1;
volatile struct lereg2 *ler2 = le_softc.sc_r2;
volatile struct letmd *tmd;
int timo = 100000, stat, i;
unsigned int a;
if (le_debug)
printf("le%d: le_put called\n", LE_UNIT);
printf("wierd place le_next_rmd %d\n", le_softc.next_rmd);
le_sanity_check("before transmit");
ler1->ler1_rap = LE_CSR0;
if (ler1->ler1_rdp & LE_SERR)
le_error("le_put(way before xmit)", ler1);
tmd = &ler2->ler2_tmd[le_softc.next_tmd];
while(tmd->tmd1_bits & LE_OWN) {
printf("le%d: output buffer busy\n");
}
bcopy(pkt, ler2->ler2_tbuf[le_softc.next_tmd], len);
if (len < 64)
tmd->tmd2 = -64;
else
tmd->tmd2 = -len;
tmd->tmd3 = 0;
if (ler1->ler1_rdp & LE_SERR)
le_error("le_put(before xmit)", ler1);
tmd->tmd1_bits = LE_STP | LE_ENP | LE_OWN;
a = LANCE_ADDR(&ler2->ler2_tbuf[le_softc.next_tmd]);
tmd->tmd0 = a & LE_ADDR_LOW_MASK;
tmd->tmd1_hadr = a >> 16;
ler1->ler1_rdp = LE_TDMD;
if (ler1->ler1_rdp & LE_SERR)
le_error("le_put(after xmit)", ler1);
do {
if (--timo == 0) {
printf("le%d: transmit timeout, stat = 0x%x\n",
le_netif.netif_unit, stat);
if (ler1->ler1_rdp & LE_SERR)
le_error("le_put(timeout)", ler1);
break;
}
stat = ler1->ler1_rdp;
} while ((stat & LE_TINT) == 0);
ler1->ler1_rdp = LE_TINT;
if (ler1->ler1_rdp & LE_SERR) {
printf("le_put: xmit error, buf %d\n", le_softc.next_tmd);
le_error("le_put(xmit error)", ler1);
}
le_sanity_check("after transmit");
le_softc.next_tmd = 0;
le_sanity_check("after next tmd");
/* (le_softc.next_tmd == (LETBUF - 1)) ? 0 : le_softc.next_tmd + 1;*/
if (tmd->tmd1_bits & LE_DEF) le_stats.deferred++;
if (tmd->tmd1_bits & LE_ONE) le_stats.collisions++;
if (tmd->tmd1_bits & LE_MORE) le_stats.collisions+=2;
le_sanity_check("bits check");
if (tmd->tmd1_bits & LE_ERR) {
printf("le%d: transmit error, error = 0x%x\n", LE_UNIT,
tmd->tmd3);
return -1;
}
le_sanity_check("le_debug check");
if (le_debug) {
printf("le%d: le_put() successful: sent %d\n", LE_UNIT, len);
printf("le%d: le_put(): tmd1_bits: %x tmd3: %x\n", LE_UNIT,
(unsigned int) tmd->tmd1_bits,
(unsigned int) tmd->tmd3);
}
le_sanity_check("after le_put return len");
return len;
}
int le_get(desc, pkt, len, timeout)
struct iodesc *desc;
void *pkt;
int len;
time_t timeout;
{
time_t t;
int cc;
t = getsecs();
cc = 0;
while (((getsecs() - t) < timeout) && !cc) {
cc = le_poll(desc, pkt, len);
}
return cc;
}
void le_init(desc, machdep_hint)
struct iodesc *desc;
void *machdep_hint;
{
caddr_t addr;
if (le_debug)
printf("le%d: le_init called\n", LE_UNIT);
bzero(&le_softc, sizeof(le_softc));
addr = obio_alloc((caddr_t) OBIO_AMD_ETHER, OBIO_AMD_ETHER_SIZE,
OBIO_WRITE);
if (addr == NULL)
panic("le%d: out of obio memory???", le_netif.netif_unit);
le_softc.sc_r1 = (struct lereg1 *) addr;
addr = dvma_malloc(sizeof(struct lereg2));
if (addr == NULL)
panic("le%d: no dvma space???", le_netif.netif_unit);
le_softc.sc_r2 = (struct lereg2 *) addr;
le_reset(desc->myea);
}
void le_end()
{
struct lereg1 *ler1 = le_softc.sc_r1;
if (le_debug)
printf("le%d: le_end called\n", LE_UNIT);
ler1->ler1_rap = LE_CSR0;
ler1->ler1_rdp = LE_STOP;
obio_free(le_softc.sc_r1);
dvma_free(le_softc.sc_r2);
}

View File

@ -0,0 +1,229 @@
#include <sys/param.h>
#include <sys/types.h>
#include <sys/types.h>
#include "machine/obio.h"
#include "machine/pte.h"
#include "machine/control.h"
#include "machine/idprom.h"
#include "../sun3/intersil7170.h"
#include "netboot/exec_var.h"
#include "config.h"
extern int debug;
vm_offset_t high_segment_free_start = 0;
vm_offset_t high_segment_free_end = 0;
vm_offset_t avail_start;
volatile struct intersil7170 *clock_addr = 0;
void high_segment_init()
{
vm_offset_t va;
high_segment_free_start = MONSHORTSEG;
high_segment_free_end = MONSHORTPAGE;
for (va = high_segment_free_start; va < high_segment_free_end;
va+= NBPG)
set_pte(va, PG_INVAL);
}
vm_offset_t high_segment_alloc(npages)
int npages;
{
int i;
vm_offset_t va, tmp;
if (npages == 0)
panic("panic: request for high segment allocation of 0 pages");
if (high_segment_free_start == high_segment_free_end) return NULL;
va = high_segment_free_start + (npages*NBPG);
if (va > high_segment_free_end) return NULL;
tmp = high_segment_free_start;
high_segment_free_start = va;
return tmp;
}
#define intersil_command(run, interrupt) \
(run | interrupt | INTERSIL_CMD_FREQ_32K | INTERSIL_CMD_24HR_MODE | \
INTERSIL_CMD_NORMAL_MODE)
void clock_start()
{
clock_addr = (struct intersil7170 *)
obio_alloc((caddr_t) OBIO_CLOCK, OBIO_CLOCK_SIZE, OBIO_WRITE);
if (!clock_addr)
panic("clock_init: no obio space for clock");
printf("about to turn on clock\n");
clock_addr->command_reg = intersil_command(INTERSIL_CMD_RUN,
INTERSIL_CMD_IDISABLE);
printf("clock on\n");
}
u_long gettenths()
{
char csecs;
u_long val;
val = 0;
csecs = clock_addr->counters.csecs;
val = csecs/10;
val += clock_addr->counters.seconds*10;
val += clock_addr->counters.minutes*60*10;
val += clock_addr->counters.hours*60*60*10;
csecs = clock_addr->counters.csecs;
return val;
}
time_t getsecs()
{
return gettenths()/10;
}
void machdep_nfsboot()
{
extern char edata[], end[];
printf("before bzero\n");
printf("edata %x, end-edata %x\n", edata, end - edata);
bzero(edata, end - edata);
printf("hi\n");
high_segment_init();
printf("high_segment_initialized\n");
/* get va afer netboot */
avail_start = sun3_round_page(end);
avail_start+= NBPG; /* paranoia */
printf("pre_clock_start\n");
clock_start();
printf("hi there\n");
nfs_boot(NULL, "le");
}
void machdep_stop()
{
mon_exit_to_mon();
}
void machdep_common_ether(ether)
unsigned char *ether;
{
static int ether_init = 0;
static struct idprom idprom_copy;
unsigned char *p;
if (!ether_init) {
int i;
for (i= 0, p = (char *) &idprom_copy; i<sizeof(idprom_copy); i++,p++)
*p= get_control_byte((char *) (IDPROM_BASE+i));
}
bcopy(idprom_copy.idp_etheraddr, ether, 6);
}
caddr_t obio_alloc(obio_addr, obio_size, obio_flags)
caddr_t obio_addr;
int obio_size;
int obio_flags;
{
int npages;
vm_offset_t va, high_segment_alloc(), obio_pa, obio_va, pte_proto;
npages = PA_PGNUM(sun3_round_page(obio_size));
if (!npages)
panic("obio_alloc: attempt to allocate 0 pages for obio");
va = high_segment_alloc(npages);
if (!va)
panic("obio_alloc: unable to allocate va for obio mapping");
pte_proto = PG_VALID|PG_SYSTEM|MAKE_PGTYPE(PG_OBIO);
if ((obio_flags & OBIO_CACHE) == 0)
pte_proto |= PG_NC;
if (obio_flags & OBIO_WRITE)
pte_proto |= PG_WRITE;
obio_va = va;
obio_pa = (vm_offset_t) obio_addr;
printf("pre_set_pte\n");
for (; npages ; npages--, obio_va += NBPG, obio_pa += NBPG)
set_pte(obio_va, pte_proto | PA_PGNUM(obio_pa));
printf("post_set_pte\n");
return (caddr_t) va;
}
/*
* pretty nasty:
*
* Can't allocate pages from top of phys memory because of msgbuf, etc.
*
* best bet is to steal pages just above us and re-map them in the dvma area.
*/
caddr_t dvma_malloc(size)
unsigned int size;
{
int npages;
vm_offset_t dvma_va, avail_pa, va, pte_proto;
npages = PA_PGNUM(sun3_round_page(size));
if (!npages)
panic("dvma_malloc: attempt to allocate 0 pages for dvma");
va = high_segment_alloc(npages);
if (!va)
panic("dvma_malloc: unable to allocate va for obio mapping");
pte_proto = PG_VALID|PG_SYSTEM|MAKE_PGTYPE(PG_MMEM)|PG_WRITE;
dvma_va = va;
avail_pa = PG_PA(get_pte(avail_start));
avail_start += npages*NBPG;
for (; npages; npages--, dvma_va+= NBPG, avail_pa+NBPG)
set_pte(dvma_va, pte_proto|PA_PGNUM(avail_pa));
return (caddr_t) va;
}
void obio_free(addr)
void *addr;
{
}
void dvma_free(addr)
void *addr;
{
}
#define CONTROL_ALIGN(x) (x & CONTROL_ADDR_MASK)
#define CONTROL_ADDR_BUILD(space, va) (CONTROL_ALIGN(va)|space)
vm_offset_t get_pte(va)
vm_offset_t va;
{
return (vm_offset_t)
get_control_word((char *) CONTROL_ADDR_BUILD(PGMAP_BASE, va));
}
void set_pte(va, pte)
vm_offset_t va,pte;
{
set_control_word((char *) CONTROL_ADDR_BUILD(PGMAP_BASE, va),
(unsigned int) pte);
}
void machdep_exec_setup(ev)
struct exec_var *ev;
{
unsigned int correction;
correction = ev->text_info.segment_addr - FIXED_LOAD_ADDR;
ev->text_info.segment_va = FIXED_LOAD_ADDR;
ev->data_info.segment_va = ev->data_info.segment_addr - correction;
ev->bss_info.segment_va = ev->bss_info.segment_addr - correction;
if (ev->nfs_disklessp)
ev->nfs_disklessp =
(caddr_t) (((unsigned char) ev->nfs_disklessp) - correction);
ev->real_entry_point = ev->entry_point - correction;
if ((ev->bss_info.segment_va + ev->bss_info.segment_size) >
BOOT_LOAD_ADDR)
panic("netboot: kernel image would overwrite bootstrap code");
}

View File

@ -0,0 +1,106 @@
/*
* Copyright (c) 1993 Adam Glass
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Glass.
* 4. The name of the Author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/netboot/Attic/start.s,v 1.1 1993/10/12 05:24:01 glass Exp $
*/
#include "assym.s"
#include "../include/asm.h"
.text
.globl start
start:
movl #FIXED_LOAD_ADDR,a0 | where we are (a0)
lea start:l, a1 | where we want to be (a1)
cmpl a0, a1
jeq begin
movl #_edata, d0
copy:
movl a0@+,a1@+
cmpl d0, a1
jne copy
jmp begin:l
/* find out where we are, and copy ourselves to where we are supposed to be */
.align 4
begin:
moveq #FC_CONTROL, d0 | make movs get us to the control
movc d0, dfc | space where the sun3 designers
movc d0, sfc | put all the "useful" stuff
moveq #CONTEXT_0, d0
movsb d0, CONTEXT_REG | now in context 0
savesp: movl sp, start-4:l
lea start-4:l, sp
movl #(FIXED_LOAD_ADDR-4), sp
jsr _machdep_nfsboot
jsr FIXED_LOAD_ADDR
/*
* unsigned int get_control_word (char *)
*/
ENTRY(get_control_word)
movl sp@(4), a0
movsl a0@, d0
rts
/*
* void set_control_word (char *, unsigned int)
*/
ENTRY(set_control_word)
movl sp@(4), a0
movl sp@(8), d0
movsl d0, a0@
rts
/*
* unsigned char get_control_byte (char *)
*/
ENTRY(get_control_byte)
movl sp@(4), a0
moveq #0, d0
movsb a0@, d0
rts
/*
* Get callers current SP value.
* Note that simply taking the address of a local variable in a C function
* doesn't work because callee saved registers may be outside the stack frame
* defined by A6 (e.g. GCC generated code).
*
* [I don't think the ENTRY() macro will do the right thing with this -- glass]
*/
.globl _getsp; .align 2
_getsp:
movl sp,d0 | get current SP
addql #4,d0 | compensate for return address
rts

View File

@ -0,0 +1,76 @@
/*
* Copyright (c) 1993 Adam Glass
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Glass.
* 4. The name of the Author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/netboot/Attic/sunos_exec.c,v 1.1 1993/10/12 05:24:15 glass Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/cdefs.h>
#include <sys/mount.h>
#include <sys/exec.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <a.out.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include "netboot/netboot.h"
#include "netboot/netif.h"
#include "netboot/exec_var.h"
#include "config.h"
int sunos_exec(desc, ev)
struct iodesc *desc;
struct exec_var *ev;
{
int cc, error;
struct exec exec;
unsigned short magic;
cc = readdata(desc, 0, &exec, sizeof(exec));
if (cc < 0)
panic("netbsd_exec: bad exec read\n");
if (N_BADMAG(exec)) {
error = 1;
goto failed;
}
if (N_GETMID(exec) != 2) {
error = 1;
goto failed;
}
failed:
if (error)
printf("netbsd_exec: bad exec? code %d\n", error);
error = netbsd_exec_compute(exec, ev);
return error;
}

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 1993 Adam Glass
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Glass.
* 4. The name of the Author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/buserr.h,v 1.1 1993/10/12 05:24:52 glass Exp $
*/
#define BUSERR_WATCHDOG 0x01
#define BUSERR_FPAENERR 0x04
#define BUSERR_FPABERR 0x08
#define BUSERR_VMEBERR 0x10
#define BUSERR_TIMEOUT 0x20
#define BUSERR_PROTERR 0x40
#define BUSERR_INVALID 0x80

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/clock.c,v 1.9 1993/08/28 15:37:11 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/clock.c,v 1.10 1993/10/12 05:25:13 glass Exp $
*/
/*
* machine-dependent clock routines; intersil7170
@ -50,7 +50,7 @@
#include "intersil7170.h"
#include "interreg.h"
#define intersil_clock ((volatile struct intersil7170 *) intersil_softc->clock_va)
#define intersil_clock ((volatile struct intersil7170 *) CLOCK_VA)
#define intersil_command(run, interrupt) \
(run | interrupt | INTERSIL_CMD_FREQ_32K | INTERSIL_CMD_24HR_MODE | \
INTERSIL_CMD_NORMAL_MODE)
@ -84,7 +84,6 @@ struct clock_softc {
};
struct clock_softc *intersil_softc = NULL;
caddr_t intersil_va = NULL;
static int month_days[12] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
@ -199,10 +198,9 @@ void clockattach(parent, self, args)
void level5intr_clock();
vm_offset_t pte;
clock_addr =
OBIO_DEFAULT_PARAM(caddr_t, obio_loc->obio_addr, OBIO_CLOCK);
clock_addr = OBIO_CLOCK;
clock->clock_level = OBIO_DEFAULT_PARAM(int, obio_loc->obio_level, 5);
clock->clock_va = obio_alloc(clock_addr, OBIO_CLOCK_SIZE, OBIO_WRITE);
clock->clock_va = (caddr_t) CLOCK_VA;
if (!clock->clock_va) {
printf(": not enough obio space\n");
return;
@ -210,47 +208,29 @@ void clockattach(parent, self, args)
obio_print(clock_addr, clock->clock_level);
if (clock->clock_level != 5) {
printf(": level != 5\n");
panic("clock");
return;
}
intersil_softc = clock;
intersil_va = clock->clock_va;
pte = get_pte(intersil_va);
pte_print(pte);
printf("intersil_clock_addr = %x\n", intersil_clock);
printf("intersil_clock_counters = %x\n", &intersil_clock->counters);
printf("intersil_clock_ram = %x\n", &intersil_clock->ram);
printf("intersil_clock_interrupt = %x\n", &intersil_clock->interrupt_reg);
printf("intersil_clock_command = %x\n", &intersil_clock->command_reg);
intersil_disable();
printf("before clear level 7\n");
set_clk_mode(0, IREG_CLOCK_ENAB_7, 0);
printf("after clear level 7\n");
isr_add_custom(clock->clock_level, level5intr_clock);
printf("before enable level 5\n");
set_clk_mode(IREG_CLOCK_ENAB_5, 0, 0);
printf("after enable level 5\n");
printf("\n");
}
int clock_count = 0;
void clock_intr(vaddr, status_before, status_after, frame)
unsigned int vaddr;
unsigned int status_before;
unsigned int status_after;
void clock_intr(frame)
clockframe frame;
{
printf("clock_intr: total of %d interrupts received\n",
clock_count);
printf("clock_intr: frame pc %x sr %x\n", frame.pc, frame.ps);
printf("clock_intr: clk_interrupt_reg before %b\n",
status_before, INTERSIL_INTER_BITS);
printf("clock_intr: clk_interrupt_reg after %b\n",
status_after, INTERSIL_INTER_BITS);
printf("clock_intr: vaddr %x\n", vaddr);
if ((clock_count % 1000) == 0) {
#if 0
printf("clock_intr: total of %d interrupts received\n",
clock_count);
printf("clock_intr: frame pc %x sr %x\n", frame.pc, frame.ps);
#endif
}
clock_count++;
if (clock_count == 30)
sun3_stop();
hardclock(frame);
}
@ -276,7 +256,6 @@ void startrtclock()
{
char dummy;
printf("startrtclock(): begin\n");
if (!intersil_softc)
panic("clock: not initialized");
@ -284,7 +263,6 @@ void startrtclock()
intersil_clock->command_reg = intersil_command(INTERSIL_CMD_RUN,
INTERSIL_CMD_IDISABLE);
dummy = intersil_clear();
printf("startrtclock(): end\n");
}
void enablertclock()
@ -366,9 +344,9 @@ void inittodr(base)
long diff_time;
void resettodr();
printf("inittodr: called\n");
clock_time = intersil_to_timeval();
if (!base) goto set_time;
if (!clock_time.tv_sec && (base <= 0)) goto set_time;
if (clock_time.tv_sec < base) {
@ -423,7 +401,6 @@ void resettodr()
{
struct intersil_map hdw_format;
printf("inittodr: called\n");
timeval_to_intersil(time, &hdw_format);
intersil_clock->command_reg = intersil_command(INTERSIL_CMD_STOP,
INTERSIL_CMD_IDISABLE);
@ -449,7 +426,6 @@ void microtime(tvp)
/* as yet...... this makes little sense*/
printf("microtime: called\n");
*tvp = time;
if (tvp->tv_sec == lasttime.tv_sec &&
tvp->tv_usec <= lasttime.tv_usec &&

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/control.c,v 1.3 1993/08/28 15:37:22 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/control.c,v 1.4 1993/10/12 05:25:28 glass Exp $
*/
#include "sys/systm.h"
#include "sys/types.h"
@ -106,12 +106,10 @@ void set_pte_pmeg(pmeg_num, page_num,pte)
{
vm_offset_t va;
printf("starting set_pte_pmeg\n");
va = temp_seg_va;
set_segmap(temp_seg_va, pmeg_num);
va += NBPG*page_num;
set_pte(va, pte);
set_segmap(temp_seg_va, SEGINV);
printf("ending set_pte_pmeg\n");
}

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/control.h,v 1.6 1993/08/28 15:35:58 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/control.h,v 1.7 1993/10/12 05:21:24 glass Exp $
*/
/*
@ -71,7 +71,6 @@
#include <sys/types.h>
#ifdef KERNEL
void control_copy_byte __P((char *, char *, int ));
unsigned char get_control_byte __P((char *));
@ -92,5 +91,3 @@ unsigned char get_segmap __P((vm_offset_t));
void set_segmap __P((vm_offset_t va, unsigned char));
void set_temp_seg_addr __P((vm_offset_t va));
#endif

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/Attic/copy.s,v 1.3 1993/08/28 15:37:25 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/Attic/copy.s,v 1.4 1993/10/12 05:25:41 glass Exp $
*/
.text
@ -44,6 +44,8 @@ ENTRY(copyinstr)
movl #Lcisflt1,a0@(PCB_ONFAULT) | set up to catch faults
movl sp@(4),a0 | a0 = fromaddr
movl sp@(8),a1 | a1 = toaddr
moveq #FC_USERD, d1
movec d1, sfc
moveq #0,d0
movw sp@(14),d0 | d0 = maxlength
jlt Lcisflt1 | negative count, error
@ -56,6 +58,8 @@ Lcisloop:
jne Lcisflt2 | ran out of room, error
moveq #0,d0 | got a null, all done
Lcisdone:
moveq #FC_CONTROL, d1
movec d1, sfc
tstl sp@(16) | return length desired?
jeq Lcisret | no, just return
subl sp@(4),a0 | determine how much was copied
@ -84,6 +88,8 @@ ENTRY(copyoutstr)
movl #Lcosflt1,a0@(PCB_ONFAULT) | set up to catch faults
movl sp@(4),a0 | a0 = fromaddr
movl sp@(8),a1 | a1 = toaddr
moveq #FC_USERD, d1
movec d1, dfc
moveq #0,d0
movw sp@(14),d0 | d0 = maxlength
jlt Lcosflt1 | negative count, error
@ -96,6 +102,8 @@ Lcosloop:
jne Lcosflt2 | ran out of room, error
moveq #0,d0 | got a null, all done
Lcosdone:
moveq #FC_CONTROL, d1
movec d1, dfc
tstl sp@(16) | return length desired?
jeq Lcosret | no, just return
subl sp@(4),a0 | determine how much was copied
@ -157,6 +165,8 @@ ENTRY(copyin)
movl d2,sp@- | scratch register
movl _curpcb,a0 | current pcb
movl #Lciflt,a0@(PCB_ONFAULT) | set up to catch faults
moveq #FC_USERD, d1
movec d1, sfc
movl sp@(16),d2 | check count
jlt Lciflt | negative, error
jeq Lcidone | zero, done
@ -192,6 +202,8 @@ Lcibloop:
Lcidone:
moveq #0,d0 | success
Lciexit:
moveq #FC_CONTROL, d1
movec d1, sfc
movl _curpcb,a0 | current pcb
clrl a0@(PCB_ONFAULT) | clear fault catcher
movl sp@+,d2 | restore scratch reg
@ -210,6 +222,8 @@ ENTRY(copyout)
movl d2,sp@- | scratch register
movl _curpcb,a0 | current pcb
movl #Lcoflt,a0@(PCB_ONFAULT) | catch faults
moveq #FC_USERD, d1
movec d1, dfc
movl sp@(16),d2 | check count
jlt Lcoflt | negative, error
jeq Lcodone | zero, done
@ -245,6 +259,8 @@ Lcobloop:
Lcodone:
moveq #0,d0 | success
Lcoexit:
moveq #FC_CONTROL, d1
movec d1, dfc
movl _curpcb,a0 | current pcb
clrl a0@(PCB_ONFAULT) | clear fault catcher
movl sp@+,d2 | restore scratch reg
@ -257,6 +273,8 @@ Lcoflt:
* {fu,su},{byte,sword,word}
*/
TWOENTRY(fuword,fuiword)
moveq #FC_USERD, d1
movec d1, sfc
movl sp@(4),a0 | address to read
movl _curpcb,a1 | current pcb
movl #Lfserr,a1@(PCB_ONFAULT) | where to return to on a fault
@ -264,6 +282,8 @@ TWOENTRY(fuword,fuiword)
jra Lfsdone
ENTRY(fusword)
moveq #FC_USERD, d1
movec d1, sfc
movl sp@(4),a0
movl _curpcb,a1 | current pcb
movl #Lfserr,a1@(PCB_ONFAULT) | where to return to on a fault
@ -272,6 +292,8 @@ ENTRY(fusword)
jra Lfsdone
TWOENTRY(fubyte,fuibyte)
moveq #FC_USERD, d1
movec d1, sfc
movl sp@(4),a0 | address to read
movl _curpcb,a1 | current pcb
movl #Lfserr,a1@(PCB_ONFAULT) | where to return to on a fault
@ -282,10 +304,14 @@ TWOENTRY(fubyte,fuibyte)
Lfserr:
moveq #-1,d0 | error indicator
Lfsdone:
moveq #FC_CONTROL, d1
movec d1, sfc
clrl a1@(PCB_ONFAULT) | clear fault address
rts
TWOENTRY(suword,suiword)
moveq #FC_USERD, d1
movec d1, dfc
movl sp@(4),a0 | address to write
movl sp@(8),d0 | value to put there
movl _curpcb,a1 | current pcb
@ -295,6 +321,8 @@ TWOENTRY(suword,suiword)
jra Lfsdone
ENTRY(susword)
moveq #FC_USERD, d1
movec d1, dfc
movl sp@(4),a0 | address to write
movw sp@(10),d0 | value to put there
movl _curpcb,a1 | current pcb
@ -304,6 +332,8 @@ ENTRY(susword)
jra Lfsdone
TWOENTRY(subyte,suibyte)
moveq #FC_USERD, d1
movec d1, dfc
movl sp@(4),a0 | address to write
movb sp@(11),d0 | value to put there
movl _curpcb,a1 | current pcb
@ -311,3 +341,5 @@ TWOENTRY(subyte,suibyte)
movsb d0,a0@ | do write to user space
moveq #0,d0 | indicate no fault
jra Lfsdone

View File

@ -58,6 +58,7 @@
#include "intersil7170.h"
#include "interreg.h"
#include "buserr.h"
main()
{
@ -66,19 +67,27 @@ main()
struct proc *p = (struct proc *) 0;
struct vmspace *vms = (struct vmspace *) 0;
struct intersil7170 *intersil_addr = (struct intersil7170 *) 0;
unsigned int i;
printf("#define\tINTERSIL_INTR_OFFSET %d\n",
&intersil_addr->interrupt_reg);
printf("#define\tINTERSIL_INTER_CSECONDS %d\n", INTERSIL_INTER_CSECONDS);
/* 68k isms */
/* intersil clock internals */
printf("#define\tIREG_CLOCK_ENAB_5 %d\n", IREG_CLOCK_ENAB_5);
/* bus error stuff */
printf("#define\tBUSERR_REG %d\n", BUSERR_REG);
printf("#define\tBUSERR_PROTERR %d\n", BUSERR_PROTERR);
printf("#define\tBUSERR_TIMEOUT %d\n", BUSERR_TIMEOUT);
printf("#define\tBUSERR_INVALID %d\n", BUSERR_INVALID);
/* 68k isms */
printf("#define\tPSL_LOWIPL %d\n", PSL_LOWIPL);
printf("#define\tPSL_HIGHIPL %d\n", PSL_HIGHIPL);
printf("#define\tPSL_IPL7 %d\n", PSL_IPL7);
printf("#define\tPSL_USER %d\n", PSL_USER);
printf("#define\tSPL1 %d\n", PSL_S | PSL_IPL1);
printf("#define\tFC_CONTROL %d\n", FC_CONTROL);
printf("#define\tFC_SUPERD %d\n", FC_SUPERD);
printf("#define\tFC_USERD %d\n", FC_USERD);
/* sun3 control space isms */
printf("#define\tCONTEXT_0 %d\n", CONTEXT_0);
@ -93,6 +102,11 @@ main()
printf("#define\tMONSHORTSEG %d\n", MONSHORTSEG);
printf("#define\tUSRSTACK %d\n", USRSTACK);
/* kernel-isms */
printf("#define\tINTERSIL_INTR_OFFSET %d\n",
&intersil_addr->interrupt_reg);
printf("#define\tINTERSIL_INTER_CSECONDS %d\n", INTERSIL_INTER_CSECONDS);
printf("#define\tCLOCK_VA %d\n", CLOCK_VA);
printf("#define\tINTERREG_VA %d\n", INTERREG_VA);
printf("#define\tKERNBASE %d\n", KERNBASE);
printf("#define\tUPAGES %d\n", UPAGES);
printf("#define\tUPAGE_ADDR %d\n", MONSHORTSEG);
@ -102,8 +116,21 @@ main()
printf("#define\tENAMETOOLONG %d\n", ENAMETOOLONG);
/* trap constants */
printf("#define\tT_BUSERR %d\n", T_BUSERR);
printf("#define\tT_ADDRERR %d\n", T_ADDRERR);
printf("#define\tT_ILLINST %d\n", T_ILLINST);
printf("#define\tT_ZERODIV %d\n", T_ZERODIV);
printf("#define\tT_CHKINST %d\n", T_CHKINST);
printf("#define\tT_TRAPVINST %d\n", T_TRAPVINST);
printf("#define\tT_PRIVINST %d\n", T_PRIVINST);
printf("#define\tT_TRACE %d\n", T_TRACE);
printf("#define\tT_MMUFLT %d\n", T_MMUFLT);
printf("#define\tT_SSIR %d\n", T_SSIR);
printf("#define\tT_FMTERR %d\n", T_FMTERR);
printf("#define\tT_COPERR %d\n", T_COPERR);
printf("#define\tT_FPERR %d\n", T_FPERR);
printf("#define\tT_ASTFLT %d\n", T_ASTFLT);
printf("#define\tT_TRAP15 %d\n", T_TRAP15);
/*
* unix structure-isms
@ -126,6 +153,10 @@ main()
printf("#define\tPCB_REGS %d\n", pcb->pcb_regs);
printf("#define\tPCB_ONFAULT %d\n", &pcb->pcb_onfault);
printf("#define\tPCB_FPCTX %d\n", &pcb->pcb_fpregs);
for (i = 0; i < 32; i++)
if ((1 << i) & PCB_HPUXTRACE)
printf("#define\tPCB_TRCB %d\n", i);
printf("#define\tSIZEOF_PCB %d\n", sizeof(struct pcb));
/* vm statistics */
printf("#define\tV_SWTCH %d\n", &vm->v_swtch);

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/Attic/interrupt.s,v 1.5 1993/08/28 15:37:37 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/Attic/interrupt.s,v 1.6 1993/10/12 05:26:04 glass Exp $
*/
.globl _cnt
@ -38,7 +38,9 @@
_intrcnt:
/* spurious 1 2 3 4 5 6 7*/
.long 0, 0, 0, 0, 0, 0, 0, 0
.globl _clock_turn
_clock_turn:
.long 0
.text
#define INTERRUPT_BEGIN(interrupt_num) \
@ -108,27 +110,22 @@ _level5intr:
INTERRUPT_HANDLE(5)
/* clock */
.globl _level5intr_clock, _intersil_va, _interrupt_reg, _clock_intr
.globl _level5intr_clock, _interrupt_reg, _clock_intr
.align 4
_level5intr_clock:
INTERRUPT_BEGIN(5) | stack aligned, a0, a1, d0, d1 saved
movl _intersil_va, a0 | move intersil_va to a0
clrl d0
movb a0@(INTERSIL_INTR_OFFSET), d0
/* movb #INTERSIL_INTER_CSECONDS, a0@(INTERSIL_INTR_OFFSET)*/
movl _interrupt_reg, a1
andb #~IREG_CLOCK_ENAB_5, a1@
orb #IREG_CLOCK_ENAB_5, a1@
clrl d1
movb a0@(INTERSIL_INTR_OFFSET), d1
tstb CLOCK_VA+INTERSIL_INTR_OFFSET
andb #~IREG_CLOCK_ENAB_5, INTERREG_VA
orb #IREG_CLOCK_ENAB_5, INTERREG_VA
tstb CLOCK_VA+INTERSIL_INTR_OFFSET
notl _clock_turn
jeq cont
rte
cont: INTERRUPT_BEGIN(5) | stack aligned, a0, a1, d0, d1 saved
movl sp, a1
movl a1@(16), sp@- | clockframe.sr (ps)
movl a1@(16+4), sp@- | clockframe.pc
movl d1, sp@-
movl d0, sp@-
movl a0, sp@-
jbsr _clock_intr
addl #20,sp | pop clockframe
addl #8,sp | pop clockframe
INTERRUPT_END
/* SCCs */

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/Attic/intersil7170.h,v 1.2 1993/08/28 15:37:41 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/Attic/intersil7170.h,v 1.3 1993/10/12 05:26:15 glass Exp $
*/
/*
@ -72,8 +72,8 @@ struct intersil7170 {
#define INTERSIL_CMD_IDISABLE 0x0
#define INTERSIL_CMD_IENABLE 0x10
#define INTERSIL_CMD_TEST_MODE 0x0
#define INTERSIL_CMD_NORMAL_MODE 0x20
#define INTERSIL_CMD_TEST_MODE 0x20
#define INTERSIL_CMD_NORMAL_MODE 0x0
/* bit assignments for interrupt register r/w, p 7 of 10*/
@ -94,3 +94,4 @@ struct intersil7170 {
#define INTERSIL_UNIX_BASE 70
#define INTERSIL_LEAP_YEAR(x) !((x) % 4)

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/locore.s,v 1.12 1993/08/28 15:37:50 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/locore.s,v 1.13 1993/10/12 05:26:27 glass Exp $
*/
#include "assym.s"
#include "../include/asm.h"
@ -162,3 +162,4 @@ _szicode:
#include "process.s"
#include "softint.s"
#include "interrupt.s"
#include "trap.s"

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/locore2.c,v 1.12 1993/08/28 15:38:24 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/locore2.c,v 1.13 1993/10/12 05:27:33 glass Exp $
*/
#include "systm.h"
@ -46,6 +46,7 @@
#include "machine/pte.h"
#include "machine/pmap.h"
#include "machine/idprom.h"
#include "machine/obio.h"
#include "vector.h"
#include "interreg.h"
@ -79,13 +80,10 @@ static void initialize_vector_table()
old_vector_table = getvbr();
for (i = 0; i < NVECTORS; i++) {
if (vector_table[i] == COPY_ENTRY)
vector_table[i] = old_vector_table[i];
set_vector_entry(i, old_vector_table[i]);
}
setvbr(vector_table);
orig_nmi_vector = get_vector_entry(VEC_LEVEL_7_INT);
mon_printf("orig_nmi_vector: %x\n", orig_nmi_vector);
mon_printf("initializing vector table (ended)\n");
mon_printf("old vector table at %x\n", old_vector_table);
}
vm_offset_t high_segment_alloc(npages)
@ -171,30 +169,24 @@ void u_area_bootstrap(u_va, u_pa)
void sun3_vm_init()
{
unsigned int monitor_memory = 0;
vm_offset_t va, eva, sva, pte, temp_seg;
vm_offset_t va, eva, sva, pte, temp_seg, clock_va;
extern char start[], etext[], end[];
unsigned char sme;
int valid;
mon_printf("starting pmeg_init\n");
pmeg_init();
mon_printf("ending pmeg_init\n");
va = (vm_offset_t) start;
while (va < (vm_offset_t) end) {
sme = get_segmap(va);
mon_printf("stealing pmeg %x\n", (int) sme);
if (sme == SEGINV)
mon_panic("stealing pages for kernel text/data/etc\n");
mon_printf("starting pmeg_steal\n");
pmeg_steal(sme);
mon_printf("ending pmeg_steal\n");
va = sun3_round_up_seg(va);
}
virtual_avail = sun3_round_seg(end); /* start a new segment */
mon_printf("literal kernel_end %x\nvirtual_avail_after %x\n",
end, virtual_avail);
virtual_end = VM_MAX_KERNEL_ADDRESS;
if (romp->romvecVersion >=1)
@ -205,7 +197,6 @@ void sun3_vm_init()
avail_start = sun3_round_page(end) - KERNBASE; /* XXX */
avail_end = sun3_trunc_page(*romp->memoryAvail);
mon_printf("kernel pmegs stolen\n");
/*
* preserve/protect monitor:
@ -214,7 +205,6 @@ void sun3_vm_init()
* free up any pmegs in this range which are
* deal with the awful MONSHORTSEG/MONSHORTPAGE
*/
mon_printf("protecting monitor (start)\n");
va = MONSTART;
while (va < MONEND) {
sme = get_segmap(va);
@ -237,13 +227,11 @@ void sun3_vm_init()
if (valid)
pmeg_steal(sme);
else {
mon_printf("freed pmeg for monitor segment %x\n",
sun3_trunc_seg(sva));
set_segmap(sva, SEGINV);
}
va = eva;
}
mon_printf("protecting monitor (end)\n");
mon_printf("monitor protected\n");
/*
* MONSHORTSEG contains MONSHORTPAGE which is some stupid page
* allocated by the monitor. One page, in an otherwise empty segment.
@ -285,7 +273,6 @@ void sun3_vm_init()
temp_seg - virtual_avail);
set_segmap(temp_seg, SEGINV);
virtual_avail = temp_seg + NBSG;
mon_printf("temp_seg: starts at %x ends at %x\n", temp_seg, virtual_avail);
/* allocating page for msgbuf */
sme = get_segmap(virtual_avail);
@ -358,14 +345,19 @@ void sun3_vm_init()
bzero(proc0paddr, UPAGES*NBPG);
save_u_area(&proc0paddr->u_pcb, proc0paddr);
load_u_area(&proc0paddr->u_pcb);
pte = get_pte(proc0paddr);
mon_printf(" proc0paddr: \n");
pte_print(pte);
pte = get_pte(u_area_va);
mon_printf(" u_area_va: \n");
pte_print(pte);
curpcb = &proc0paddr->u_pcb;
mon_printf("curpcb == %x\nproc0paddr == %x\n", curpcb, proc0paddr);
clock_va = obio_alloc((caddr_t) OBIO_CLOCK,
OBIO_CLOCK_SIZE, OBIO_WRITE);
if (clock_va != CLOCK_VA)
mon_printf("clock is not at CLOCK_VA, %x vs. %x\n", clock_va,
CLOCK_VA);
interrupt_reg = obio_alloc((caddr_t) OBIO_INTERREG,
OBIO_INTERREG_SIZE, OBIO_WRITE);
if (interrupt_reg != INTERREG_VA)
mon_printf("interrupt_reg is not at INTERREG_VA, %x vs. %x\n",
interrupt_reg, INTERREG_VA);
sun3_context_equiv();
}
@ -565,6 +557,7 @@ void pte_print(pte)
}
mon_printf(" PA: %x\n", PG_PA(pte));
}
else mon_printf("INVALID\n");
}
void set_interrupt_reg(value)
@ -575,9 +568,6 @@ void set_interrupt_reg(value)
unsigned int get_interrupt_reg()
{
vm_offset_t pte;
pte = get_pte(interrupt_reg);
mon_printf("interrupt reg %x ", pte);
pte_print(pte);
return (unsigned int) *interrupt_reg;
}
@ -600,15 +590,16 @@ void sun3_bootstrap()
initialize_vector_table(); /* point interrupts/exceptions to our table */
mon_printf("starting sun3 vm init\n");
sun3_vm_init(); /* handle kernel mapping problems, etc */
mon_printf("ending sun3 vm init\n");
printf("sun3 vm initialization complete\n");
sun3_monitor_hooks();
pmap_bootstrap(); /* */
printf("pmap module bootstrapped\n");
internal_configure(); /* stuff that can't wait for configure() */
astpending =0;
printf("calling main()\n");
}

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/Attic/m68k.s,v 1.7 1993/08/28 15:37:53 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/Attic/m68k.s,v 1.8 1993/10/12 05:26:36 glass Exp $
*/
ENTRY(getvbr)
@ -71,8 +71,12 @@ loop: movsb a0@+, d2
ENTRY(get_control_byte)
movl sp@(4), a0
movc sfc, d1
moveq #FC_CONTROL, d0
movec d0, sfc
moveq #0, d0
movsb a0@, d0
movc d1, sfc
rts
/*
@ -81,7 +85,11 @@ ENTRY(get_control_byte)
ENTRY(get_control_word)
movl sp@(4), a0
movc sfc, d1
moveq #FC_CONTROL, d0
movec d0, sfc
movsl a0@, d0
movc d1, sfc
rts
/*
@ -91,7 +99,13 @@ ENTRY(get_control_word)
ENTRY(set_control_byte)
movl sp@(4), a0
movl sp@(8), d0
movc dfc, d1
movl d2, sp@-
moveq #FC_CONTROL, d2
movc d2, dfc
movsb d0, a0@
movc d1, dfc
movl sp@+, d2
rts
/*
@ -101,7 +115,14 @@ ENTRY(set_control_byte)
ENTRY(set_control_word)
movl sp@(4), a0
movl sp@(8), d0
movc dfc, d1
movl d2, sp@-
moveq #FC_CONTROL, d2
movc d2, dfc
movsl d0, a0@
movc d1, dfc
movc dfc, d1
movl sp@+, d2
rts
/*

View File

@ -99,6 +99,7 @@ int bufpages = BUFPAGES;
#else
int bufpages = 0;
#endif
int *nofault;
extern vm_offset_t u_area_va;
@ -139,7 +140,6 @@ void cpu_startup()
vm_size_t size;
vm_offset_t minaddr, maxaddr, uarea_pages;
printf("got to cpu_startup()\n");
/* msgbuf mapped earlier, should figure out why? */
printf(version);
@ -244,9 +244,9 @@ void cpu_startup()
/*
* Configure the system.
*/
printf("about to call configure\n");
nofault = NULL;
configure();
cold = 0;
}
@ -258,9 +258,7 @@ void internal_configure()
void consinit()
{
extern void cninit();
mon_printf("determining console\n");
cninit();
mon_printf("determining console (completed)\n");
}
void cpu_reset()
@ -900,3 +898,10 @@ hexstr(val, len)
return(nbuf);
}
straytrap(pc, evec)
int pc;
u_short evec;
{
printf("unexpected trap (vector offset %x) from %x\n",
evec & 0xFFF, pc);
}

View File

@ -22,7 +22,6 @@ static struct obio_internal {
int obio_rw;
} obio_internal_dev[] = {
{&eeprom_va, OBIO_EEPROM, ALL, OBIO_EEPROM_SIZE ,1},
{(vm_offset_t *) &interrupt_reg, OBIO_INTERREG, ALL, OBIO_INTERREG_SIZE,1},
{&memerr_va, OBIO_MEMERR, ALL, OBIO_MEMERR_SIZE ,1},
{NULL, 0, 0, 0 ,0}
/* {&ecc_va, OBIO_MEMERR, ALL, OBIO_MEMERR_SIZE }, */

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/pmap.c,v 1.13 1993/08/28 15:38:05 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/pmap.c,v 1.14 1993/10/12 05:27:12 glass Exp $
*/
#include "systm.h"
#include "param.h"
@ -795,7 +795,6 @@ void pv_init()
{
int i;
mon_printf("kernel_map: %x\n", kernel_map);
pv_head_table = (pv_entry_t) kmem_alloc(kernel_map,
PA_PGNUM(avail_end) *
sizeof(struct pv_entry));
@ -876,14 +875,7 @@ void pmap_bootstrap()
/* pmeg_init(); done in sun3_vm_init() */
context_init();
mon_printf("kernel virtual address begin:\t %x\n", virtual_avail);
mon_printf("kernel virtual address end:\t %x\n", virtual_end);
mon_printf("physical memory begin:\t %x\n", avail_start);
mon_printf("physical memory end:\t %x\n", avail_end);
pmeg_clean_free();
mon_printf("free pmegs cleaned\n");
}
/*
* Initialize the pmap module.
@ -1223,7 +1215,7 @@ void pmap_enter_kernel(va, pa, prot, wired, pte_proto, mem_type)
* (e) change/add pte
*/
if (va < VM_MIN_KERNEL_ADDRESS)
printf("pmap: kernel trying to allocate virtual space below itself\n");
panic("pmap: kernel trying to allocate virtual space below itself\n");
PMAP_LOCK();
sme = get_segmap(va);
/* XXXX -- lots of non-defined routines, need to see if pmap has a
@ -1296,9 +1288,9 @@ void pmap_enter_user(pmap, va, pa, prot, wired, pte_proto, mem_type)
if (mem_type)
panic("pmap: attempt to map non main memory page into user space");
if (va < VM_MIN_ADDRESS)
printf("pmap: user trying to allocate virtual space below itself\n");
if ((va+NBPG) >= VM_MAXUSER_ADDRESS)
printf("pmap: user trying to allocate virtual space above itself\n");
panic("pmap: user trying to allocate virtual space below itself\n");
if ((va+NBPG) > VM_MAXUSER_ADDRESS)
panic("pmap: user trying to allocate virtual space above itself\n");
if (wired)
printf("pmap_enter_user: attempt to wire user page, ignored\n");
pte_proto |= MAKE_PGTYPE(PG_MMEM); /* unnecessary */
@ -1440,7 +1432,6 @@ void pmap_activate(pmap, pcbp)
int s;
PMAP_LOCK();
printf("pmap_activate called\n");
if (pmap->pm_context) {
set_context(pmap->pm_context->context_num);
PMAP_UNLOCK();

View File

@ -130,10 +130,13 @@ Lsw0:
.globl _curpcb
.globl _masterpaddr | XXX compatibility (debuggers)
.globl _Idle_count
.data
_masterpaddr: | XXX compatibility (debuggers)
_curpcb:
.long 0
_Idle_count:
.long 0
pcbflag:
.byte 0 | copy of pcb_flags low byte
.align 2
@ -161,6 +164,7 @@ Lidle:
Idle:
idle:
movw #PSL_HIGHIPL,sr
addql #1, _Idle_count
tstl _whichqs
jeq Lidle
movw #PSL_LOWIPL,sr
@ -271,10 +275,10 @@ Lswnofpsave:
/* see if pmap_activate needs to be called; should remove this */
movl a0@(P_VMSPACE),a0 | vmspace = p->p_vmspace
#ifdef DIAGNOSTIC
/*#ifdef DIAGNOSTIC*/
tstl a0 | map == VM_MAP_NULL?
jeq Lbadsw | panic
#endif
/*#endif*/
lea a0@(VM_PMAP),a0 | pmap = &vmspace.vm_pmap
pea a1@ | push pcb (at p_addr)
pea a0@ | push pmap

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/Attic/sun3_startup.c,v 1.12 1993/08/28 15:38:24 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/Attic/sun3_startup.c,v 1.13 1993/10/12 05:27:33 glass Exp $
*/
#include "systm.h"
@ -46,6 +46,7 @@
#include "machine/pte.h"
#include "machine/pmap.h"
#include "machine/idprom.h"
#include "machine/obio.h"
#include "vector.h"
#include "interreg.h"
@ -79,13 +80,10 @@ static void initialize_vector_table()
old_vector_table = getvbr();
for (i = 0; i < NVECTORS; i++) {
if (vector_table[i] == COPY_ENTRY)
vector_table[i] = old_vector_table[i];
set_vector_entry(i, old_vector_table[i]);
}
setvbr(vector_table);
orig_nmi_vector = get_vector_entry(VEC_LEVEL_7_INT);
mon_printf("orig_nmi_vector: %x\n", orig_nmi_vector);
mon_printf("initializing vector table (ended)\n");
mon_printf("old vector table at %x\n", old_vector_table);
}
vm_offset_t high_segment_alloc(npages)
@ -171,30 +169,24 @@ void u_area_bootstrap(u_va, u_pa)
void sun3_vm_init()
{
unsigned int monitor_memory = 0;
vm_offset_t va, eva, sva, pte, temp_seg;
vm_offset_t va, eva, sva, pte, temp_seg, clock_va;
extern char start[], etext[], end[];
unsigned char sme;
int valid;
mon_printf("starting pmeg_init\n");
pmeg_init();
mon_printf("ending pmeg_init\n");
va = (vm_offset_t) start;
while (va < (vm_offset_t) end) {
sme = get_segmap(va);
mon_printf("stealing pmeg %x\n", (int) sme);
if (sme == SEGINV)
mon_panic("stealing pages for kernel text/data/etc\n");
mon_printf("starting pmeg_steal\n");
pmeg_steal(sme);
mon_printf("ending pmeg_steal\n");
va = sun3_round_up_seg(va);
}
virtual_avail = sun3_round_seg(end); /* start a new segment */
mon_printf("literal kernel_end %x\nvirtual_avail_after %x\n",
end, virtual_avail);
virtual_end = VM_MAX_KERNEL_ADDRESS;
if (romp->romvecVersion >=1)
@ -205,7 +197,6 @@ void sun3_vm_init()
avail_start = sun3_round_page(end) - KERNBASE; /* XXX */
avail_end = sun3_trunc_page(*romp->memoryAvail);
mon_printf("kernel pmegs stolen\n");
/*
* preserve/protect monitor:
@ -214,7 +205,6 @@ void sun3_vm_init()
* free up any pmegs in this range which are
* deal with the awful MONSHORTSEG/MONSHORTPAGE
*/
mon_printf("protecting monitor (start)\n");
va = MONSTART;
while (va < MONEND) {
sme = get_segmap(va);
@ -237,13 +227,11 @@ void sun3_vm_init()
if (valid)
pmeg_steal(sme);
else {
mon_printf("freed pmeg for monitor segment %x\n",
sun3_trunc_seg(sva));
set_segmap(sva, SEGINV);
}
va = eva;
}
mon_printf("protecting monitor (end)\n");
mon_printf("monitor protected\n");
/*
* MONSHORTSEG contains MONSHORTPAGE which is some stupid page
* allocated by the monitor. One page, in an otherwise empty segment.
@ -285,7 +273,6 @@ void sun3_vm_init()
temp_seg - virtual_avail);
set_segmap(temp_seg, SEGINV);
virtual_avail = temp_seg + NBSG;
mon_printf("temp_seg: starts at %x ends at %x\n", temp_seg, virtual_avail);
/* allocating page for msgbuf */
sme = get_segmap(virtual_avail);
@ -358,14 +345,19 @@ void sun3_vm_init()
bzero(proc0paddr, UPAGES*NBPG);
save_u_area(&proc0paddr->u_pcb, proc0paddr);
load_u_area(&proc0paddr->u_pcb);
pte = get_pte(proc0paddr);
mon_printf(" proc0paddr: \n");
pte_print(pte);
pte = get_pte(u_area_va);
mon_printf(" u_area_va: \n");
pte_print(pte);
curpcb = &proc0paddr->u_pcb;
mon_printf("curpcb == %x\nproc0paddr == %x\n", curpcb, proc0paddr);
clock_va = obio_alloc((caddr_t) OBIO_CLOCK,
OBIO_CLOCK_SIZE, OBIO_WRITE);
if (clock_va != CLOCK_VA)
mon_printf("clock is not at CLOCK_VA, %x vs. %x\n", clock_va,
CLOCK_VA);
interrupt_reg = obio_alloc((caddr_t) OBIO_INTERREG,
OBIO_INTERREG_SIZE, OBIO_WRITE);
if (interrupt_reg != INTERREG_VA)
mon_printf("interrupt_reg is not at INTERREG_VA, %x vs. %x\n",
interrupt_reg, INTERREG_VA);
sun3_context_equiv();
}
@ -565,6 +557,7 @@ void pte_print(pte)
}
mon_printf(" PA: %x\n", PG_PA(pte));
}
else mon_printf("INVALID\n");
}
void set_interrupt_reg(value)
@ -575,9 +568,6 @@ void set_interrupt_reg(value)
unsigned int get_interrupt_reg()
{
vm_offset_t pte;
pte = get_pte(interrupt_reg);
mon_printf("interrupt reg %x ", pte);
pte_print(pte);
return (unsigned int) *interrupt_reg;
}
@ -600,15 +590,16 @@ void sun3_bootstrap()
initialize_vector_table(); /* point interrupts/exceptions to our table */
mon_printf("starting sun3 vm init\n");
sun3_vm_init(); /* handle kernel mapping problems, etc */
mon_printf("ending sun3 vm init\n");
printf("sun3 vm initialization complete\n");
sun3_monitor_hooks();
pmap_bootstrap(); /* */
printf("pmap module bootstrapped\n");
internal_configure(); /* stuff that can't wait for configure() */
astpending =0;
printf("calling main()\n");
}