-/* init_main.c 4.45 83/01/16 */
+/* init_main.c 6.1 83/07/29 */
#include "../machine/pte.h"
#include "../h/protosw.h"
#endif
#include "../h/quota.h"
-
-#ifdef sun
-#include "../sun/reg.h"
-#include "../sun/cpu.h"
-#endif
+#include "../machine/reg.h"
+#include "../machine/cpu.h"
extern struct user u; /* have to declare it somewhere! */
/*
* loop at loc 13 (0xd) in user mode -- /etc/init
* cannot be executed.
*/
-#ifdef vax
main(firstaddr)
int firstaddr;
-#endif
-#ifdef sun
-main(regs)
- struct regs regs;
-#endif
{
register int i;
register struct proc *p;
rqinit();
#include "loop.h"
-#ifdef vax
startup(firstaddr);
-#endif
-#ifdef sun
- startup();
-#endif
/*
* set up system process 0 (swapper)
p->p_nice = NZERO;
setredzone(p->p_addr, (caddr_t)&u);
u.u_procp = p;
-#ifdef sun
- u.u_ar0 = ®s.r_r0;
-#endif
u.u_cmask = CMASK;
for (i = 1; i < NGROUPS; i++)
- u.u_groups[i] = -1;
+ u.u_groups[i] = NOGROUP;
for (i = 0; i < sizeof(u.u_rlimit)/sizeof(u.u_rlimit[0]); i++)
u.u_rlimit[i].rlim_cur = u.u_rlimit[i].rlim_max =
RLIM_INFINITY;
p->p_quota = u.u_quota = getquota(0, 0, Q_NDQ);
#endif
startrtclock();
+#include "kg.h"
+#if NKG > 0
+ startkgclock();
+#endif
/*
* Initialize tables, protocols, and set up well-known inodes.
if (newproc(0)) {
proc[2].p_flag |= SLOAD|SSYS;
proc[2].p_dsize = u.u_dsize = nswbuf*CLSIZE*KLMAX;
-#ifdef NOPAGING
- for (;;)
- sleep((caddr_t)&u, PSLEP);
- /*NOTREACHED*/
-#else
pageout();
/*NOTREACHED*/
-#endif
}
/*
proc[1].p_stat = 0;
proc[0].p_szpt = CLSIZE;
if (newproc(0)) {
-#ifdef vax
expand(clrnd((int)btoc(szicode)), 0);
(void) swpexpand(u.u_dsize, 0, &u.u_dmap, &u.u_smap);
(void) copyout((caddr_t)icode, (caddr_t)0, (unsigned)szicode);
-#endif
-#ifdef sun
- icode();
- usetup();
- regs.r_context = u.u_pcb.pcb_ctx->ctx_context;
-#endif
/*
* Return goes to loc. 0 of user init
* code just copied out.
*/
return;
}
-#ifdef MUSH
- /*
- * start MUSH daemon
- * pid == 3
- */
- if (newproc(0)) {
-#ifdef vax
- expand(clrnd((int)btoc(szmcode)), 0);
- (void) swpexpand(u.u_dsize, 0, &u.u_dmap, &u.u_smap);
- (void) copyout((caddr_t)mcode, (caddr_t)0, (unsigned)szmcode);
- /*
- * Return goes to loc. 0 of user mush
- * code just copied out.
- */
- return;
-#endif
- }
-#endif
proc[0].p_szpt = 1;
sched();
}
bp = &buf[i];
bp->b_dev = NODEV;
bp->b_bcount = 0;
-#ifndef sun
bp->b_un.b_addr = buffers + i * MAXBSIZE;
if (i < residual)
bp->b_bufsize = (base + 1) * CLBYTES;
else
bp->b_bufsize = base * CLBYTES;
binshash(bp, &bfreelist[BQ_AGE]);
-#else
- bp->b_un.b_addr = (char *)0;
- bp->b_bufsize = 0;
- binshash(bp, &bfreelist[BQ_EMPTY]);
-#endif
bp->b_flags = B_BUSY|B_INVAL;
brelse(bp);
}
* system is issued, usually when the system goes multi-user.
*/
nswdev = 0;
- for (swp = swdevt; swp->sw_dev; swp++)
+ nswap = 0;
+ for (swp = swdevt; swp->sw_dev; swp++) {
nswdev++;
+ if (swp->sw_nblks > nswap)
+ nswap = swp->sw_nblks;
+ }
if (nswdev == 0)
panic("binit");
if (nswdev > 1)
- nswap = (nswap/DMMAX)*DMMAX;
+ nswap = ((nswap + dmmax - 1) / dmmax) * dmmax;
nswap *= nswdev;
maxpgio *= nswdev;
swfree(0);