* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism. * use format_bytes() to format the various printf()s that print out memory sizes
This commit is contained in:
parent
5ef2870d85
commit
e4a87aa1a9
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.172 1999/04/29 03:02:20 ross Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.173 1999/05/20 08:21:42 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -64,7 +64,6 @@
|
|||
* rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
#include "opt_pmap_new.h"
|
||||
|
@ -78,11 +77,10 @@
|
|||
#include "opt_iso.h"
|
||||
#include "opt_ns.h"
|
||||
#include "opt_natm.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.172 1999/04/29 03:02:20 ross Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.173 1999/05/20 08:21:42 lukem Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -109,15 +107,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.172 1999/04/29 03:02:20 ross Exp $");
|
|||
#include <sys/core.h>
|
||||
#include <sys/kcore.h>
|
||||
#include <machine/kcore.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
@ -194,26 +183,6 @@ vm_map_t exec_map = NULL;
|
|||
vm_map_t mb_map = NULL;
|
||||
vm_map_t phys_map = NULL;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
|
||||
#ifndef BUFPAGES
|
||||
#define BUFPAGES 0
|
||||
#endif
|
||||
#ifndef BUFCACHE
|
||||
#define BUFCACHE 10
|
||||
#endif
|
||||
|
||||
int bufpages = BUFPAGES; /* optional hardwired count */
|
||||
int bufcache = BUFCACHE; /* % of RAM to use for buffer cache */
|
||||
|
||||
caddr_t msgbufaddr;
|
||||
|
||||
int maxmem; /* max memory per process */
|
||||
|
@ -245,7 +214,7 @@ u_int64_t cycles_per_usec;
|
|||
/* number of cpus in the box. really! */
|
||||
int ncpus;
|
||||
|
||||
/* machine check info array, valloc()'ed in allocsys() */
|
||||
/* machine check info array, valloc()'ed in mdallocsys() */
|
||||
|
||||
static struct mchkinfo startup_info,
|
||||
*mchkinfo_all_cpus;
|
||||
|
@ -280,12 +249,12 @@ int alpha_unaligned_sigbus = 0; /* don't SIGBUS on fixed-up accesses */
|
|||
phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX]; /* low size bits overloaded */
|
||||
int mem_cluster_cnt;
|
||||
|
||||
caddr_t allocsys __P((caddr_t));
|
||||
int cpu_dump __P((void));
|
||||
int cpu_dumpsize __P((void));
|
||||
u_long cpu_dump_mempagecnt __P((void));
|
||||
void dumpsys __P((void));
|
||||
void identifycpu __P((void));
|
||||
caddr_t mdallocsys __P((caddr_t));
|
||||
void netintr __P((void));
|
||||
void printregs __P((struct reg *));
|
||||
|
||||
|
@ -900,69 +869,17 @@ nobootinfo:
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures. We are given
|
||||
* a starting virtual address and we return a final virtual
|
||||
* address; along the way we set each data structure pointer.
|
||||
*
|
||||
* We call allocsys() with 0 to find out how much space we want,
|
||||
* allocate that much and fill it with zeroes, and the call
|
||||
* allocsys() again with the correct base virtual address.
|
||||
*/
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
caddr_t v;
|
||||
mdallocsys(v)
|
||||
caddr_t v;
|
||||
{
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
(name) = (type *)v; v = (caddr_t)ALIGN((name)+(num))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine how many buffers to allocate.
|
||||
* We allocate bufcache % of memory for buffer space. Insure a
|
||||
* minimum of 16 buffers. We allocate 1/2 as many swap buffer
|
||||
* headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0)
|
||||
bufpages = physmem / CLSIZE * bufcache / 100;
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
|
||||
/*
|
||||
* There appears to be a correlation between the number
|
||||
* of processor slots defined in the HWRPB and the whami
|
||||
* value that can be returned.
|
||||
*/
|
||||
valloc(mchkinfo_all_cpus, struct mchkinfo, hwrpb->rpb_pcs_cnt);
|
||||
|
||||
ALLOCSYS(v, mchkinfo_all_cpus, struct mchkinfo, hwrpb->rpb_pcs_cnt);
|
||||
return (v);
|
||||
#undef valloc
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1007,6 +924,7 @@ cpu_startup()
|
|||
int base, residual;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
char pbuf[9];
|
||||
#if defined(DEBUG)
|
||||
extern int pmapdebug;
|
||||
int opmapdebug = pmapdebug;
|
||||
|
@ -1019,14 +937,20 @@ cpu_startup()
|
|||
*/
|
||||
printf(version);
|
||||
identifycpu();
|
||||
printf("real mem = %lu (%lu reserved for PROM, %lu used by NetBSD)\n",
|
||||
((psize_t) totalphysmem << (psize_t) PAGE_SHIFT),
|
||||
ptoa(resvmem), ptoa(physmem));
|
||||
if (unusedmem)
|
||||
printf("WARNING: unused memory = %d bytes\n", ctob(unusedmem));
|
||||
if (unknownmem)
|
||||
printf("WARNING: %d bytes of memory with unknown purpose\n",
|
||||
ctob(unknownmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), totalphysmem << PAGE_SHIFT);
|
||||
printf("total memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(resvmem));
|
||||
printf("(%s reserved for PROM, ", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(physmem));
|
||||
printf("%s used by NetBSD)\n", pbuf);
|
||||
if (unusedmem) {
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(unusedmem));
|
||||
printf("WARNING: unused memory = %s\n", pbuf);
|
||||
}
|
||||
if (unknownmem) {
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(unknownmem));
|
||||
printf("WARNING: %s of memory with unknown purpose\n", pbuf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate virtual address space for file I/O buffers.
|
||||
|
@ -1101,16 +1025,18 @@ cpu_startup()
|
|||
#if defined(DEBUG)
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
printf("avail mem = %ld\n", (long)ptoa(uvmexp.free));
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
#if 0
|
||||
{
|
||||
extern u_long pmap_pages_stolen;
|
||||
printf("stolen memory for VM structures = %ld bytes\n",
|
||||
pmap_pages_stolen * PAGE_SIZE);
|
||||
|
||||
format_bytes(pbuf, sizeof(pbuf), pmap_pages_stolen * PAGE_SIZE);
|
||||
printf("stolen memory for VM structures = %s\n", pbuf);
|
||||
}
|
||||
#endif
|
||||
printf("using %ld buffers containing %ld bytes of memory\n",
|
||||
(long)nbuf, (long)(bufpages * CLBYTES));
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %ld buffers containing %s of memory\n", (long)nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up buffers, so they can be used to read disk labels.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.135 1999/04/26 22:46:44 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.136 1999/05/20 08:21:43 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -42,14 +42,12 @@
|
|||
* @(#)machdep.c 7.16 (Berkeley) 6/3/91
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_inet.h"
|
||||
#include "opt_atalk.h"
|
||||
#include "opt_iso.h"
|
||||
#include "opt_ns.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -75,15 +73,6 @@
|
|||
#include <sys/syscallargs.h>
|
||||
#include <sys/core.h>
|
||||
#include <sys/kcore.h>
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#include <net/netisr.h>
|
||||
#define MAXMEM 64*1024*CLSIZE /* XXX - from cmap.h */
|
||||
#include <vm/vm.h>
|
||||
|
@ -174,20 +163,6 @@ vm_map_t exec_map = NULL;
|
|||
vm_map_t mb_map = NULL;
|
||||
vm_map_t phys_map = NULL;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
caddr_t msgbufaddr;
|
||||
vm_offset_t msgbufpa;
|
||||
|
||||
|
@ -258,8 +233,9 @@ void
|
|||
cpu_startup()
|
||||
{
|
||||
register unsigned i;
|
||||
register caddr_t v, firstaddr;
|
||||
caddr_t v;
|
||||
int base, residual;
|
||||
char pbuf[9];
|
||||
#ifdef DEBUG
|
||||
extern int pmapdebug;
|
||||
int opmapdebug = pmapdebug;
|
||||
|
@ -289,89 +265,17 @@ cpu_startup()
|
|||
*/
|
||||
printf(version);
|
||||
identifycpu();
|
||||
printf("real mem = %d (%d pages)\n", ctob(physmem), ctob(physmem)/NBPG);
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures.
|
||||
* The first available real memory address is in "firstaddr".
|
||||
* The first available kernel virtual address is in "v".
|
||||
* As pages of kernel virtual memory are allocated, "v" is incremented.
|
||||
* As pages of memory are allocated and cleared,
|
||||
* "firstaddr" is incremented.
|
||||
* An index into the kernel page table corresponding to the
|
||||
* virtual memory address maintained in "v" is kept in "mapaddr".
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
/*
|
||||
* Make two passes. The first pass calculates how much memory is
|
||||
* needed and allocates it. The second pass assigns virtual
|
||||
* addresses to the various data structures.
|
||||
*/
|
||||
firstaddr = 0;
|
||||
again:
|
||||
v = (caddr_t)firstaddr;
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
(name) = (type *)v; v = (caddr_t)((name)+(num))
|
||||
#define valloclim(name, type, num, lim) \
|
||||
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
|
||||
/* valloc(cfree, struct cblock, nclist); */
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
/*
|
||||
* Determine how many buffers to allocate. We allocate
|
||||
* the BSD standard of use 10% of memory for the first 2 Meg,
|
||||
* 5% of remaining. Insure a minimum of 16 buffers.
|
||||
* We allocate 3/4 as many swap buffer headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
if (physmem < btoc(2 * 1024 * 1024))
|
||||
bufpages = physmem / (10 * CLSIZE);
|
||||
else
|
||||
bufpages = (btoc(2 * 1024 * 1024) + physmem) /
|
||||
(20 * CLSIZE);
|
||||
}
|
||||
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf * 3 / 4) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
/*
|
||||
* End of first pass, size has been calculated so allocate memory
|
||||
*/
|
||||
if (firstaddr == 0) {
|
||||
size = (vm_size_t)(v - firstaddr);
|
||||
firstaddr = (caddr_t)uvm_km_zalloc(kernel_map,
|
||||
round_page(size));
|
||||
if (firstaddr == 0)
|
||||
panic("startup: no room for tables");
|
||||
goto again;
|
||||
}
|
||||
/*
|
||||
* End of second pass, addresses have been assigned
|
||||
*/
|
||||
if ((vm_size_t)(v - firstaddr) != size)
|
||||
size = (vm_size_t)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(size))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v, NULL) - v != size)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -451,10 +355,10 @@ again:
|
|||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
printf("avail mem = %ld (%ld pages)\n", ptoa(uvmexp.free),
|
||||
ptoa(uvmexp.free)/NBPG);
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* display memory configuration passed from loadbsd
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.67 1999/04/26 22:46:44 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.68 1999/05/20 08:21:43 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1998 Mark Brinicombe.
|
||||
|
@ -40,11 +40,9 @@
|
|||
* Created : 17/09/94
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_md.h"
|
||||
#include "opt_pmap_debug.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -63,16 +61,6 @@
|
|||
#include <sys/sysctl.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include <machine/db_machdep.h>
|
||||
|
@ -126,26 +114,6 @@ int kernel_debug = 0;
|
|||
|
||||
struct user *proc0paddr;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
#ifdef BUFCACHE
|
||||
int bufcache = BUFCACHE; /* % of RAM to use for buffer cache */
|
||||
#else
|
||||
int bufcache = 0; /* fallback to old algorithm */
|
||||
#endif
|
||||
|
||||
int cold = 1;
|
||||
|
||||
/* Prototypes */
|
||||
|
@ -161,7 +129,6 @@ void map_entry_ro __P((vm_offset_t pt, vm_offset_t va, vm_offset_t pa));
|
|||
|
||||
void pmap_bootstrap __P((vm_offset_t kernel_l1pt));
|
||||
u_long strtoul __P((const char *s, char **ptr, int base));
|
||||
caddr_t allocsys __P((caddr_t v));
|
||||
void data_abort_handler __P((trapframe_t *frame));
|
||||
void prefetch_abort_handler __P((trapframe_t *frame));
|
||||
void zero_page_readonly __P((void));
|
||||
|
@ -375,6 +342,7 @@ cpu_startup()
|
|||
caddr_t size;
|
||||
vm_size_t bufsize;
|
||||
int base, residual;
|
||||
char pbuf[9];
|
||||
|
||||
proc0paddr = (struct user *)kernelstack.pv_va;
|
||||
proc0.p_addr = proc0paddr;
|
||||
|
@ -411,17 +379,21 @@ cpu_startup()
|
|||
* not be buffered).
|
||||
*/
|
||||
printf(version);
|
||||
printf("real mem = %d\n", arm_page_to_byte(physmem));
|
||||
|
||||
format_bytes(pbuf, sizeof(pbuf), arm_page_to_byte(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
size = allocsys((caddr_t)0);
|
||||
size = allocsys(NULL, NULL);
|
||||
sysbase = (caddr_t)uvm_km_zalloc(kernel_map, round_page(size));
|
||||
if (sysbase == 0)
|
||||
panic("cpu_startup: no room for system tables %d bytes required", (u_int)size);
|
||||
if ((caddr_t)((allocsys(sysbase) - sysbase)) != size)
|
||||
panic(
|
||||
"cpu_startup: no room for system tables; %d bytes required",
|
||||
(u_int)size);
|
||||
if ((caddr_t)((allocsys(sysbase, NULL) - sysbase)) != size)
|
||||
panic("cpu_startup: system table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -489,9 +461,10 @@ cpu_startup()
|
|||
callout[loop - 1].c_next = &callout[loop];
|
||||
callout[loop - 1].c_next = NULL;
|
||||
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up buffers, so they can be used to read disk labels.
|
||||
|
@ -508,103 +481,6 @@ cpu_startup()
|
|||
proc0.p_md.md_regs = (struct trapframe *)curpcb->pcb_sp - 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures. We are given
|
||||
* a starting virtual address and we return a final virtual
|
||||
* address; along the way we set each data structure pointer.
|
||||
*
|
||||
* We call allocsys() with 0 to find out how much space we want,
|
||||
* allocate that much and fill it with zeroes, and then call
|
||||
* allocsys() again with the correct base virtual address.
|
||||
*/
|
||||
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
caddr_t v;
|
||||
{
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
(caddr_t)(name) = (type *)v; \
|
||||
v = (caddr_t)((name) + (num));
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If necessary, determine the number of pages to use for the
|
||||
* buffer cache. We allocate 1/2 as many swap buffer headers
|
||||
* as file I/O buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
if (bufcache == 0) { /* use old algorithm */
|
||||
/*
|
||||
* Determine how many buffers to allocate. We use 10%
|
||||
* of the first 2MB of memory, and 5% of the rest, with
|
||||
* a minimum of 16 buffers.
|
||||
*/
|
||||
if (physmem < arm_byte_to_page(2 * 1024 * 1024))
|
||||
bufpages = physmem / (10 * CLSIZE);
|
||||
else
|
||||
bufpages = (arm_byte_to_page(2 * 1024 * 1024)
|
||||
+ physmem) / (20 * CLSIZE);
|
||||
} else {
|
||||
/*
|
||||
* Set size of buffer cache to physmem/bufcache * 100
|
||||
* (i.e., bufcache % of physmem).
|
||||
*/
|
||||
if (bufcache < 5 || bufcache > 95) {
|
||||
printf(
|
||||
"warning: unable to set bufcache to %d%% of RAM, using 10%%",
|
||||
bufcache);
|
||||
bufcache = 10;
|
||||
}
|
||||
bufpages= physmem / (CLSIZE * 100) * bufcache;
|
||||
}
|
||||
}
|
||||
#ifdef DIAGNOSTIC
|
||||
if (bufpages == 0)
|
||||
panic("bufpages = 0\n");
|
||||
#endif
|
||||
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX stopgap measure to prevent wasting too much KVM on
|
||||
* the sparsely filled buffer cache.
|
||||
*/
|
||||
if (nbuf * MAXBSIZE > VM_MAX_KERNEL_BUF)
|
||||
nbuf = VM_MAX_KERNEL_BUF / MAXBSIZE;
|
||||
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) & ~1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
|
||||
return(v);
|
||||
}
|
||||
|
||||
#ifndef FOOTBRIDGE
|
||||
/*
|
||||
* Initialise the console
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.81 1999/04/26 22:46:45 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.82 1999/05/20 08:21:43 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -42,14 +42,12 @@
|
|||
* @(#)machdep.c 7.16 (Berkeley) 6/3/91
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_atalk.h"
|
||||
#include "opt_inet.h"
|
||||
#include "opt_iso.h"
|
||||
#include "opt_ns.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -73,15 +71,6 @@
|
|||
#include <sys/queue.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#include <net/netisr.h>
|
||||
#define MAXMEM 64*1024*CLSIZE /* XXX - from cmap.h */
|
||||
#include <vm/vm.h>
|
||||
|
@ -113,20 +102,6 @@ vm_map_t exec_map = NULL;
|
|||
vm_map_t mb_map = NULL;
|
||||
vm_map_t phys_map = NULL;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
#ifdef BUFCACHE
|
||||
int bufchache = BUFCACHE;
|
||||
#else
|
||||
int bufcache = 0;
|
||||
#endif
|
||||
|
||||
caddr_t msgbufaddr;
|
||||
vaddr_t msgbufpa;
|
||||
|
||||
|
@ -181,9 +156,10 @@ cpu_startup()
|
|||
{
|
||||
extern void etext __P((void));
|
||||
register unsigned i;
|
||||
register caddr_t v, firstaddr;
|
||||
caddr_t v;
|
||||
int base, residual;
|
||||
u_long avail_mem;
|
||||
char pbuf[9];
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int pmapdebug;
|
||||
|
@ -215,105 +191,17 @@ cpu_startup()
|
|||
printf(version);
|
||||
identifycpu();
|
||||
|
||||
printf("real mem = %ld (%ld pages)\n", mem_size, mem_size/NBPG);
|
||||
format_bytes(pbuf, sizeof(pbuf), mem_size);
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures.
|
||||
* The first available real memory address is in "firstaddr".
|
||||
* The first available kernel virtual address is in "v".
|
||||
* As pages of kernel virtual memory are allocated, "v" is incremented.
|
||||
* As pages of memory are allocated and cleared,
|
||||
* "firstaddr" is incremented.
|
||||
* An index into the kernel page table corresponding to the
|
||||
* virtual memory address maintained in "v" is kept in "mapaddr".
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
/*
|
||||
* Make two passes. The first pass calculates how much memory is
|
||||
* needed and allocates it. The second pass assigns virtual
|
||||
* addresses to the various data structures.
|
||||
*/
|
||||
firstaddr = 0;
|
||||
again:
|
||||
v = (caddr_t)firstaddr;
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
(name) = (type *)v; v = (caddr_t)((name)+(num))
|
||||
#define valloclim(name, type, num, lim) \
|
||||
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
|
||||
/* valloc(cfree, struct cblock, nclist); */
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
/*
|
||||
* If necessary, determine the number of pages to use for the
|
||||
* buffer cache. We allocate 1/2 as many swap buffer headers
|
||||
* as file I/O buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
if (bufcache == 0) { /* use old algorithm */
|
||||
/*
|
||||
* Determine how many buffers to allocate. We use 10%
|
||||
* of the first 2MB of memory, and 5% of the rest, with
|
||||
* a minimum of 16 buffers.
|
||||
*/
|
||||
if (physmem < btoc(2 * 1024 * 1024))
|
||||
bufpages = physmem / (10 * CLSIZE);
|
||||
else
|
||||
bufpages = (btoc(2 * 1024 * 1024) + physmem) /
|
||||
(20 * CLSIZE);
|
||||
} else {
|
||||
/*
|
||||
* Set size of buffer cache to physmem/bufcache * 100
|
||||
* (i.e., bufcache % of physmem).
|
||||
*/
|
||||
if (bufcache < 5 || bufcache > 95) {
|
||||
printf("warning: unable to set bufcache "
|
||||
"to %d%% of RAM, using 10%%", bufcache);
|
||||
bufcache = 10;
|
||||
}
|
||||
bufpages = physmem / (CLSIZE * 100) * bufcache;
|
||||
}
|
||||
}
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf * 3 / 4) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
/*
|
||||
* End of first pass, size has been calculated so allocate memory
|
||||
*/
|
||||
if (firstaddr == 0) {
|
||||
size = (vsize_t)(v - firstaddr);
|
||||
firstaddr = (caddr_t) uvm_km_zalloc(kernel_map,
|
||||
round_page(size));
|
||||
if (firstaddr == 0)
|
||||
panic("startup: no room for tables");
|
||||
goto again;
|
||||
}
|
||||
/*
|
||||
* End of second pass, addresses have been assigned
|
||||
*/
|
||||
if ((vsize_t)(v - firstaddr) != size)
|
||||
size = (int)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(size))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v, NULL) - v != size)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -410,9 +298,9 @@ again:
|
|||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
avail_mem = ptoa(uvmexp.free);
|
||||
printf("avail mem = %ld (%ld pages)\n", avail_mem, avail_mem/NBPG);
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
printf("avail mem = %s\n", format_memory(avail_mem));
|
||||
printf("using %d buffers containing %s of memory\n",
|
||||
nbuf, format_memory(bufpages * CLBYTES));
|
||||
|
||||
/*
|
||||
* Set up buffers, so they can be used to read disk labels.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.36 1999/04/17 21:16:46 ws Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.37 1999/05/20 08:21:43 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -37,7 +37,6 @@
|
|||
#include "opt_ccitt.h"
|
||||
#include "opt_iso.h"
|
||||
#include "opt_ns.h"
|
||||
#include "opt_sysv.h"
|
||||
#include "ipkdb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -137,8 +136,6 @@ vaddr_t msgbuf_vaddr;
|
|||
|
||||
paddr_t avail_end; /* XXX temporary */
|
||||
|
||||
caddr_t allocsys __P((caddr_t));
|
||||
|
||||
void install_extint __P((void (*)(void)));
|
||||
int cold = 1;
|
||||
|
||||
|
@ -443,6 +440,7 @@ cpu_startup()
|
|||
caddr_t v;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
int base, residual;
|
||||
char pbuf[9];
|
||||
|
||||
proc0.p_addr = proc0paddr;
|
||||
v = (caddr_t)proc0paddr + USPACE;
|
||||
|
@ -469,17 +467,17 @@ cpu_startup()
|
|||
printf("%s", version);
|
||||
identifycpu();
|
||||
|
||||
printf("real memory = %d (%dK bytes)\n",
|
||||
ctob(physmem), ctob(physmem) / 1024);
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
sz = (int)allocsys((caddr_t)0);
|
||||
sz = (int)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(sz))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v) - v != sz)
|
||||
if (allocsys(v, NULL) - v != sz)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -553,10 +551,10 @@ cpu_startup()
|
|||
for (i = 1; i < ncallout; i++)
|
||||
callout[i - 1].c_next = &callout[i];
|
||||
|
||||
printf("avail memory = %d (%dK bytes)\n",
|
||||
ptoa(uvmexp.free), ptoa(uvmexp.free) / 1024);
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up the buffers.
|
||||
|
@ -575,52 +573,6 @@ cpu_startup()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures.
|
||||
*/
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
caddr_t v;
|
||||
{
|
||||
#define valloc(name, type, num) \
|
||||
v = (caddr_t)(((name) = (type *)v) + (num))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof (int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Decide on buffer space to use.
|
||||
*/
|
||||
if (bufpages == 0)
|
||||
bufpages = (physmem / 20) / CLSIZE;
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) & ~1;
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256;
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
|
||||
return (v);
|
||||
}
|
||||
|
||||
/*
|
||||
* lookup_bootinfo:
|
||||
* Look up information in bootinfo of boot loader.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.125 1999/04/26 22:46:45 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.126 1999/05/20 08:21:44 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -42,11 +42,9 @@
|
|||
* @(#)machdep.c 8.10 (Berkeley) 4/20/94
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_compat_hpux.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -74,15 +72,6 @@
|
|||
#include <sys/core.h>
|
||||
#include <sys/kcore.h>
|
||||
#include <sys/vnode.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#include <machine/db_machdep.h>
|
||||
#include <ddb/db_sym.h>
|
||||
|
@ -125,25 +114,6 @@ vm_map_t phys_map = NULL;
|
|||
|
||||
extern paddr_t avail_end;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
#ifdef BUFCACHE
|
||||
int bufcache = BUFCACHE;
|
||||
#else
|
||||
int bufcache = 10;
|
||||
#endif
|
||||
caddr_t msgbufaddr;
|
||||
int maxmem; /* max memory per process */
|
||||
int physmem = MAXMEM; /* max supported memory, changes to actual */
|
||||
|
@ -161,7 +131,6 @@ extern struct emul emul_hpux;
|
|||
#endif
|
||||
|
||||
/* prototypes for local functions */
|
||||
caddr_t allocsys __P((caddr_t));
|
||||
void parityenable __P((void));
|
||||
int parityerror __P((struct frame *));
|
||||
int parityerrorfind __P((void));
|
||||
|
@ -291,6 +260,7 @@ cpu_startup()
|
|||
int base, residual;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
char pbuf[9];
|
||||
#ifdef DEBUG
|
||||
extern int pmapdebug;
|
||||
int opmapdebug = pmapdebug;
|
||||
|
@ -308,17 +278,18 @@ cpu_startup()
|
|||
*/
|
||||
printf(version);
|
||||
identifycpu();
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and the give everything true virtual addresses.
|
||||
*/
|
||||
size = (vsize_t)allocsys((caddr_t)0);
|
||||
size = (vsize_t)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(size))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if ((allocsys(v) - v) != size)
|
||||
panic("startup: talbe size inconsistency");
|
||||
if ((allocsys(v, NULL) - v) != size)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
* Now allocate buffers proper. They are different than the above
|
||||
|
@ -394,9 +365,10 @@ cpu_startup()
|
|||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Tell the VM system that page 0 isn't mapped.
|
||||
|
@ -430,73 +402,6 @@ cpu_startup()
|
|||
bufinit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures. We are given
|
||||
* a starting virtual address and we return a final virtual
|
||||
* address; along the way we set each data structure pointer.
|
||||
*
|
||||
* We call allocsys() with 0 to find out how much space we want,
|
||||
* allocate that much and fill it with zeroes, and the call
|
||||
* allocsys() again with the correct base virtual address.
|
||||
*/
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
caddr_t v;
|
||||
{
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
(name) = (type *)v; v = (caddr_t)((name)+(num))
|
||||
#define valloclim(name, type, num, lim) \
|
||||
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine how many buffers to allocate. Since HPs tend
|
||||
* to be long on memory and short on disk speed, we allocate
|
||||
* more buffer space than the BSD standard of 10% of memory
|
||||
* for the first 2 Meg, 5% of the remaining. We just allocate
|
||||
* a flag 10%. Insure a minimum of 16 buffers. We allocate
|
||||
* 1/2 as many swap buffer headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
if (bufcache < 5 || bufcache > 95) {
|
||||
printf(
|
||||
"WARNING: unable to set bufcache to %d%% of RAM, using 10%%",
|
||||
bufcache);
|
||||
bufcache = 10;
|
||||
}
|
||||
bufpages = physmem * bufcache / (CLSIZE * 100);
|
||||
}
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
return (v);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set registers on exec.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.353 1999/05/12 19:28:29 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.354 1999/05/20 08:21:44 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -75,7 +75,6 @@
|
|||
* @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_cputype.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_vm86.h"
|
||||
|
@ -84,7 +83,6 @@
|
|||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_cpureset_delay.h"
|
||||
#include "opt_compat_svr4.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -110,15 +108,6 @@
|
|||
#include <sys/core.h>
|
||||
#include <sys/kcore.h>
|
||||
#include <machine/kcore.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#ifdef KGDB
|
||||
#include <sys/kgdb.h>
|
||||
|
@ -226,26 +215,6 @@ char bootinfo[BOOTINFO_MAXSIZE];
|
|||
struct bi_devmatch *i386_alldisks = NULL;
|
||||
int i386_ndisks = 0;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
#ifdef BUFCACHE
|
||||
int bufcache = BUFCACHE; /* % of RAM to use for buffer cache */
|
||||
#else
|
||||
int bufcache = 0; /* fallback to old algorithm */
|
||||
#endif
|
||||
|
||||
#ifdef CPURESET_DELAY
|
||||
int cpureset_delay = CPURESET_DELAY;
|
||||
#else
|
||||
|
@ -301,7 +270,6 @@ static int ioport_malloc_safe;
|
|||
phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
|
||||
int mem_cluster_cnt;
|
||||
|
||||
caddr_t allocsys __P((caddr_t));
|
||||
int cpu_dump __P((void));
|
||||
int cpu_dumpsize __P((void));
|
||||
u_long cpu_dump_mempagecnt __P((void));
|
||||
|
@ -394,6 +362,7 @@ cpu_startup()
|
|||
int sz, x;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
char pbuf[9];
|
||||
#if NBIOSCALL > 0
|
||||
extern int biostramp_image_size;
|
||||
extern u_char biostramp_image[];
|
||||
|
@ -403,7 +372,7 @@ cpu_startup()
|
|||
* Initialize error message buffer (et end of core).
|
||||
*/
|
||||
#if defined(PMAP_NEW)
|
||||
msgbuf_vaddr = uvm_km_valloc(kernel_map, i386_round_page(MSGBUFSIZE));
|
||||
msgbuf_vaddr = uvm_km_valloc(kernel_map, i386_round_page(MSGBUFSIZE));
|
||||
if (msgbuf_vaddr == NULL)
|
||||
panic("failed to valloc msgbuf_vaddr");
|
||||
#endif
|
||||
|
@ -423,16 +392,17 @@ cpu_startup()
|
|||
printf(version);
|
||||
identifycpu();
|
||||
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
sz = (int)allocsys((caddr_t)0);
|
||||
sz = (int)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(sz))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v) - v != sz)
|
||||
if (allocsys(v, NULL) - v != sz)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -497,9 +467,10 @@ cpu_startup()
|
|||
* XXX we need to account for those pages when printing
|
||||
* XXX the amount of free memory.
|
||||
*/
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free - bufpages));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free - bufpages));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
#if NBIOSCALL > 0
|
||||
/*
|
||||
|
@ -615,93 +586,6 @@ i386_bufinit()
|
|||
bufinit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures. We are given
|
||||
* a starting virtual address and we return a final virtual
|
||||
* address; along the way we set each data structure pointer.
|
||||
*
|
||||
* We call allocsys() with 0 to find out how much space we want,
|
||||
* allocate that much and fill it with zeroes, and then call
|
||||
* allocsys() again with the correct base virtual address.
|
||||
*/
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
caddr_t v;
|
||||
{
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
v = (caddr_t)(((name) = (type *)v) + (num))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If necessary, determine the number of pages to use for the
|
||||
* buffer cache. We allocate 1/2 as many swap buffer headers
|
||||
* as file I/O buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
if (bufcache == 0) { /* use old algorithm */
|
||||
/*
|
||||
* Determine how many buffers to allocate. We use 10%
|
||||
* of the first 2MB of memory, and 5% of the rest, with
|
||||
* a minimum of 16 buffers.
|
||||
*/
|
||||
if (physmem < btoc(2 * 1024 * 1024))
|
||||
bufpages = physmem / (10 * CLSIZE);
|
||||
else
|
||||
bufpages = (btoc(2 * 1024 * 1024) + physmem) /
|
||||
(20 * CLSIZE);
|
||||
} else {
|
||||
/*
|
||||
* Set size of buffer cache to physmem/bufcache * 100
|
||||
* (i.e., bufcache % of physmem).
|
||||
*/
|
||||
if (bufcache < 5 || bufcache > 95) {
|
||||
printf(
|
||||
"warning: unable to set bufcache to %d%% of RAM, using 10%%",
|
||||
bufcache);
|
||||
bufcache = 10;
|
||||
}
|
||||
bufpages= physmem / (CLSIZE * 100) * bufcache;
|
||||
}
|
||||
}
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX stopgap measure to prevent wasting too much KVM on
|
||||
* the sparsely filled buffer cache.
|
||||
*/
|
||||
if (nbuf * MAXBSIZE > VM_MAX_KERNEL_BUF)
|
||||
nbuf = VM_MAX_KERNEL_BUF / MAXBSIZE;
|
||||
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
return v;
|
||||
}
|
||||
|
||||
/*
|
||||
* Info for CTL_HW
|
||||
*/
|
||||
|
@ -1820,8 +1704,10 @@ init386(first_avail)
|
|||
* is what puts us over 16M.
|
||||
*/
|
||||
if (biosextmem > (15*1024) && biosextmem < (16*1024)) {
|
||||
printf("Warning: ignoring %dk of remapped memory\n",
|
||||
biosextmem - (15*1024));
|
||||
char pbuf[9];
|
||||
|
||||
format_bytes(pbuf, sizeof(pbuf), biosextmem - (15*1024));
|
||||
printf("Warning: ignoring %s of remapped memory\n", pbuf);
|
||||
biosextmem = (15*1024);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.232 1999/05/03 19:10:54 scottr Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.233 1999/05/20 08:21:44 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -77,10 +77,8 @@
|
|||
*/
|
||||
|
||||
#include "opt_adb.h"
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_sysv.h"
|
||||
#include "zsc.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -108,15 +106,6 @@
|
|||
#ifdef KGDB
|
||||
#include <sys/kgdb.h>
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#include <machine/db_machdep.h>
|
||||
#include <ddb/db_sym.h>
|
||||
|
@ -190,26 +179,6 @@ vm_map_t exec_map = NULL;
|
|||
vm_map_t mb_map = NULL;
|
||||
vm_map_t phys_map = NULL;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
#ifdef BUFCACHE
|
||||
int bufcache = BUFCACHE;
|
||||
#else
|
||||
int bufcache = 0;
|
||||
#endif
|
||||
|
||||
caddr_t msgbufaddr;
|
||||
int maxmem; /* max memory per process */
|
||||
int physmem = MAXMEM; /* max supported memory, changes to actual */
|
||||
|
@ -378,6 +347,7 @@ cpu_startup(void)
|
|||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size = 0; /* To avoid compiler warning */
|
||||
int delay;
|
||||
char pbuf[9];
|
||||
|
||||
/*
|
||||
* Initialize the kernel crash dump header.
|
||||
|
@ -403,105 +373,17 @@ cpu_startup(void)
|
|||
printf("this kernel.\n\n");
|
||||
for (delay = 0; delay < 1000000; delay++);
|
||||
}
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures.
|
||||
* The first available real memory address is in "firstaddr".
|
||||
* The first available kernel virtual address is in "v".
|
||||
* As pages of kernel virtual memory are allocated, "v" is incremented.
|
||||
* As pages of memory are allocated and cleared,
|
||||
* "firstaddr" is incremented.
|
||||
* An index into the kernel page table corresponding to the
|
||||
* virtual memory address maintained in "v" is kept in "mapaddr".
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
/*
|
||||
* Make two passes. The first pass calculates how much memory is
|
||||
* needed and allocates it. The second pass assigns virtual
|
||||
* addresses to the various data structures.
|
||||
*/
|
||||
firstaddr = 0;
|
||||
again:
|
||||
v = (caddr_t)firstaddr;
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
(name) = (type *)v; v = (caddr_t)((name)+(num))
|
||||
#define valloclim(name, type, num, lim) \
|
||||
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
/*
|
||||
* Determine the number of pages to use for the buffer cache
|
||||
* (minimum 16). Allocate 3/4 as many swap buffer headers as
|
||||
* file I/O buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
if (bufcache == 0) { /* use old algorithm */
|
||||
/*
|
||||
* Determine how many buffers to allocate. We use 10%
|
||||
* of the first 2MB of memory, and 5% of the rest.
|
||||
*/
|
||||
if (physmem < btoc(2 * 1024 * 1024))
|
||||
bufpages = physmem / (10 * CLSIZE);
|
||||
else
|
||||
bufpages = (btoc(2 * 1024 * 1024) + physmem) /
|
||||
(20 * CLSIZE);
|
||||
} else {
|
||||
/*
|
||||
* Set size of buffer cache to physmem/bufcache * 100
|
||||
* (i.e., bufcache % of physmem).
|
||||
*/
|
||||
if (bufcache < 5 || bufcache > 95) {
|
||||
printf("warning: unable to set bufcache "
|
||||
"to %d%% of RAM, using 10%%", bufcache);
|
||||
bufcache = 10;
|
||||
}
|
||||
bufpages = physmem / (CLSIZE * 100) * bufcache;
|
||||
}
|
||||
}
|
||||
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf * 3 / 4) & ~1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
|
||||
/*
|
||||
* End of first pass, size has been calculated so allocate memory
|
||||
*/
|
||||
if (firstaddr == 0) {
|
||||
size = (vsize_t)(v - firstaddr);
|
||||
firstaddr = (caddr_t)uvm_km_alloc(kernel_map, round_page(size));
|
||||
if (firstaddr == 0)
|
||||
panic("startup: no room for tables");
|
||||
goto again;
|
||||
}
|
||||
/*
|
||||
* End of second pass, addresses have been assigned
|
||||
*/
|
||||
if ((vsize_t)(v - firstaddr) != size)
|
||||
size = (vm_size_t)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(size))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v, NULL) - v != size)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -568,9 +450,10 @@ again:
|
|||
for (i = 1; i < ncallout; i++)
|
||||
callout[i - 1].c_next = &callout[i];
|
||||
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up CPU-specific registers, cache, etc.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.45 1999/05/13 23:37:19 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.46 1999/05/20 08:21:45 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -31,7 +31,6 @@
|
|||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_inet.h"
|
||||
|
@ -40,7 +39,6 @@
|
|||
#include "opt_iso.h"
|
||||
#include "opt_ns.h"
|
||||
#include "opt_natm.h"
|
||||
#include "opt_sysv.h"
|
||||
#include "adb.h"
|
||||
#include "ipkdb.h"
|
||||
|
||||
|
@ -59,15 +57,6 @@
|
|||
#include <sys/syslog.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/user.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
|
@ -90,6 +79,9 @@
|
|||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
|
||||
|
@ -125,26 +117,6 @@ void ofkbd_cnpollc __P((dev_t, int));
|
|||
|
||||
int msgbufmapped = 0;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
#ifdef BUFCACHE
|
||||
int bufcache = BUFCACHE;
|
||||
#else
|
||||
int bufcache = 0;
|
||||
#endif
|
||||
|
||||
caddr_t allocsys __P((caddr_t));
|
||||
void install_extint __P((void (*)(void)));
|
||||
|
||||
int cold = 1;
|
||||
|
@ -496,6 +468,7 @@ cpu_startup()
|
|||
caddr_t v;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
int base, residual;
|
||||
char pbuf[9];
|
||||
|
||||
initmsgbuf((caddr_t)msgbuf_paddr, round_page(MSGBUFSIZE));
|
||||
|
||||
|
@ -505,16 +478,17 @@ cpu_startup()
|
|||
printf("%s", version);
|
||||
identifycpu();
|
||||
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
sz = (int)allocsys((caddr_t)0);
|
||||
sz = (int)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(sz))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v) - v != sz)
|
||||
if (allocsys(v, NULL) - v != sz)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -583,9 +557,10 @@ cpu_startup()
|
|||
for (i = 1; i < ncallout; i++)
|
||||
callout[i - 1].c_next = &callout[i];
|
||||
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up the buffers.
|
||||
|
@ -593,69 +568,6 @@ cpu_startup()
|
|||
bufinit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures.
|
||||
*/
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
caddr_t v;
|
||||
{
|
||||
#define valloc(name, type, num) \
|
||||
v = (caddr_t)(((name) = (type *)v) + (num))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine the number of pages to use for the buffer cache
|
||||
* (minimum 16). Allocate 1/2 as many swap buffer headers as
|
||||
* file I/O buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
if (bufcache == 0) { /* use old algorithm */
|
||||
bufpages = (physmem / 20) / CLSIZE;
|
||||
} else {
|
||||
/*
|
||||
* Set size of buffer cache to physmem/bufcache * 100
|
||||
* (i.e., bufcache % of physmem).
|
||||
*/
|
||||
if (bufcache < 5 || bufcache > 95) {
|
||||
printf("warning: unable to set bufcache "
|
||||
"to %d%% of RAM, using 10%%", bufcache);
|
||||
bufcache = 10;
|
||||
}
|
||||
bufpages = physmem / (CLSIZE * 100) * bufcache;
|
||||
}
|
||||
}
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) & ~1;
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256;
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
|
||||
return v;
|
||||
#undef valloc
|
||||
}
|
||||
|
||||
/*
|
||||
* consinit
|
||||
* Initialize system console.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpu.h,v 1.30 1999/05/18 01:36:51 nisimura Exp $ */
|
||||
/* $NetBSD: cpu.h,v 1.31 1999/05/20 08:21:48 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -180,7 +180,6 @@ void child_return __P((void *));
|
|||
int kdbpeek __P((vaddr_t));
|
||||
|
||||
/* mips_machdep.c */
|
||||
caddr_t allocsys __P((caddr_t));
|
||||
void dumpsys __P((void));
|
||||
int savectx __P((struct user *));
|
||||
void mips_init_msgbuf __P((void));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mips_machdep.c,v 1.52 1999/05/18 01:36:52 nisimura Exp $ */
|
||||
/* $NetBSD: mips_machdep.c,v 1.53 1999/05/20 08:21:45 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -52,12 +52,10 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.52 1999/05/18 01:36:52 nisimura Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.53 1999/05/20 08:21:45 lukem Exp $");
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_compat_ultrix.h"
|
||||
#include "opt_sysv.h"
|
||||
#include "opt_cputype.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -78,15 +76,6 @@ __KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.52 1999/05/18 01:36:52 nisimura E
|
|||
#include <sys/core.h>
|
||||
#include <sys/kcore.h>
|
||||
#include <machine/kcore.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
|
@ -118,24 +107,6 @@ mips_locore_jumpvec_t mips_locore_jumpvec = {
|
|||
NULL, NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
#ifndef NBUF
|
||||
#define NBUF 0
|
||||
#endif
|
||||
#ifndef BUFPAGES
|
||||
#define BUFPAGES 0
|
||||
#endif
|
||||
#ifndef BUFCACHE
|
||||
#define BUFCACHE 10
|
||||
#endif
|
||||
|
||||
int nswbuf = 0;
|
||||
int nbuf = NBUF;
|
||||
int bufpages = BUFPAGES; /* optional hardwired count */
|
||||
int bufcache = BUFCACHE; /* % of RAM to use for buffer cache */
|
||||
|
||||
int cpu_mhz;
|
||||
int mips_num_tlb_entries;
|
||||
|
||||
|
@ -1131,64 +1102,6 @@ dumpsys()
|
|||
delay(5000000); /* 5 seconds */
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures. We are given
|
||||
* a starting virtual address and we return a final virtual
|
||||
* address; along the way, we set each data structure pointer.
|
||||
*
|
||||
* We call allocsys() with 0 to find out how much space we want,
|
||||
* allocate that much and fill it with zeroes, and the call
|
||||
* allocsys() again with the correct base virtual address.
|
||||
*/
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
caddr_t v;
|
||||
{
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
(name) = (type *)v; v = (caddr_t)ALIGN((name)+(num))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine how many buffers to allocate.
|
||||
* We allocate bufcache % of memory for buffer space. Ensure a
|
||||
* minimum of 16 buffers. We allocate 1/2 as many swap buffer
|
||||
* headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0)
|
||||
bufpages = physmem / CLSIZE * bufcache / 100;
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
|
||||
return (v);
|
||||
#undef valloc
|
||||
}
|
||||
|
||||
void
|
||||
mips_init_msgbuf()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.55 1999/04/26 22:46:47 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.56 1999/05/20 08:21:45 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -42,10 +42,8 @@
|
|||
* @(#)machdep.c 8.10 (Berkeley) 4/20/94
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_compat_hpux.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -71,15 +69,6 @@
|
|||
#include <sys/kcore.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/syscallargs.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
|
@ -115,20 +104,6 @@ vm_map_t phys_map = NULL;
|
|||
*/
|
||||
struct mvmeprom_brdid boardid;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
caddr_t msgbufaddr; /* KVA of message buffer */
|
||||
paddr_t msgbufpa; /* PA of message buffer */
|
||||
|
||||
|
@ -151,7 +126,6 @@ extern struct emul emul_hpux;
|
|||
#endif
|
||||
|
||||
/* prototypes for local functions */
|
||||
caddr_t allocsys __P((caddr_t));
|
||||
void identifycpu __P((void));
|
||||
void initcpu __P((void));
|
||||
void dumpsys __P((void));
|
||||
|
@ -381,6 +355,7 @@ cpu_startup()
|
|||
u_quad_t vmememsize;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
char pbuf[9];
|
||||
#ifdef DEBUG
|
||||
extern int pmapdebug;
|
||||
int opmapdebug = pmapdebug;
|
||||
|
@ -398,7 +373,8 @@ cpu_startup()
|
|||
*/
|
||||
printf(version);
|
||||
identifycpu();
|
||||
printf("real mem = %d", ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
for (vmememsize = 0, i = 1; i < mem_cluster_cnt; i++)
|
||||
vmememsize += mem_clusters[i].size;
|
||||
|
@ -412,11 +388,11 @@ cpu_startup()
|
|||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
size = (vsize_t)allocsys((caddr_t)0);
|
||||
size = (vsize_t)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(size))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if ((allocsys(v) - v) != size)
|
||||
panic("startup: talbe size inconsistency");
|
||||
if ((allocsys(v, NULL) - v) != size)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
|
||||
/*
|
||||
|
@ -492,9 +468,10 @@ cpu_startup()
|
|||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Tell the VM system that the area before the text segment
|
||||
|
@ -527,63 +504,6 @@ cpu_startup()
|
|||
bufinit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures. We are given
|
||||
* a starting virtual address and we return a final virtual
|
||||
* address; along the way, we set each data structure pointer.
|
||||
*
|
||||
* We call allocsys() with 0 to find out how much space we want,
|
||||
* allocate that much and fill it with zeroes, and the call
|
||||
* allocsys() again with the correct base virtual address.
|
||||
*/
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
caddr_t v;
|
||||
{
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
(name) = (type *)v; v = (caddr_t)((name)+(num))
|
||||
#define valloclim(name, type, num, lim) \
|
||||
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine how many buffers to allocate.
|
||||
* We just allocate a flat 5%. Insure a minimum of 16 buffers.
|
||||
* We allocate 1/2 as many swap buffer headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0)
|
||||
bufpages = physmem / 20 / CLSIZE;
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
return (v);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set registers on exec.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.26 1999/05/18 01:36:52 nisimura Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.27 1999/05/20 08:21:45 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -43,7 +43,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.26 1999/05/18 01:36:52 nisimura Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.27 1999/05/20 08:21:45 lukem Exp $");
|
||||
|
||||
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
|
||||
|
||||
|
@ -283,9 +283,9 @@ mach_init(x_boothowto, x_bootdev, x_bootname, x_maxmem)
|
|||
* memory is directly addressable. We don't have to map these into
|
||||
* virtual address space.
|
||||
*/
|
||||
size = (vsize_t)allocsys(0);
|
||||
size = (vsize_t)allocsys(NULL, NULL);
|
||||
v = (caddr_t)pmap_steal_memory(size, NULL, NULL);
|
||||
if ((allocsys(v) - v) != size)
|
||||
if ((allocsys(v, NULL) - v) != size)
|
||||
panic("mach_init: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -336,6 +336,7 @@ cpu_startup()
|
|||
int base, residual;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
char pbuf[9];
|
||||
#ifdef DEBUG
|
||||
extern int pmapdebug;
|
||||
int opmapdebug = pmapdebug;
|
||||
|
@ -347,7 +348,8 @@ cpu_startup()
|
|||
* Good {morning,afternoon,evening,night}.
|
||||
*/
|
||||
printf(version);
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Allocate virtual address space for file I/O buffers.
|
||||
|
@ -422,9 +424,10 @@ cpu_startup()
|
|||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up buffers, so they can be used to read disk labels.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.22 1999/04/26 22:46:47 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.23 1999/05/20 08:21:45 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -43,10 +43,8 @@
|
|||
* @(#)machdep.c 8.10 (Berkeley) 4/20/94
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_compat_hpux.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -73,15 +71,6 @@
|
|||
#include <sys/kcore.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/syscallargs.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
#ifdef KGDB
|
||||
#include <sys/kgdb.h>
|
||||
#endif
|
||||
|
@ -134,20 +123,6 @@ vm_map_t exec_map = NULL;
|
|||
vm_map_t mb_map = NULL;
|
||||
vm_map_t phys_map = NULL;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
caddr_t msgbufaddr; /* KVA of message buffer */
|
||||
paddr_t msgbufpa; /* PA of message buffer */
|
||||
|
||||
|
@ -168,7 +143,6 @@ extern struct emul emul_hpux;
|
|||
#endif
|
||||
|
||||
/* prototypes for local functions */
|
||||
caddr_t allocsys __P((caddr_t));
|
||||
void identifycpu __P((void));
|
||||
void initcpu __P((void));
|
||||
void dumpsys __P((void));
|
||||
|
@ -329,6 +303,7 @@ cpu_startup()
|
|||
int base, residual;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
char pbuf[9];
|
||||
#ifdef DEBUG
|
||||
extern int pmapdebug;
|
||||
int opmapdebug = pmapdebug;
|
||||
|
@ -346,19 +321,18 @@ cpu_startup()
|
|||
*/
|
||||
printf(version);
|
||||
identifycpu();
|
||||
printf("real mem = %d", ctob(physmem));
|
||||
|
||||
printf("\n");
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
size = (vsize_t)allocsys((caddr_t)0);
|
||||
size = (vsize_t)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(size))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if ((allocsys(v) - v) != size)
|
||||
panic("startup: talbe size inconsistency");
|
||||
if ((allocsys(v, NULL) - v) != size)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
|
||||
/*
|
||||
|
@ -434,9 +408,10 @@ cpu_startup()
|
|||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Tell the VM system that the area before the text segment
|
||||
|
@ -469,63 +444,6 @@ cpu_startup()
|
|||
bufinit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures. We are given
|
||||
* a starting virtual address and we return a final virtual
|
||||
* address; along the way, we set each data structure pointer.
|
||||
*
|
||||
* We call allocsys() with 0 to find out how much space we want,
|
||||
* allocate that much and fill it with zeroes, and the call
|
||||
* allocsys() again with the correct base virtual address.
|
||||
*/
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
caddr_t v;
|
||||
{
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
(name) = (type *)v; v = (caddr_t)((name)+(num))
|
||||
#define valloclim(name, type, num, lim) \
|
||||
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine how many buffers to allocate.
|
||||
* We just allocate a flat 5%. Insure a minimum of 16 buffers.
|
||||
* We allocate 1/2 as many swap buffer headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0)
|
||||
bufpages = physmem / 20 / CLSIZE;
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
return (v);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set registers on exec.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.39 1999/05/05 00:03:10 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.40 1999/05/20 08:21:46 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -37,7 +37,6 @@
|
|||
#include "opt_ccitt.h"
|
||||
#include "opt_iso.h"
|
||||
#include "opt_ns.h"
|
||||
#include "opt_sysv.h"
|
||||
#include "ipkdb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -90,8 +89,6 @@ char *bootpath;
|
|||
paddr_t msgbuf_paddr;
|
||||
vaddr_t msgbuf_vaddr;
|
||||
|
||||
caddr_t allocsys __P((caddr_t));
|
||||
|
||||
static int fake_spl __P((void));
|
||||
static int fake_splx __P((int));
|
||||
static void fake_setsoft __P((void));
|
||||
|
@ -373,6 +370,7 @@ cpu_startup()
|
|||
caddr_t v;
|
||||
paddr_t minaddr, maxaddr;
|
||||
int base, residual;
|
||||
char pbuf[9];
|
||||
|
||||
proc0.p_addr = proc0paddr;
|
||||
v = (caddr_t)proc0paddr + USPACE;
|
||||
|
@ -391,16 +389,17 @@ cpu_startup()
|
|||
printf("%s", version);
|
||||
identifycpu();
|
||||
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
sz = (int)allocsys((caddr_t)0);
|
||||
sz = (int)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(sz))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v) - v != sz)
|
||||
if (allocsys(v, NULL) - v != sz)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -474,9 +473,10 @@ cpu_startup()
|
|||
for (i = 1; i < ncallout; i++)
|
||||
callout[i - 1].c_next = &callout[i];
|
||||
|
||||
printf("avail memory = %d\n", ptoa(uvmexp.free));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up the buffers.
|
||||
|
@ -504,52 +504,6 @@ cpu_startup()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures.
|
||||
*/
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
caddr_t v;
|
||||
{
|
||||
#define valloc(name, type, num) \
|
||||
v = (caddr_t)(((name) = (type *)v) + (num))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof (int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Decide on buffer space to use.
|
||||
*/
|
||||
if (bufpages == 0)
|
||||
bufpages = (physmem / 20) / CLSIZE;
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) & ~1;
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256;
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
|
||||
return (v);
|
||||
}
|
||||
|
||||
/*
|
||||
* consinit
|
||||
* Initialize system console.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.99 1999/04/26 22:46:47 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.100 1999/05/20 08:21:46 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 Matthias Pfaller.
|
||||
|
@ -42,7 +42,6 @@
|
|||
* @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_inet.h"
|
||||
#include "opt_atalk.h"
|
||||
|
@ -52,7 +51,6 @@
|
|||
#include "opt_natm.h"
|
||||
#include "opt_pmap_new.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -76,15 +74,6 @@
|
|||
#include <sys/syscallargs.h>
|
||||
#include <sys/core.h>
|
||||
#include <sys/kcore.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
|
@ -163,26 +152,6 @@ char cpu_model[] = "ns32532";
|
|||
|
||||
struct user *proc0paddr;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
#ifdef BUFCACHE
|
||||
int bufcache = BUFCACHE; /* % of RAM to use for buffer cache */
|
||||
#else
|
||||
int bufcache = 0; /* fallback to old algorithm */
|
||||
#endif
|
||||
|
||||
int maxphysmem = 0;
|
||||
int physmem;
|
||||
int boothowto;
|
||||
|
@ -203,7 +172,6 @@ extern int nkpde;
|
|||
extern int ieee_handler_disable;
|
||||
|
||||
static paddr_t alloc_pages __P((int));
|
||||
static caddr_t allocsys __P((caddr_t));
|
||||
static int cpu_dump __P((void));
|
||||
static int cpu_dumpsize __P((void));
|
||||
static void cpu_reset __P((void));
|
||||
|
@ -224,6 +192,7 @@ cpu_startup()
|
|||
int base, residual;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
char pbuf[9];
|
||||
|
||||
/*
|
||||
* Initialize error message buffer (at end of core).
|
||||
|
@ -247,16 +216,17 @@ cpu_startup()
|
|||
initmsgbuf((caddr_t)msgbuf_vaddr, round_page(MSGBUFSIZE));
|
||||
|
||||
printf(version);
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
sz = (int)allocsys((caddr_t)0);
|
||||
sz = (int)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(sz))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v) - v != sz)
|
||||
if (allocsys(v, NULL) - v != sz)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -343,9 +313,10 @@ cpu_startup()
|
|||
for (i = 1; i < ncallout; i++)
|
||||
callout[i-1].c_next = &callout[i];
|
||||
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up buffers, so they can be used to read disk labels.
|
||||
|
@ -353,93 +324,6 @@ cpu_startup()
|
|||
bufinit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures. We are given
|
||||
* a starting virtual address and we return a final virtual
|
||||
* address; along the way we set each data structure pointer.
|
||||
*
|
||||
* We call allocsys() with 0 to find out how much space we want,
|
||||
* allocate that much and fill it with zeroes, and then call
|
||||
* allocsys() again with the correct base virtual address.
|
||||
*/
|
||||
static caddr_t
|
||||
allocsys(v)
|
||||
register caddr_t v;
|
||||
{
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
v = (caddr_t)(((name) = (type *)v) + (num))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If necessary, determine the number of pages to use for the
|
||||
* buffer cache. We allocate 1/2 as many swap buffer headers
|
||||
* as file I/O buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
if (bufcache == 0) { /* use old algorithm */
|
||||
/*
|
||||
* Determine how many buffers to allocate. We use 10%
|
||||
* of the first 2MB of memory, and 5% of the rest, with
|
||||
* a minimum of 16 buffers.
|
||||
*/
|
||||
if (physmem < btoc(2 * 1024 * 1024))
|
||||
bufpages = physmem / (10 * CLSIZE);
|
||||
else
|
||||
bufpages = (btoc(2 * 1024 * 1024) + physmem) /
|
||||
(20 * CLSIZE);
|
||||
} else {
|
||||
/*
|
||||
* Set size of buffer cache to physmem/bufcache * 100
|
||||
* (i.e., bufcache % of physmem).
|
||||
*/
|
||||
if (bufcache < 5 || bufcache > 95) {
|
||||
printf(
|
||||
"warning: unable to set bufcache to %d%% of RAM, using 10%%",
|
||||
bufcache);
|
||||
bufcache = 10;
|
||||
}
|
||||
bufpages= physmem / (CLSIZE * 100) * bufcache;
|
||||
}
|
||||
}
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX stopgap measure to prevent wasting too much KVM on
|
||||
* the sparsely filled buffer cache.
|
||||
*/
|
||||
if (nbuf * MAXBSIZE > VM_MAX_KERNEL_BUF)
|
||||
nbuf = VM_MAX_KERNEL_BUF / MAXBSIZE;
|
||||
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
return v;
|
||||
}
|
||||
|
||||
/*
|
||||
* machine dependent system variables.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.22 1999/04/01 00:17:48 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.23 1999/05/20 08:21:46 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -442,9 +442,9 @@ mach_init(argc, argv, code)
|
|||
* memory is directly addressable. We don't have to map these into
|
||||
* virtual address space.
|
||||
*/
|
||||
size = (vm_size_t)allocsys(0);
|
||||
size = (vm_size_t)allocsys(NULL, NULL);
|
||||
v = (caddr_t)pmap_steal_memory(size, NULL, NULL);
|
||||
if ((allocsys(v) - v) != size)
|
||||
if ((allocsys(v, NULL) - v) != size)
|
||||
panic("mach_init: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -480,6 +480,7 @@ cpu_startup()
|
|||
int base, residual;
|
||||
vm_offset_t minaddr, maxaddr;
|
||||
vm_size_t size;
|
||||
char pbuf[9];
|
||||
#ifdef DEBUG
|
||||
extern int pmapdebug;
|
||||
int opmapdebug = pmapdebug;
|
||||
|
@ -491,7 +492,8 @@ cpu_startup()
|
|||
* Good {morning,afternoon,evening,night}.
|
||||
*/
|
||||
printf(version);
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Allocate virtual address space for file I/O buffers.
|
||||
|
@ -551,9 +553,11 @@ cpu_startup()
|
|||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
printf("avail mem = %ld\n", ptoa(cnt.v_free_count));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up CPU-specific registers, cache, etc.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.142 1999/05/18 01:36:51 nisimura Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.143 1999/05/20 08:21:46 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -43,7 +43,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.142 1999/05/18 01:36:51 nisimura Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.143 1999/05/20 08:21:46 lukem Exp $");
|
||||
|
||||
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
|
||||
|
||||
|
@ -458,9 +458,9 @@ mach_init(argc, argv, code, cv, bim, bip)
|
|||
* memory is directly addressable. We don't have to map these into
|
||||
* virtual address space.
|
||||
*/
|
||||
size = (unsigned)allocsys(0);
|
||||
size = (unsigned)allocsys(NULL, NULL);
|
||||
v = (caddr_t)pmap_steal_memory(size, NULL, NULL);
|
||||
if ((allocsys(v) - v) != size)
|
||||
if ((allocsys(v, NULL) - v) != size)
|
||||
panic("mach_init: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -481,6 +481,7 @@ cpu_startup()
|
|||
int base, residual;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
char pbuf[9];
|
||||
#ifdef DEBUG
|
||||
extern int pmapdebug;
|
||||
int opmapdebug = pmapdebug;
|
||||
|
@ -493,7 +494,8 @@ cpu_startup()
|
|||
*/
|
||||
printf(version);
|
||||
printf("%s\n", cpu_model);
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Allocate virtual address space for file I/O buffers.
|
||||
|
@ -575,9 +577,10 @@ cpu_startup()
|
|||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up buffers, so they can be used to read disk labels.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.146 1999/05/03 16:17:57 christos Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.147 1999/05/20 08:21:46 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -81,10 +81,8 @@
|
|||
* @(#)machdep.c 8.6 (Berkeley) 1/14/94
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_compat_sunos.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/signal.h>
|
||||
|
@ -107,15 +105,6 @@
|
|||
#include <sys/msgbuf.h>
|
||||
#include <sys/syscallargs.h>
|
||||
#include <sys/exec.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
|
@ -150,21 +139,6 @@ vm_map_t exec_map = NULL;
|
|||
vm_map_t mb_map = NULL;
|
||||
extern paddr_t avail_end;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
|
||||
int physmem;
|
||||
|
||||
/*
|
||||
|
@ -179,7 +153,6 @@ int safepri = 0;
|
|||
*/
|
||||
struct extent *dvmamap24;
|
||||
|
||||
caddr_t allocsys __P((caddr_t));
|
||||
void dumpsys __P((void));
|
||||
void stackdump __P((void));
|
||||
|
||||
|
@ -190,8 +163,7 @@ void
|
|||
cpu_startup()
|
||||
{
|
||||
unsigned i;
|
||||
caddr_t v;
|
||||
int sz;
|
||||
caddr_t v, sz;
|
||||
int base, residual;
|
||||
#ifdef DEBUG
|
||||
extern int pmapdebug;
|
||||
|
@ -199,6 +171,7 @@ cpu_startup()
|
|||
#endif
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
char pbuf[9];
|
||||
|
||||
#ifdef DEBUG
|
||||
pmapdebug = 0;
|
||||
|
@ -223,20 +196,24 @@ cpu_startup()
|
|||
*/
|
||||
printf(version);
|
||||
/*identifycpu();*/
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
sz = (int)allocsys((caddr_t)0);
|
||||
sz = allocsys(NULL, NULL);
|
||||
|
||||
if ((v = (caddr_t)uvm_km_alloc(kernel_map, round_page(sz))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
|
||||
if (allocsys(v) - v != sz)
|
||||
if (allocsys(v, NULL) - v != sz)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
if (CPU_ISSUN4C && bufpages > (128 * (65536/MAXBSIZE)))
|
||||
bufpages = (128 * (65536/MAXBSIZE));
|
||||
|
||||
/*
|
||||
* allocate virtual and physical memory for the buffers.
|
||||
*/
|
||||
|
@ -320,9 +297,10 @@ cpu_startup()
|
|||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up buffers, so they can be used to read disk labels.
|
||||
|
@ -332,73 +310,6 @@ cpu_startup()
|
|||
pmap_redzone();
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures. We are given
|
||||
* a starting virtual address and we return a final virtual
|
||||
* address; along the way we set each data structure pointer.
|
||||
*
|
||||
* You call allocsys() with 0 to find out how much space we want,
|
||||
* allocate that much and fill it with zeroes, and then call
|
||||
* allocsys() again with the correct base virtual address.
|
||||
*/
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
caddr_t v;
|
||||
{
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
v = (caddr_t)(((name) = (type *)v) + (num))
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine how many buffers to allocate (enough to
|
||||
* hold 5% of total physical memory, but at least 16 and at
|
||||
* most 1/2 of available kernel virtual memory).
|
||||
* Allocate 1/2 as many swap buffer headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
int bmax = btoc(VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
|
||||
(MAXBSIZE/NBPG) / 2;
|
||||
bufpages = (physmem / 20) / CLSIZE;
|
||||
if (nbuf == 0 && bufpages > bmax)
|
||||
bufpages = bmax;
|
||||
/*
|
||||
* XXX stopgap measure to prevent wasting too much KVM on
|
||||
* the sparsely filled buffer cache.
|
||||
*/
|
||||
if (CPU_ISSUN4C && bufpages > (128 * (65536/MAXBSIZE)))
|
||||
bufpages = (128 * (65536/MAXBSIZE));
|
||||
}
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
return (v);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up registers on exec.
|
||||
*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.38 1999/04/26 22:46:48 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.39 1999/05/20 08:21:47 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -81,10 +81,8 @@
|
|||
* @(#)machdep.c 8.6 (Berkeley) 1/14/94
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_compat_sunos.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/signal.h>
|
||||
|
@ -106,15 +104,6 @@
|
|||
#include <sys/msgbuf.h>
|
||||
#include <sys/syscallargs.h>
|
||||
#include <sys/exec.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
|
@ -144,21 +133,6 @@ vm_map_t mb_map = NULL;
|
|||
vm_map_t phys_map = NULL;
|
||||
extern vaddr_t avail_end;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
|
||||
int physmem;
|
||||
|
||||
extern caddr_t msgbufaddr;
|
||||
|
@ -177,8 +151,8 @@ vaddr_t dvma_base, dvma_end;
|
|||
struct map *dvmamap;
|
||||
static int ndvmamap; /* # of entries in dvmamap */
|
||||
|
||||
caddr_t allocsys __P((caddr_t));
|
||||
void dumpsys __P((void));
|
||||
caddr_t mdallocsys __P((caddr_t));
|
||||
void stackdump __P((void));
|
||||
|
||||
/*
|
||||
|
@ -198,6 +172,7 @@ cpu_startup()
|
|||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
extern struct user *proc0paddr;
|
||||
char pbuf[9];
|
||||
|
||||
#ifdef DEBUG
|
||||
pmapdebug = 0;
|
||||
|
@ -210,17 +185,18 @@ cpu_startup()
|
|||
*/
|
||||
printf(version);
|
||||
/*identifycpu();*/
|
||||
printf("real mem = %ld\n", (long)ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
sz = (long)allocsys((caddr_t)0);
|
||||
sz = (long)allocsys(NULL, mdallocsys);
|
||||
|
||||
if ((v = (caddr_t)uvm_km_alloc(kernel_map, round_page(sz))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v) - v != sz)
|
||||
if (allocsys(v, mdallocsys) - v != sz)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -313,9 +289,10 @@ cpu_startup()
|
|||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
printf("using %ld buffers containing %ld bytes of memory\n",
|
||||
(long)nbuf, (long)bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up buffers, so they can be used to read disk labels.
|
||||
|
@ -327,70 +304,17 @@ cpu_startup()
|
|||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures. We are given
|
||||
* a starting virtual address and we return a final virtual
|
||||
* address; along the way we set each data structure pointer.
|
||||
*
|
||||
* You call allocsys() with 0 to find out how much space we want,
|
||||
* allocate that much and fill it with zeroes, and then call
|
||||
* allocsys() again with the correct base virtual address.
|
||||
*/
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
register caddr_t v;
|
||||
mdallocsys(v)
|
||||
caddr_t v;
|
||||
{
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
v = (caddr_t)(((name) = (type *)v) + (num))
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine how many buffers to allocate (enough to
|
||||
* hold 5% of total physical memory, but at least 16 and at
|
||||
* most 1/2 of available kernel virtual memory).
|
||||
* Allocate 1/2 as many swap buffer headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
int bmax = btoc(VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
|
||||
(MAXBSIZE/NBPG) / 2;
|
||||
bufpages = (physmem / 20) / CLSIZE;
|
||||
if (nbuf == 0 && bufpages > bmax)
|
||||
bufpages = bmax;
|
||||
}
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
/*
|
||||
* Allocate DVMA slots for 1/4 of the number of i/o buffers
|
||||
* Allocate DVMA slots for 1/4 of the number of I/O buffers
|
||||
* and one for each process too (PHYSIO).
|
||||
*/
|
||||
valloc(dvmamap, struct map, ndvmamap = maxproc + ((nbuf / 4) &~ 1));
|
||||
return (v);
|
||||
ndvmamap = maxproc + ((nbuf / 4) &~ 1);
|
||||
ALLOCSYS(v, dvmamap, struct map, ndvmamap);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.129 1999/04/26 22:46:48 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.130 1999/05/20 08:21:47 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Gordon W. Ross
|
||||
|
@ -43,9 +43,7 @@
|
|||
* from: @(#)machdep.c 8.10 (Berkeley) 4/20/94
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -71,15 +69,6 @@
|
|||
#include <sys/kcore.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/syscallargs.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
#ifdef KGDB
|
||||
#include <sys/kgdb.h>
|
||||
#endif
|
||||
|
@ -133,21 +122,6 @@ vm_offset_t vmmap;
|
|||
*/
|
||||
int safepri = PSL_LOWIPL;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
|
||||
/* Our private scratch page for dumping the MMU. */
|
||||
static vm_offset_t dumppage;
|
||||
|
||||
|
@ -196,69 +170,6 @@ consinit()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* allocsys() - Private routine used by cpu_startup() below.
|
||||
*
|
||||
* Allocate space for system data structures. We are given
|
||||
* a starting virtual address and we return a final virtual
|
||||
* address; along the way we set each data structure pointer.
|
||||
*
|
||||
* We call allocsys() with 0 to find out how much space we want,
|
||||
* allocate that much and fill it with zeroes, and then call
|
||||
* allocsys() again with the correct base virtual address.
|
||||
*/
|
||||
#define valloc(name, type, num) \
|
||||
v = (caddr_t)(((name) = (type *)v) + (num))
|
||||
static caddr_t allocsys __P((caddr_t));
|
||||
|
||||
static caddr_t
|
||||
allocsys(v)
|
||||
register caddr_t v;
|
||||
{
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine how many buffers to allocate. We allocate
|
||||
* the BSD standard of use 10% of memory for the first 2 Meg,
|
||||
* 5% of remaining. Insure a minimum of 16 buffers.
|
||||
* Allocate 1/2 as many swap buffer headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
/* We always have more than 2MB of memory. */
|
||||
bufpages = ((btoc(2 * 1024 * 1024) + physmem) /
|
||||
(20 * CLSIZE));
|
||||
}
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
return v;
|
||||
}
|
||||
#undef valloc
|
||||
|
||||
/*
|
||||
* cpu_startup: allocate memory for variable-sized tables,
|
||||
* initialize cpu, and do autoconfiguration.
|
||||
|
@ -275,6 +186,7 @@ cpu_startup()
|
|||
vm_size_t size;
|
||||
int base, residual;
|
||||
vm_offset_t minaddr, maxaddr;
|
||||
char pbuf[9];
|
||||
|
||||
/*
|
||||
* Initialize message buffer (for kernel printf).
|
||||
|
@ -294,8 +206,8 @@ cpu_startup()
|
|||
identifycpu();
|
||||
initfpu(); /* also prints FPU type */
|
||||
|
||||
size = ptoa(physmem);
|
||||
printf("real mem = %ldK (0x%lx)\n", (size >> 10), size);
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Get scratch page for dumpsys().
|
||||
|
@ -307,10 +219,10 @@ cpu_startup()
|
|||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
sz = (int)allocsys((caddr_t)0);
|
||||
sz = (int)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_alloc(kernel_map, round_page(sz))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v) - v != sz)
|
||||
if (allocsys(v, NULL) - v != sz)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -389,10 +301,10 @@ cpu_startup()
|
|||
callout[i-1].c_next = &callout[i];
|
||||
callout[i-1].c_next = NULL;
|
||||
|
||||
size = ptoa(uvmexp.free);
|
||||
printf("avail mem = %ldK (0x%lx)\n", (size >> 10), size);
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Tell the VM system that writing to kernel text isn't allowed.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.49 1999/04/26 22:46:48 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.50 1999/05/20 08:21:47 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -41,9 +41,7 @@
|
|||
* from: @(#)machdep.c 8.10 (Berkeley) 4/20/94
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -69,15 +67,6 @@
|
|||
#include <sys/kcore.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/syscallargs.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
#ifdef KGDB
|
||||
#include <sys/kgdb.h>
|
||||
#endif
|
||||
|
@ -131,21 +120,6 @@ vm_offset_t vmmap;
|
|||
*/
|
||||
int safepri = PSL_LOWIPL;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
|
||||
u_char cpu_machine_id = 0;
|
||||
char *cpu_string = NULL;
|
||||
int cpu_has_vme = 0;
|
||||
|
@ -197,69 +171,6 @@ consinit()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* allocsys() - Private routine used by cpu_startup() below.
|
||||
*
|
||||
* Allocate space for system data structures. We are given
|
||||
* a starting virtual address and we return a final virtual
|
||||
* address; along the way we set each data structure pointer.
|
||||
*
|
||||
* We call allocsys() with 0 to find out how much space we want,
|
||||
* allocate that much and fill it with zeroes, and then call
|
||||
* allocsys() again with the correct base virtual address.
|
||||
*/
|
||||
#define valloc(name, type, num) \
|
||||
v = (caddr_t)(((name) = (type *)v) + (num))
|
||||
static caddr_t allocsys __P((caddr_t));
|
||||
|
||||
static caddr_t
|
||||
allocsys(v)
|
||||
register caddr_t v;
|
||||
{
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine how many buffers to allocate. We allocate
|
||||
* the BSD standard of use 10% of memory for the first 2 Meg,
|
||||
* 5% of remaining. Insure a minimum of 16 buffers.
|
||||
* Allocate 1/2 as many swap buffer headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
/* We always have more than 2MB of memory. */
|
||||
bufpages = ((btoc(2 * 1024 * 1024) + physmem) /
|
||||
(20 * CLSIZE));
|
||||
}
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
return v;
|
||||
}
|
||||
#undef valloc
|
||||
|
||||
/*
|
||||
* cpu_startup: allocate memory for variable-sized tables,
|
||||
* initialize cpu, and do autoconfiguration.
|
||||
|
@ -276,6 +187,7 @@ cpu_startup()
|
|||
vm_size_t size;
|
||||
int base, residual;
|
||||
vm_offset_t minaddr, maxaddr;
|
||||
char pbuf[9];
|
||||
|
||||
/*
|
||||
* Initialize message buffer (for kernel printf).
|
||||
|
@ -295,17 +207,17 @@ cpu_startup()
|
|||
identifycpu();
|
||||
initfpu(); /* also prints FPU type */
|
||||
|
||||
size = ptoa(physmem);
|
||||
printf("real mem = %ldK (0x%lx)\n", (size >> 10), size);
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
sz = (int)allocsys((caddr_t)0);
|
||||
sz = (int)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_alloc(kernel_map, round_page(sz))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v) - v != sz)
|
||||
if (allocsys(v, NULL) - v != sz)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
|
@ -384,10 +296,10 @@ cpu_startup()
|
|||
callout[i-1].c_next = &callout[i];
|
||||
callout[i-1].c_next = NULL;
|
||||
|
||||
size = ptoa(uvmexp.free);
|
||||
printf("avail mem = %ldK (0x%lx)\n", (size >> 10), size);
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Tell the VM system that writing to kernel text isn't allowed.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.82 1999/05/02 17:28:43 ragge Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.83 1999/05/20 08:21:47 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
|
||||
|
@ -45,14 +45,12 @@
|
|||
* @(#)machdep.c 7.16 (Berkeley) 6/3/91
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_inet.h"
|
||||
#include "opt_atalk.h"
|
||||
#include "opt_ns.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_compat_ultrix.h"
|
||||
#include "opt_sysv.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -75,15 +73,6 @@
|
|||
#include <sys/ptrace.h>
|
||||
#include <vm/vm.h>
|
||||
#include <sys/sysctl.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
|
@ -148,28 +137,6 @@ int dumpsize = 0;
|
|||
#define IOMAPSZ 100
|
||||
static struct map iomap[IOMAPSZ];
|
||||
|
||||
caddr_t allocsys __P((caddr_t));
|
||||
|
||||
#define valloclim(name, type, num, lim) \
|
||||
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
|
||||
|
||||
#ifdef BUFCACHE
|
||||
int bufcache = BUFCACHE; /* % of RAM to use for buffer cache */
|
||||
#else
|
||||
int bufcache = 0; /* fallback to old algorithm */
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
|
||||
vm_map_t exec_map = NULL;
|
||||
vm_map_t mb_map = NULL;
|
||||
vm_map_t phys_map = NULL;
|
||||
|
@ -187,6 +154,7 @@ cpu_startup()
|
|||
vm_offset_t minaddr, maxaddr;
|
||||
vm_size_t size;
|
||||
extern unsigned int avail_end;
|
||||
char pbuf[9];
|
||||
|
||||
/*
|
||||
* Initialize error message buffer.
|
||||
|
@ -202,7 +170,8 @@ cpu_startup()
|
|||
* Good {morning,afternoon,evening,night}.
|
||||
*/
|
||||
printf("%s\n%s\n", version, cpu_model);
|
||||
printf("realmem = %d\n", avail_end);
|
||||
format_bytes(pbuf, sizeof(pbuf), avail_end);
|
||||
printf("total memory = %s\n", pbuf);
|
||||
physmem = btoc(avail_end);
|
||||
panicstr = NULL;
|
||||
mtpr(AST_NO, PR_ASTLVL);
|
||||
|
@ -215,10 +184,10 @@ cpu_startup()
|
|||
* everything true virtual addresses.
|
||||
*/
|
||||
|
||||
sz = (int) allocsys((caddr_t) 0);
|
||||
sz = (int) allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(sz))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v) - v != sz)
|
||||
if (allocsys(v, NULL) - v != sz)
|
||||
panic("startup: table size inconsistency");
|
||||
/*
|
||||
* Now allocate buffers proper. They are different than the above in
|
||||
|
@ -291,9 +260,10 @@ cpu_startup()
|
|||
callout[i - 1].c_next = &callout[i];
|
||||
callout[i - 1].c_next = NULL;
|
||||
|
||||
printf("avail mem = %d\n", (int)ptoa(uvmexp.free));
|
||||
printf("Using %d buffers containing %d bytes of memory.\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up buffers, so they can be used to read disk labels.
|
||||
|
@ -302,75 +272,6 @@ cpu_startup()
|
|||
bufinit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures. We are given a starting
|
||||
* virtual address and we return a final virtual address; along the way we
|
||||
* set each data structure pointer.
|
||||
*
|
||||
* We call allocsys() with 0 to find out how much space we want, allocate that
|
||||
* much and fill it with zeroes, and then call allocsys() again with the
|
||||
* correct base virtual address.
|
||||
*/
|
||||
caddr_t
|
||||
allocsys(v)
|
||||
register caddr_t v;
|
||||
{
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
v = (caddr_t)(((name) = (type *)v) + (num))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine how many buffers to allocate (enough to hold 5% of total
|
||||
* physical memory, but at least 16). Allocate 1/2 as many swap
|
||||
* buffer headers as file i/o buffers.
|
||||
*/
|
||||
if (bufpages == 0) {
|
||||
if (bufcache == 0) {
|
||||
if (physmem < btoc(2 * 1024 * 1024))
|
||||
bufpages = physmem / 10;
|
||||
else
|
||||
bufpages = physmem / 20;
|
||||
} else {
|
||||
if (bufcache < 5 || bufcache > 95) {
|
||||
printf(
|
||||
"warning: unable to set bufcache to %d%% of RAM, using 10%%",
|
||||
bufcache);
|
||||
bufcache = 10;
|
||||
}
|
||||
bufpages = physmem / 100 * bufcache;
|
||||
}
|
||||
}
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) & ~1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
return v;
|
||||
}
|
||||
|
||||
long dumplo = 0;
|
||||
long dumpmag = 0x8fca0101;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.68 1999/05/13 14:23:42 minoura Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.69 1999/05/20 08:21:48 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -42,7 +42,6 @@
|
|||
* @(#)machdep.c 8.10 (Berkeley) 4/20/94
|
||||
*/
|
||||
|
||||
#include "opt_bufcache.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_inet.h"
|
||||
#include "opt_atalk.h"
|
||||
|
@ -54,7 +53,6 @@
|
|||
#include "opt_fpuemulate.h"
|
||||
#include "opt_m060sp.h"
|
||||
#include "opt_panicbutton.h"
|
||||
#include "opt_sysv.h"
|
||||
#include "opt_extmem.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -81,15 +79,6 @@
|
|||
#include <sys/syscallargs.h>
|
||||
#include <sys/core.h>
|
||||
#include <sys/kcore.h>
|
||||
#ifdef SYSVMSG
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#include <machine/db_machdep.h>
|
||||
#include <ddb/db_sym.h>
|
||||
|
@ -135,26 +124,6 @@ vm_map_t phys_map = NULL;
|
|||
extern paddr_t avail_start, avail_end;
|
||||
extern vaddr_t virtual_avail;
|
||||
|
||||
/*
|
||||
* Declare these as initialized data so we can patch them.
|
||||
*/
|
||||
int nswbuf = 0;
|
||||
#ifdef NBUF
|
||||
int nbuf = NBUF;
|
||||
#else
|
||||
int nbuf = 0;
|
||||
#endif
|
||||
#ifdef BUFPAGES
|
||||
int bufpages = BUFPAGES;
|
||||
#else
|
||||
int bufpages = 0;
|
||||
#endif
|
||||
#ifdef BUFCACHE
|
||||
int bufcache = BUFCACHE; /* % of RAM to use for buffer cache */
|
||||
#else
|
||||
int bufcache = 0; /* fallback to old algorithm */
|
||||
#endif
|
||||
|
||||
caddr_t msgbufaddr;
|
||||
int maxmem; /* max memory per process */
|
||||
int physmem = MAXMEM; /* max supported memory, changes to actual */
|
||||
|
@ -257,10 +226,11 @@ void
|
|||
cpu_startup()
|
||||
{
|
||||
unsigned i;
|
||||
caddr_t v, firstaddr;
|
||||
caddr_t v;
|
||||
int base, residual;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
char pbuf[9];
|
||||
#ifdef DEBUG
|
||||
extern int pmapdebug;
|
||||
int opmapdebug = pmapdebug;
|
||||
|
@ -291,109 +261,19 @@ cpu_startup()
|
|||
*/
|
||||
printf(version);
|
||||
identifycpu();
|
||||
printf("real mem = %d\n", ctob(physmem));
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures.
|
||||
* The first available real memory address is in "firstaddr".
|
||||
* The first available kernel virtual address is in "v".
|
||||
* As pages of kernel virtual memory are allocated, "v" is incremented.
|
||||
* As pages of memory are allocated and cleared,
|
||||
* "firstaddr" is incremented.
|
||||
* An index into the kernel page table corresponding to the
|
||||
* virtual memory address maintained in "v" is kept in "mapaddr".
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
/*
|
||||
* Make two passes. The first pass calculates how much memory is
|
||||
* needed and allocates it. The second pass assigns virtual
|
||||
* addresses to the various data structures.
|
||||
*/
|
||||
firstaddr = 0;
|
||||
again:
|
||||
v = (caddr_t)firstaddr;
|
||||
|
||||
#define valloc(name, type, num) \
|
||||
(name) = (type *)v; v = (caddr_t)((name)+(num))
|
||||
#define valloclim(name, type, num, lim) \
|
||||
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
|
||||
|
||||
valloc(callout, struct callout, ncallout);
|
||||
#ifdef SYSVSHM
|
||||
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
valloc(sema, struct semid_ds, seminfo.semmni);
|
||||
valloc(sem, struct sem, seminfo.semmns);
|
||||
/* This is pretty disgusting! */
|
||||
valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
valloc(msgpool, char, msginfo.msgmax);
|
||||
valloc(msgmaps, struct msgmap, msginfo.msgseg);
|
||||
valloc(msghdrs, struct msg, msginfo.msgtql);
|
||||
valloc(msqids, struct msqid_ds, msginfo.msgmni);
|
||||
#endif
|
||||
|
||||
if (bufpages == 0) {
|
||||
if (bufcache == 0) { /* use old algorithm */
|
||||
/*
|
||||
* Determine how many buffers to allocate.
|
||||
* Since an x68k tends to be long on memory and short
|
||||
* on disk speed, we allocate more buffer space than
|
||||
* the BSD standard of use 10% of memory for the first
|
||||
* 2 Meg, 5% of remaining.
|
||||
* We just allocate a flat 10%. Insure a minimum of 16
|
||||
* buffers.
|
||||
* We allocate 1/2 as many swap buffer headers as file
|
||||
* i/o buffers.
|
||||
*/
|
||||
bufpages = physmem / 10 / CLSIZE;
|
||||
if (physmem < btoc(2 * 1024 * 1024))
|
||||
bufpages = physmem / 10 / CLSIZE;
|
||||
else
|
||||
bufpages = (btoc(2 * 1024 * 1024) + physmem) /
|
||||
(20 * CLSIZE);
|
||||
} else {
|
||||
/*
|
||||
* Set size of buffer cache to physmem/bufcache * 100
|
||||
* (i.e., bufcache % of physmem).
|
||||
*/
|
||||
if (bufcache < 5 || bufcache > 95) {
|
||||
printf(
|
||||
"warning: unable to set bufcache to %d%% of RAM, using 10%%",
|
||||
bufcache);
|
||||
bufcache = 10;
|
||||
}
|
||||
bufpages= physmem / (CLSIZE * 100) * bufcache;
|
||||
}
|
||||
}
|
||||
|
||||
if (nbuf == 0) {
|
||||
nbuf = bufpages;
|
||||
if (nbuf < 16)
|
||||
nbuf = 16;
|
||||
}
|
||||
if (nswbuf == 0) {
|
||||
nswbuf = (nbuf / 2) &~ 1; /* force even */
|
||||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
valloc(buf, struct buf, nbuf);
|
||||
/*
|
||||
* End of first pass, size has been calculated so allocate memory
|
||||
*/
|
||||
if (firstaddr == 0) {
|
||||
size = (vsize_t)(v - firstaddr);
|
||||
firstaddr = (caddr_t) uvm_km_zalloc(kernel_map, round_page(size));
|
||||
if (firstaddr == 0)
|
||||
panic("startup: no room for tables");
|
||||
goto again;
|
||||
}
|
||||
/*
|
||||
* End of second pass, addresses have been assigned
|
||||
*/
|
||||
if ((vsize_t)(v - firstaddr) != size)
|
||||
size = (vm_size_t)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(size))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v, NULL) - v != size)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
* Now allocate buffers proper. They are different than the above
|
||||
* in that they usually occupy more virtual memory than physical.
|
||||
|
@ -473,9 +353,11 @@ again:
|
|||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * CLBYTES);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up CPU-specific registers, cache, etc.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue