⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 machdep.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 5 页
字号:
 * * 09-apr-86 -- jaw  use 8800 boot me command. * * 22-Mar-86 -- koehler *	changed the why the filesystem is handled when the system is  *	shutting down * * 19-Mar-86 -- pmk *	Changed microdelay so at ipl18 and above clock is used  *	and mvax delay now is appox. real microsec. delay. * * 12-mar-86 -- tresvik *	fixed loop for system page table too small; reduction of physmem *	to 2 meg.  Maxusers was being set too high and possibly higher *	than it's original setting.  Also, do not attempt to remap *	vmbinfo on retries. * * 11 Mar 86 -- robin *	Changed the login limit code to use a system call and counter. * * 11 Mar 86 -- lp *	Added n-buffered I/O support (in physstrat). Also *	added IOA reset in halt code for 86?0. * * 11 Mar 86 -- larry *	nmbclusters is now a function of maxusers * * 05 Mar 86 -- bjg *	Removed msgbuf from the kernel; replaced by error logger * * 24 Feb 86 -- depp *	Added new maps for kernel memory allocation mechanisms (dmempt*) *	and in the routine sendsig, added code passthrough for SIGBUS *	to complement the new system call "mprotect" * * 19-Feb-86 -- bjg  add call to log startup message (logstart();) * * 18-Feb-86 -- jaw  add routines to cpu switch for nexus/unibus addreses *		     also got rid of some globals like nexnum. *		     ka8800 cleanup. * * 12-Feb-86	Darrell Dunnuck *	Removed the routines memerr, memenable, setcache, and tocons *	from here and put them in the appropiate modules (kaXXXX.c) *	by processor type. *	Added a new routine cachenbl. * * 12-Feb-86 -- jrs *	Added tbsync() calls to control mp translation buffer * * 04-Feb-86 -- tresvik *	added VMB boot path support * * 04-feb-86 -- jaw  get rid of biic.h. * * 30 Jan 86 -- darrell *	All machine check headers, constants, and code has been *	removed from machdep.c and broken up by processor type *	and placed in separate modules.  The machine check  *	routines are now reached through the cpusw structure *	which is part of the machine dependent code *	restructuring. * *	The Generic machine check structure has been moved to  *	cpu.h * * 20 Jan 86 -- pmk *	Add getpammdata() for 8600. *	Add memory rountines for errlog and changed memerr(). *	Add logmck() to mackinecheck() for errlog. *	Add rundown flag to boot() stop recursive panics. * * 02 Jan 86 -- darrell *	Removed 8600 memory array callout.   * *  2-jan-86 -- rjl *	Fixed single user kit login limits for uVAXen * * 23-sep-85 -- jaw *	fixed microdelay hang bug. *	VAX8200 must do "halt" on reboot system call so the message *	buffer remains in memory. * * 09 Sep 85 -- Reilly *	Modified to handle the new 4.3BSD namei code and lockf call. * * 15 Aug 85 -- darrell *	Removed a debug printf I left in, and fixed a spelling error. * * 26-jul-85 -- jaw *	fixed SRM violation....TBIA data MBZ.	 * * 03-Jul-85 -- rjl *	Fixed calculation of machinecheck number for uVAX-II checks in *	the range of 80-83 * * 19-Jun-85 -- jaw *	VAX8200 name change. * * 06-Jun-85 -- jaw *	cleanup for 8200. * * 18-May-85 -- rjl *	Fixed dump code so that the uVAX-II would reboot after a dump *	attempt. * *  5-May-5  - Larry Cohen *	decrease number of clists to reflect larger cblocks * * 13-Mar-85 -jaw *	Changes for support of the VAX8200 were merged in. * * 27-Feb-85 -tresvik *	Changes for support of the VAX8600 were merged in. * * 29-Oct-84 tresvik * *	added recover from cache parity errors on the 11/750. *	added cache-on and cache-off functionality for machinecheck *	handling *	added timer to TB parity errors for 11/750. *	modified MAXUSERS to maxusers for MVAX for rjl * * 22-Feb-84 tresvik * *	fixed distributed bug in detecting 11/750 tb parity errors. * *	changed all printfs used to report memory failures to mprint's. *	added code to display on the console any hard memory failures *	detected after machine checks. * * In the beginning - tresvik * *	changed format of and corrected machine check logging. *	Corrections to the 730 list were made and addition of 750 *	summary list. * *	added MS780E support. * *	changed format of memerr reporting for corrected ecc errors. *	This includes failing array call out. * *  9 Jan 84 --jmcg *	Need to alter validation of ptes for buffers to match new *	allocation scheme in binit. * *  2 Jan 84 --jmcg *	Added support for MicroVAX 1. * ************************************************************************//*	machdep.c	6.1	83/08/20	*/#include "mba.h"#include "../machine/reg.h"#include "../machine/pte.h"#include "../machine/psl.h"#include "../h/param.h"#include "../h/systm.h"#include "../h/dir.h"#include "../h/user.h"#include "../h/kernel.h"#include "../h/mount.h"#include "../h/map.h"#include "../h/vm.h"#include "../h/proc.h"#include "../h/buf.h"#include "../h/reboot.h"#include "../h/conf.h"#include "../h/inode.h"#include "../h/gnode.h"#include "../h/file.h"#include "../h/text.h"#include "../h/clist.h"#include "../h/callout.h"#include "../h/cmap.h"#include "../h/quota.h"#include "../h/flock.h"#include "../h/cpudata.h"#include "../../machine/common/cpuconf.h"#include "../h/dump.h"#include "../h/errlog.h"#include "../h/socket.h"  /* 8.9.88.us  Support for nonsymm net devices */#include "../net/net/if.h"    /* 8.9.88.us  Support for nonsymm net devices */#include "../fs/ufs/fs.h"#include "../h/fs_types.h"#include "../machine/cons.h"#include "../machine/cpu.h"#include "../machine/mem.h"#include "../machine/mtpr.h"#include "../machine/scb.h"#include "../machine/clock.h"#include "../machine/rpb.h"#include "../machine/nexus.h"#include "../machine/ioa.h"#include "../machine/vmparam.h" #include "../io/uba/ubareg.h"#include "../io/uba/ubavar.h"#include "../machine/cvax.h"#include "../machine/ka650.h"#include "../machine/ka6200.h"#include "../machine/ka6400.h"#include "../io/mba/vax/mbavar.h"#include "../machine/sas/vmb.h"#include "../h/kmalloc.h"#include "../machine/ka60.h"#ifdef vax#include "../machine/vectors.h"#endifstruct lock_t lk_printf;extern struct kmemusage *kmemusage;extern kmeminit();struct cpusw *cpuswitch_entry();extern int	sysptsize;int	icode[] = {	0x9f19af9f,				/* pushab [&"init",0]; pushab */	0x02dd09af,				/* "/bin/init"; pushl $2 */	0xbc5c5ed0,				/* movl sp,ap; chmk */	0x2ffe110b,				/* $exec; brb .; "/ */	0x2f6e6962,				/* bin/ */	0x74696e69,				/* init" */	0x00000000,				/* \0\0\0";  0 */	0x00000014,				/* [&"init", */	0x00000000,				/* 0] */};int	szicode = sizeof (icode);/* These global variables must be in data space */caddr_t endofmem = 0;			/* last kernel virtual mem addr */struct cpusw *cpup;			/* pointer to cpusw entry *//* * Declare these as initialized data so we can patch them. */int	nbuf = 0;int	nswbuf = 0;int	bufpages = 0;int	Physmem = 0;int	bufdebug = 0;int	kperbuf = 0;	/* one buffer header for every kperbuf K of cache *//* * Set up when using the VMB boot path for CI support and dump support */int	*ci_ucode = 0;		/* If present, points to CI ucode */int	ci_ucodesz = 0;		/* If present, size of CI ucode */int	*vmbinfo = 0;		/* gets a physical address set in locore				   which is passed in by the VMB boot path *//* * Machine-dependent startup code */startup (firstaddr)int	firstaddr;{	register int	unixsize;	register unsigned   i;	struct pte *pte;	int	mapaddr, j;	register caddr_t v;	int	maxbufs, base, residual;	extern	char etext;	int savefirstaddr;	int vmbinfosz;	int	requestpages, maxbufpages, tenpercent;	int reducenbufs;	char *screen_storage;	int *ip;	struct cpudata *pcpu;	char *nxv;	extern int nproc;	extern int ntext;	extern int ngnode;	extern int nfile;	extern int nclist;	extern int ncallout;	extern int nchrout;	extern int nport;	extern int maxusers;	extern int appendflg;#ifdef QUOTA	extern int nquota;	extern int ndquot;#endif QUOTA	extern long usrptsize;	extern	int bufcache;	/* % of memory used for buffer cache data */	int tries = 0;	/* number of times we have tried to reconfigure */#ifndef UPGRADE#define UPGRADE 0#endif	char x[UPGRADE+1];#ifdef INET#define NETSLOP 20			/* for all the lousy servers*/#else#define NETSLOP 0#endif	/* bare bones initialization of cpudata */	if (cpu==VAX_6200) 		ka6200mapcsr();	if (cpu==VAX_6400) 		ka6400mapcsr();	if (cpu==VAX_9000)		ka9000mapcsr();	/* initialize this processor as boot cpu */	init_boot_cpu();	/* initialize the pointer to the cpusw entry */	cpup = cpuswitch_entry(cpu);/* * minimum free memory when leaving startup() */#define MINMEM_FREE	400	/* make it big enough for two /bin/csh's */	/*  	 *  At this point the IPL MUST be 1f (hex).   The following         *  code is intended to clean up any interrupts between          *  ipl 16 and 1f.  Note that the printf rountine sets the ipl	 *  to 16.		 */	if ((cpu == VAX_8800) || (cpu == VAX_8820)) 		mtpr(CLRTOSTS,1);	/*	 * If we used adb on the kernel and set "Physmem" to some	 *   value, then use that value for "physmem".	 * This allows us to run in less physical memory than the	 *   machine really has. (rr's idea).	 */	if (Physmem >= MINMEM_PGS) {		physmem = Physmem;	}	/*	 * Save the real amount of memory (or the above artificial	 * amount) to allow the sizer to accurately configure physmem	 * in the config file.  `Physmem' was originally added for the	 * sizer utility - tomt	 */	Physmem = physmem;	usrptsize = (int)(eUsrptmap - Usrptmap);	savefirstaddr = firstaddr;	nchrout = 4096;if (bufdebug) {	/*		 * recompute these when under the debug flag		 * so that maxusers can be patched and the		 * resulting table sizes will change		 */		ntext = 24 + maxusers + NETSLOP;		ngnode = nproc + maxusers + ntext + 48;		nfile = 16 * (nproc + 16 + maxusers) / 10  + 2 * NETSLOP + 32;		nclist = 75 + 16 * maxusers;		ncallout = 16 + nproc;		nport = nproc / 2;#ifdef QUOTA		nquota = (maxusers * 9)/7 + 3;		ndquot = (maxusers*NMOUNT)/4 + nproc;#endif}tryagain:	/*	 * Initialize system tables and data structures	 */	firstaddr = savefirstaddr;	/* The first time through the following	 * variables should be the same value as determined	 * in param.c .	 * If the system page table is too small for the available	 * physical memory, the physical memory (physmem) is artifically	 * reduced to MINMEM_MB megabytes.	 * This should allow booting generic kernels on systems with	 * large physical memory.	 * After booting successfully more accurate configuration parameters	 * should be specified in the config file and the system rebooted.	 */	if(tries != 0) {				nproc = 20 + 8 * maxusers;		ntext = 24 + maxusers + NETSLOP;		ngnode = nproc + maxusers + ntext + 48;		nfile = 16 * (nproc + 16 + maxusers) / 10  + 2 * NETSLOP + 32;		nclist = 75 + 16 * maxusers;		ncallout = 16 + nproc;		nport = nproc / 2;#ifdef QUOTA		nquota = (maxusers * 9)/7 + 3;		ndquot = (maxusers*NMOUNT)/4 + nproc;#endif	}		/*	 * Initialize vmb information (at end of core).	 * Size the information, adjust maxmem accordingly and map it into	 * the kernel.  Flush the translation buffer.	 */	/*	 * let maxmem be real memory as declared in locore	 * until vmb_info is mapped in	 */	freemem=physmem;		/* should be the same at this point */	if (vmbinfo && !tries) {	/* if VMB boot path and not a retry */		vmbinfosz = maxmem - btop(vmbinfo);		maxmem -= vmbinfosz;		/*		 * Now, make sure we won't try to map more pages than we		 * have ptes for.		 */		if (vmbinfosz > VMBINFOPAGES)			vmbinfosz = VMBINFOPAGES;		pte = vmbinfomap;		for (i=0; i<vmbinfosz; i++)			*(int *) pte++ = PG_V | PG_KW | (maxmem + i);		mtpr (TBIA,0);		if (vmb_info.ciucodebas && vmb_info.ciucodesiz) {			ci_ucode = (int *)&vmb_info +				(vmb_info.ciucodebas - vmbinfo);			ci_ucodesz = vmb_info.ciucodesiz;		}	}	/* 	 * If physmem has been artificially reduced, set maxmem to be	 * the same.  Otherwise, don't touch it.	 */	if (maxmem > physmem)				maxmem = physmem; /*  * Good {morning,afternoon,evening,night}.  */#if defined (MVAX) || defined (VAX3600) || defined (VAX420) || defined (VAX60)	/*	 * Setup the virtual console. vcons_init is an array of pointers	 * to initialization functions in the qv/qdss & sm/sg drivers. They 	 * return true if they could setup as the console.  This loop	 * stops at the end of the list or when it finds a driver that	 * succeeds in setting up the screen. Precidence is determined by	 * order as is everything in life.	 */	if (cpu == MVAX_I || cpu == MVAX_II || cpu == VAXSTAR ||		cpu == VAX_3600  || cpu == VAX_3400 || cpu == VAX_3900 ||		cpu == C_VAXSTAR) {		extern (*vcons_init[])();		for( i = 0 ; vcons_init[i] && (*vcons_init[i])() == 0 ; i++ )			;	}	/*	 * Firefox only...

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -