xref: /original-bsd/sys/vax/vax/Locore.c (revision fee077cd)
15226d8ddSmckusick /*
25d7f1e0fSmckusick  * Copyright (c) 1982, 1986 Regents of the University of California.
35226d8ddSmckusick  * All rights reserved.  The Berkeley software License Agreement
45226d8ddSmckusick  * specifies the terms and conditions for redistribution.
55226d8ddSmckusick  *
6*fee077cdSbostic  *	@(#)Locore.c	7.8 (Berkeley) 09/23/93
75226d8ddSmckusick  */
86d315329Swnj 
96d315329Swnj #include "dz.h"
1076312c02Swnj #include "mba.h"
11af2347aeSsam #include "uba.h"
1264577cdeSbostic #include "imp.h"
13713bd585Sbill 
1464577cdeSbostic #include "../include/pte.h"
15a1666fd4Ssam 
1664577cdeSbostic #include "sys/param.h"
1764577cdeSbostic #include "sys/systm.h"
1864577cdeSbostic #include "sys/user.h"
1964577cdeSbostic #include "sys/vm.h"
2064577cdeSbostic #include "sys/ioctl.h"
2164577cdeSbostic #include "sys/tty.h"
2264577cdeSbostic #include "sys/proc.h"
2364577cdeSbostic #include "sys/buf.h"
2464577cdeSbostic #include "sys/msgbuf.h"
2564577cdeSbostic #include "sys/mbuf.h"
2664577cdeSbostic #include "sys/protosw.h"
2764577cdeSbostic #include "sys/domain.h"
2864577cdeSbostic #include "sys/map.h"
2964577cdeSbostic #include "sys/dkbad.h"
30713bd585Sbill 
31762ff349Skarels #include "scb.h"
32170f0854Sbloom #include "nexus.h"
336bb853d5Skarels #include "ioa.h"
3464577cdeSbostic #include "../uba/ubavar.h"
3564577cdeSbostic #include "../uba/ubareg.h"
36a486872dSroot 
37713bd585Sbill /*
38713bd585Sbill  * Pseudo file for lint to show what is used/defined in locore.s.
39713bd585Sbill  */
40713bd585Sbill 
41762ff349Skarels struct	scb scb[1];
4269ae479aSkarels int	(*UNIvec[NUBA][128])();		/* unibus vec for ubas */
4369ae479aSkarels int	(*eUNIvec)();			/* end of unibus vec */
44f84f854aSwnj struct	rpb rpb;
4576c583eaSsam int	dumpflag;
4676c583eaSsam int	intstack[3*NBPG];
473e1c6ecfSroot int	masterpaddr;		/* p_addr of current process on master cpu */
48f84f854aSwnj struct	user u;
4976c583eaSsam int	icode[8];
5076c583eaSsam int	szicode = sizeof (icode);
5176c583eaSsam /*
5276c583eaSsam  * Variables declared for savecore, or
5376c583eaSsam  * implicitly, such as by config or the loader.
5476c583eaSsam  */
55762ff349Skarels char	version[] = "4.3 BSD UNIX ....";
5676c583eaSsam int	etext;
57f84f854aSwnj 
doadump()58f84f854aSwnj doadump() { dumpsys(); }
59f84f854aSwnj 
60762ff349Skarels #if NMBA > 0
Xmba3int()61f84f854aSwnj Xmba3int() { }
Xmba2int()62f84f854aSwnj Xmba2int() { }
Xmba1int()63f84f854aSwnj Xmba1int() { }
Xmba0int()64f84f854aSwnj Xmba0int() { }
65762ff349Skarels #endif
66f84f854aSwnj 
lowinit()67713bd585Sbill lowinit()
68713bd585Sbill {
6976c583eaSsam #if !defined(GPROF)
7076c583eaSsam 	caddr_t cp;
7176c583eaSsam #endif
72faa7fb18Ssam 	extern int dumpmag;
7376c583eaSsam 	extern int rthashsize;
7476c583eaSsam 	extern int arptab_size;
7576c583eaSsam 	extern int dk_ndrive;
762553f9b1Ssam 	extern struct domain unixdomain;
7750912d5dSkarels #ifdef INET
782553f9b1Ssam 	extern struct domain inetdomain;
792553f9b1Ssam #endif
802553f9b1Ssam #if NIMP > 0
812553f9b1Ssam 	extern struct domain impdomain;
822553f9b1Ssam #endif
8376c583eaSsam #ifdef NS
8476c583eaSsam 	extern struct domain nsdomain;
8576c583eaSsam #endif
86faa7fb18Ssam 
872553f9b1Ssam 	/* cpp messes these up for lint so put them here */
882553f9b1Ssam 	unixdomain.dom_next = domains;
892553f9b1Ssam 	domains = &unixdomain;
9050912d5dSkarels #ifdef INET
912553f9b1Ssam 	inetdomain.dom_next = domains;
922553f9b1Ssam 	domains = &inetdomain;
932553f9b1Ssam #endif
942553f9b1Ssam #if NIMP > 0
952553f9b1Ssam 	impdomain.dom_next = domains;
962553f9b1Ssam 	domains = &impdomain;
972553f9b1Ssam #endif
9876c583eaSsam #ifdef NS
9976c583eaSsam 	nsdomain.dom_next = domains;
10076c583eaSsam 	domains = &nsdomain;
10176c583eaSsam #endif
102faa7fb18Ssam 	dumpmag = 0;			/* used only by savecore */
10376c583eaSsam 	rthashsize = rthashsize;	/* used by netstat, etc. */
10476c583eaSsam 	arptab_size = arptab_size;	/* used by arp command */
10576c583eaSsam 	dk_ndrive = dk_ndrive;		/* used by vmstat, iostat, etc. */
106713bd585Sbill 
107713bd585Sbill 	/*
108713bd585Sbill 	 * Pseudo-uses of globals.
109713bd585Sbill 	 */
110713bd585Sbill 	lowinit();
111713bd585Sbill 	intstack[0] = intstack[1];
1126d315329Swnj 	rpb = rpb;
113762ff349Skarels 	scb[0] = scb[0];
114713bd585Sbill 	maxmem = physmem = freemem = 0;
115f84f854aSwnj 	u = u;
116f84f854aSwnj 	fixctlrmask();
117713bd585Sbill 	main(0);
1180bde3b55Swnj 	Xustray();
119713bd585Sbill 
120713bd585Sbill 	/*
121713bd585Sbill 	 * Routines called from interrupt vectors.
122713bd585Sbill 	 */
123f84f854aSwnj 	panic("Machine check");
124f84f854aSwnj 	printf("Write timeout");
12569ae479aSkarels 	(*UNIvec[0][0])();
126f84f854aSwnj 	ubaerror(0, (struct uba_hd *)0, 0, 0, (struct uba_regs *)0);
127713bd585Sbill 	cnrint(0);
128713bd585Sbill 	cnxint(0);
1296d315329Swnj 	consdin();
1306d315329Swnj 	consdout();
1316d315329Swnj #if NDZ > 0
1326d315329Swnj 	dzdma();
1336d315329Swnj #endif
13476312c02Swnj #if NMBA > 0
13576312c02Swnj 	mbintr(0);
13676312c02Swnj #endif
137762ff349Skarels #if VAX8200			/* XXX wrong conditional */
138762ff349Skarels 	bi_buserr(0);
139762ff349Skarels #endif
140762ff349Skarels #if VAX8200
141762ff349Skarels 	rxcdintr();
142762ff349Skarels 	rx50intr();
143762ff349Skarels #endif
144f84f854aSwnj 	hardclock((caddr_t)0, 0);
1456d315329Swnj 	softclock((caddr_t)0, 0);
146713bd585Sbill 	trap(0, 0, (unsigned)0, 0, 0);
147713bd585Sbill 	syscall(0, 0, (unsigned)0, 0, 0);
148447fd403Swnj 	rawintr();
14950912d5dSkarels #ifdef INET
15076c583eaSsam 	ipintr();
15176c583eaSsam #endif
15276c583eaSsam #ifdef NS
15376c583eaSsam 	nsintr();
15476c583eaSsam #endif
1556d315329Swnj 	machinecheck((caddr_t)0);
1566d315329Swnj 	memerr();
157762ff349Skarels 
158762ff349Skarels 	/*
159762ff349Skarels 	 * Miscellaneous routines called from configurable
160762ff349Skarels 	 * drivers.
161762ff349Skarels 	 */
162762ff349Skarels 	ubapurge((struct uba_ctlr *)0);
163762ff349Skarels 	ubattydma(0);
164762ff349Skarels 	(void) ubamem(0, 0, 16, 1);
165762ff349Skarels 	(void) isbad((struct dkbad *)0, 0, 0, 0);
166762ff349Skarels 	disksort((struct buf *)0, (struct buf *)0);
167762ff349Skarels 	(void) uwritec((struct uio *)0);
168762ff349Skarels 	(void) todr();
169762ff349Skarels 	if (vmemall((struct pte *)0, 0, (struct proc *)0, 0))
170762ff349Skarels 		return;		/* use value */
171edbc2354Swnj 	boothowto = 0;
17276c583eaSsam 	dumpflag = 0; dumpflag = dumpflag;
17369ae479aSkarels #ifdef KADB
174762ff349Skarels 	bootesym = 0; bootesym = bootesym;
17569ae479aSkarels #endif
17676c583eaSsam #if !defined(GPROF)
17776c583eaSsam 	cp = (caddr_t)&etext;
17876c583eaSsam 	cp = cp;
17976c583eaSsam #endif
180713bd585Sbill }
181713bd585Sbill 
consdin()182f84f854aSwnj consdin() { }
consdout()183f84f854aSwnj consdout() { }
1846d315329Swnj #if NDZ > 0
dzdma()185f84f854aSwnj dzdma() { dzxint((struct tty *)0); }
1866d315329Swnj #endif
187713bd585Sbill 
188762ff349Skarels quad	catcher[128];
189f84f854aSwnj int	cold = 1;
190f84f854aSwnj 
Xustray()191f84f854aSwnj Xustray() { }
192f84f854aSwnj 
193f84f854aSwnj struct	pte Sysmap[6*NPTEPG];
19469ae479aSkarels #ifdef KADB
195f84f854aSwnj char	Sysbase[6*NPTEPG*NBPG];
19669ae479aSkarels #endif
197f84f854aSwnj int	umbabeg;
198f84f854aSwnj struct	pte Nexmap[16][16];
1992a2c5e5eSroot struct	nexus nexus[MAXNNEXUS];
200762ff349Skarels #if VAX8600
2016bb853d5Skarels struct	pte Ioamap[MAXNIOA][IOAMAPSIZ/NBPG];
202762ff349Skarels #endif
203b502efd5Skarels struct	pte UMEMmap[NUBA][512];
204b502efd5Skarels char	umem[NUBA][512*NBPG];
205f84f854aSwnj int	umbaend;
206f84f854aSwnj struct	pte Usrptmap[USRPTSIZE];
207f84f854aSwnj struct	pte usrpt[USRPTSIZE*NPTEPG];
208f84f854aSwnj struct	pte Forkmap[UPAGES];
209f84f854aSwnj struct	user forkutl;
210f84f854aSwnj struct	pte Xswapmap[UPAGES];
211f84f854aSwnj struct	user xswaputl;
212f84f854aSwnj struct	pte Xswap2map[UPAGES];
213f84f854aSwnj struct	user xswap2utl;
214f84f854aSwnj struct	pte Swapmap[UPAGES];
215f84f854aSwnj struct	user swaputl;
216f84f854aSwnj struct	pte Pushmap[UPAGES];
217f84f854aSwnj struct	user pushutl;
218f84f854aSwnj struct	pte Vfmap[UPAGES];
219f84f854aSwnj struct	user vfutl;
220f84f854aSwnj struct	pte CMAP1;
2216d315329Swnj char	CADDR1[NBPG];
222f84f854aSwnj struct	pte CMAP2;
2236d315329Swnj char	CADDR2[NBPG];
224f84f854aSwnj struct	pte mmap[1];
225f84f854aSwnj char	vmmap[NBPG];
226447fd403Swnj struct	pte Mbmap[NMBCLUSTERS/CLSIZE];
227447fd403Swnj struct	mbuf mbutl[NMBCLUSTERS*CLBYTES/sizeof (struct mbuf)];
228f84f854aSwnj struct	pte msgbufmap[CLSIZE];
2296d315329Swnj struct	msgbuf msgbuf;
23069ae479aSkarels struct	pte kmempt[200], ekmempt[1];
231762ff349Skarels #if VAX8200
232762ff349Skarels struct	pte RX50map[1];
233762ff349Skarels struct	pte Ka820map[1];
234762ff349Skarels #endif
235762ff349Skarels #if VAX630
23666a4d967Skridle struct	pte Ka630map[1];
23766a4d967Skridle #endif
23869ae479aSkarels char	kmembase[100*NBPG];
239762ff349Skarels #if VAX8200 || VAX630
240762ff349Skarels struct	pte Clockmap[1];
2416d315329Swnj #endif
242474bc5b2Smckusick #ifdef NFS
243474bc5b2Smckusick struct	pte Nfsiomap[MAXPHYS/NBPG+1];
244474bc5b2Smckusick char	nfsiobuf[MAXPHYS+NBPG];
245474bc5b2Smckusick #endif
246713bd585Sbill 
247713bd585Sbill /*ARGSUSED*/
badaddr(addr,len)248f84f854aSwnj badaddr(addr, len) caddr_t addr; int len; { return (0); }
249713bd585Sbill 
250713bd585Sbill /*ARGSUSED*/
ovbcopy(from,to,len)25176c583eaSsam ovbcopy(from, to, len) caddr_t from, to; unsigned len; { }
copyinstr(udaddr,kaddr,maxlength,lencopied)25276c583eaSsam copyinstr(udaddr, kaddr, maxlength, lencopied)
25376c583eaSsam     caddr_t udaddr, kaddr; u_int maxlength, *lencopied;
25476c583eaSsam { *kaddr = *udaddr; *lencopied = maxlength; return (0); }
copyoutstr(kaddr,udaddr,maxlength,lencopied)25576c583eaSsam copyoutstr(kaddr, udaddr, maxlength, lencopied)
25676c583eaSsam     caddr_t kaddr, udaddr; u_int maxlength, *lencopied;
2577fbbb002Smckusick { *udaddr = *kaddr; *lencopied = maxlength; return (0); }
copystr(kfaddr,kdaddr,maxlength,lencopied)25876c583eaSsam copystr(kfaddr, kdaddr, maxlength, lencopied)
25976c583eaSsam     caddr_t kfaddr, kdaddr; u_int maxlength, *lencopied;
26076c583eaSsam { *kdaddr = *kfaddr; *lencopied = maxlength; return (0); }
261c70dabdeSbill 
262c70dabdeSbill /*ARGSUSED*/
copyin(udaddr,kaddr,n)26376c583eaSsam copyin(udaddr, kaddr, n) caddr_t udaddr, kaddr; u_int n; { return (0); }
264c70dabdeSbill /*ARGSUSED*/
copyout(kaddr,udaddr,n)26576c583eaSsam copyout(kaddr, udaddr, n) caddr_t kaddr, udaddr; u_int n; { return (0); }
266c70dabdeSbill 
267c70dabdeSbill /*ARGSUSED*/
longjmp(lp)26851fcc049Sroot longjmp(lp) label_t *lp; { /*NOTREACHED*/ }
269c70dabdeSbill 
270c70dabdeSbill /*ARGSUSED*/
savectx(lp)27176c583eaSsam savectx(lp) label_t *lp; { return (0); }
27276c583eaSsam 
27376c583eaSsam /*ARGSUSED*/
2741d771ceeSbostic setrunqueue(p) struct proc *p; { }
275c70dabdeSbill 
276c70dabdeSbill /*ARGSUSED*/
277f84f854aSwnj remrq(p) struct proc *p; { }
278c70dabdeSbill 
Xswitch()279*fee077cdSbostic Xswitch() { if (whichqs) whichqs = 0; if (masterpaddr) masterpaddr = 0; }
280c70dabdeSbill 
281c70dabdeSbill /*ARGSUSED*/
resume(pcbpf)282f84f854aSwnj resume(pcbpf) unsigned pcbpf; { }
283713bd585Sbill 
284713bd585Sbill /*ARGSUSED*/
fubyte(base)285f84f854aSwnj fubyte(base) caddr_t base; { return (0); }
2866bb853d5Skarels #ifdef notdef
28776c583eaSsam /*ARGSUSED*/
fuibyte(base)28876c583eaSsam fuibyte(base) caddr_t base; { return (0); }
2896bb853d5Skarels #endif
290713bd585Sbill /*ARGSUSED*/
subyte(base,i)291f84f854aSwnj subyte(base, i) caddr_t base; { return (0); }
292713bd585Sbill /*ARGSUSED*/
suibyte(base,i)293f84f854aSwnj suibyte(base, i) caddr_t base; { return (0); }
294713bd585Sbill /*ARGSUSED*/
fuword(base)295f84f854aSwnj fuword(base) caddr_t base; { return (0); }
296713bd585Sbill /*ARGSUSED*/
fuiword(base)297f84f854aSwnj fuiword(base) caddr_t base; { return (0); }
298713bd585Sbill /*ARGSUSED*/
suword(base,i)299f84f854aSwnj suword(base, i) caddr_t base; { return (0); }
300713bd585Sbill /*ARGSUSED*/
suiword(base,i)301f84f854aSwnj suiword(base, i) caddr_t base; { return (0); }
302713bd585Sbill 
303713bd585Sbill /*ARGSUSED*/
copyseg(udaddr,pf)30476c583eaSsam copyseg(udaddr, pf)
30576c583eaSsam     caddr_t udaddr; unsigned pf;
30676c583eaSsam { CMAP1 = CMAP1; CADDR1[0] = CADDR1[0]; }
307713bd585Sbill 
308713bd585Sbill /*ARGSUSED*/
clearseg(pf)3096d315329Swnj clearseg(pf) unsigned pf; { CMAP2 = CMAP2; CADDR2[0] = CADDR2[0]; }
310713bd585Sbill 
311713bd585Sbill /*ARGSUSED*/
useracc(udaddr,bcnt,rw)312f84f854aSwnj useracc(udaddr, bcnt, rw) caddr_t udaddr; unsigned bcnt; { return (0); }
313713bd585Sbill 
314f84f854aSwnj /*ARGSUSED*/
kernacc(addr,bcnt,rw)315f84f854aSwnj kernacc(addr, bcnt, rw) caddr_t addr; unsigned bcnt; { return (0); }
316713bd585Sbill 
31776c583eaSsam /*ARGSUSED*/
addupc(pc,prof,counts)31876c583eaSsam addupc(pc, prof, counts) int pc; struct uprof *prof; int counts; { }
31976c583eaSsam 
320faa7fb18Ssam /*
32176c583eaSsam  * Routines expanded by inline.
322faa7fb18Ssam  */
spl0()3230bde3b55Swnj spl0() { }
splsoftclock()3245e3ce190Skarels splsoftclock() { return (0); }
splnet()3255e3ce190Skarels splnet() { return (0); }
spl4()326f84f854aSwnj spl4() { return (0); }
spl5()327f84f854aSwnj spl5() { return (0); }
splbio()3285e3ce190Skarels splbio() { return (0); }
spltty()3295e3ce190Skarels spltty() { return (0); }
3305e3ce190Skarels #ifdef notdef
spl6()3315e3ce190Skarels spl6() { return (0); }		/* not currently used */
3325e3ce190Skarels #endif
splclock()3335e3ce190Skarels splclock() { return (0); }
spl7()334f84f854aSwnj spl7() { return (0); }
splhigh()3355e3ce190Skarels splhigh() { return (0); }
336c70dabdeSbill 
337c04fb135Sbill /*ARGSUSED*/
splx(s)338f84f854aSwnj splx(s) int s; { }
339c70dabdeSbill 
340c70dabdeSbill /*ARGSUSED*/
bcopy(from,to,len)34176c583eaSsam bcopy(from, to, len) caddr_t from, to; unsigned len; { }
34276c583eaSsam /*ARGSUSED*/
bzero(base,count)34376c583eaSsam bzero(base, count) caddr_t base; unsigned count; { }
34476c583eaSsam /*ARGSUSED*/
blkclr(base,count)34576c583eaSsam blkclr(base, count) caddr_t base; unsigned count; { }
3466d315329Swnj 
3476d315329Swnj /*ARGSUSED*/
34876c583eaSsam /*VARARGS1*/
mtpr(reg,v)34976c583eaSsam mtpr(reg, v) int reg; { }
35076c583eaSsam /*ARGSUSED*/
mfpr(reg)35176c583eaSsam mfpr(reg) int reg; { return (0); }
3520c2e47f9Ssam 
3530c2e47f9Ssam /*ARGSUSED*/
setjmp(lp)35476c583eaSsam setjmp(lp) label_t *lp; { return (0); }
3550c2e47f9Ssam 
356762ff349Skarels #ifndef VAX630
3570c2e47f9Ssam /*ARGSUSED*/
scanc(size,cp,table,mask)358faa7fb18Ssam scanc(size, cp, table, mask)
35976c583eaSsam     unsigned size; char *cp, table[]; int mask;
36076c583eaSsam { return (0); }
361762ff349Skarels #endif
362faa7fb18Ssam 
363faa7fb18Ssam /*ARGSUSED*/
skpc(mask,size,cp)3646bb853d5Skarels skpc(mask, size, cp) int mask; int size; char *cp; { return (0); }
36551fcc049Sroot 
36676c583eaSsam #ifdef notdef
36776c583eaSsam /*ARGSUSED*/
locc(mask,size,cp)36876c583eaSsam locc(mask, size, cp) int mask; char *cp; unsigned size; { return (0); }
36976c583eaSsam #endif
37076c583eaSsam 
37176c583eaSsam /*ARGSUSED*/
_insque(p,q)37276c583eaSsam _insque(p, q) caddr_t p, q; { }
37376c583eaSsam /*ARGSUSED*/
_remque(p)37476c583eaSsam _remque(p) caddr_t p; { }
37576c583eaSsam 
37676c583eaSsam /*ARGSUSED*/
ffs(v)37776c583eaSsam ffs(v) long v; { return (0); }
37876c583eaSsam 
3796bb853d5Skarels #ifdef notdef
imin(a,b)38076c583eaSsam imin(a, b) int a, b; { return (a < b ? a : b); }
imax(a,b)38176c583eaSsam imax(a, b) int a, b; { return (a > b ? a : b); }
min(a,b)38276c583eaSsam unsigned min(a, b) u_int a, b; { return (a < b ? a : b); }
max(a,b)38376c583eaSsam unsigned max(a, b) u_int a, b; { return (a > b ? a : b); }
3846bb853d5Skarels #endif
ntohs(s)38566a4d967Skridle u_short ntohs(s) u_short s; { return ((u_short)s); }
htons(s)38666a4d967Skridle u_short htons(s) u_short s; { return ((u_short)s); }
ntohl(l)38766a4d967Skridle u_long ntohl(l) u_long l; { return ((u_long)l); }
htonl(l)38866a4d967Skridle u_long htonl(l) u_long l; { return ((u_long)l); }
389