genassym.c:

Remove NKMEMCLUSTERS, it is no longer define or used.

locores.s:
	Fix comment on PTDpde and APTDpde to be pde instead of pte
	Add new equation for calculating location of Sysmap
	Remove Bill's old #ifdef garbage for counting up memory,
	that stuff will never be made to work and was just cluttering
	up the file.

	Add code that places the PTD, page table pages, and kernel
	stack below the 640k ISA hole if there is room for it, otherwise
	put this stuff all at 1MB.  This fixes the 28K bogusity in
	the boot blocks, that can now go away!

	Fix the caclulation of where first is to be dependent on
	NKPDE so that we can skip over the above mentioned areas.
	The 28K thing is now 44K in size due to the increase in
	kernel virtual memory space, but since we no longer have
	to worry about that this is no big deal.

	Use if NNPX > 0 instead of ifdef NPX for floating point code.

machdep.c
	Change the calculation of for the buffer cache to be
	20% of all memory above 2MB and add back the upper limit
	of 2/5's of the VM_KMEM_SIZE so that we do not eat ALL
	of the kernel memory space on large memory machines, note
	that this will not even come into effect unless you have
	more than 32MB.  The current buffer cache limit is 6.7MB
	due to this caclulation.

	It seems that we where erroniously allocating bufpages pages
	for buffer_map.  buffer_map is UNUSED in this implementation
	of the buffer cache, but since the map is referenced in
	several if statements a quick fix was to simply allocate
	1 vm page (but no real memory) to it.

pmap.h
	Remove rcsid, don't want them in the kernel files!

	Removed some cruft inside an #ifdef DEBUGx that caused
	compiler errors if you where compiling this for debug.

	Use the #defines for PD_SHIFT and PG_SHIFT in place of
	constants.

trap.c:
	Remove patch kit header and rcsid, fix $Id$.
	Now include "npx.h" and use NNPX for controlling the
	floating point code.

	Remove a now completly invalid check for a maximum virtual
	address, the virtual address now ends at 0xFFFFFFFF so
	there is no more MAX!!  (Thanks David, I completly missed
	that one!)

vm_machdep.c
	Remove patch kit header and rcsid, fix $Id$.
	Now include "npx.h" and use NNPX for controlling the
	floating point code.

	Replace several 0xFE00000 constants with KERNBASE
This commit is contained in:
Rodney W. Grimes 1993-10-15 10:34:29 +00:00
parent d42d25c451
commit 960173b9b2
14 changed files with 192 additions and 306 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
* $Id: genassym.c,v 1.3 1993/10/10 02:09:44 rgrimes Exp $
* $Id: genassym.c,v 1.4 1993/10/12 15:33:18 rgrimes Exp $
*/
#include "sys/param.h"
@ -141,7 +141,6 @@ main()
printf("#define\tPCB_LDT %d\n", &pcb->pcb_tss.tss_ldt);
printf("#define\tPCB_USERLDT %d\n", &pcb->pcb_ldt);
printf("#define\tPCB_IOOPT %d\n", &pcb->pcb_tss.tss_ioopt);
printf("#define\tNKMEMCLUSTERS %d\n", NKMEMCLUSTERS);
printf("#define\tU_PROF %d\n", &up->u_stats.p_prof);
printf("#define\tU_PROFSCALE %d\n", &up->u_stats.p_prof.pr_scale);
printf("#define\tPR_BASE %d\n", &uprof->pr_base);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.6 1993/10/10 06:07:57 rgrimes Exp $
* $Id: locore.s,v 1.7 1993/10/13 07:11:11 rgrimes Exp $
*/
@ -121,9 +121,9 @@
.globl _PTmap,_PTD,_PTDpde,_Sysmap
.set _PTmap,PTDPTDI << PDRSHIFT
.set _PTD,_PTmap + (PTDPTDI * NBPG)
.set _PTDpde,_PTD + (PTDPTDI * 4) /* XXX 4=sizeof pte */
.set _PTDpde,_PTD + (PTDPTDI * 4) /* XXX 4=sizeof pde */
.set _Sysmap,0xFDFF8000
.set _Sysmap,_PTmap + (KPTDI * NBPG)
/*
* APTmap, APTD is the alternate recursive pagemap.
@ -132,7 +132,7 @@
.globl _APTmap,_APTD,_APTDpde
.set _APTmap,APTDPTDI << PDRSHIFT
.set _APTD,_APTmap + (APTDPTDI * NBPG)
.set _APTDpde,_PTD + (APTDPTDI * 4) /* XXX 4=sizeof pte */
.set _APTDpde,_PTD + (APTDPTDI * 4) /* XXX 4=sizeof pde */
/*
* Access to each processes kernel stack is via a region of
@ -240,37 +240,6 @@ ENTRY(btext)
*/
movl $tmpstk-KERNBASE,%esp /* bootstrap stack end location */
#ifdef garbage
/* count up memory */
xorl %eax,%eax /* start with base memory at 0x0 */
#movl $0xA0000/NBPG,%ecx /* look every 4K up to 640K */
movl $0xA0,%ecx /* look every 4K up to 640K */
1: movl (%eax),%ebx /* save location to check */
movl $0xa55a5aa5,(%eax) /* write test pattern */
/* flush stupid cache here! (with bcopy(0,0,512*1024) ) */
cmpl $0xa55a5aa5,(%eax) /* does not check yet for rollover */
jne 2f
movl %ebx,(%eax) /* restore memory */
addl $NBPG,%eax
loop 1b
2: shrl $12,%eax
movl %eax,_Maxmem-KERNBASE
movl $0x100000,%eax /* next, talley remaining memory */
#movl $((0xFFF000-0x100000)/NBPG),%ecx
movl $(0xFFF-0x100),%ecx
1: movl (%eax),%ebx /* save location to check */
movl $0xa55a5aa5,(%eax) /* write test pattern */
cmpl $0xa55a5aa5,(%eax) /* does not check yet for rollover */
jne 2f
movl %ebx,(%eax) /* restore memory */
addl $NBPG,%eax
loop 1b
2: shrl $12,%eax
movl %eax,_Maxmem-KERNBASE
#endif
/*
* Virtual address space of kernel:
*
@ -294,6 +263,27 @@ ENTRY(btext)
rep
stosb
/*
* If we are loaded at 0x0 check to see if we have space for the
* page tables pages after the kernel and before the 640K ISA memory
* hole. If we do not have space relocate the page table pages and
* the kernel stack to start at 1MB. The value that ends up in esi
* is used by the rest of locore to build the tables. Locore adjusts
* esi each time it allocates a structure and then passes the final
* value to init386(first) as the value first. esi should ALWAYS
* be page aligned!!
*/
movl %esi,%ecx /* Get current first availiable address */
cmpl $0x100000,%ecx /* Lets see if we are already above 1MB */
jge 1f /* yep, don't need to check for room */
addl $(NKPDE + 4) * NBPG,%ecx /* XXX the 4 is for kstack */
/* space for kstack, PTD and PTE's */
cmpl $(640*1024),%ecx
/* see if it fits in low memory */
jle 1f /* yep, don't need to relocate it */
movl $0x100000,%esi /* won't fit, so start it at 1MB */
1:
/* physical address of Idle Address space */
movl %esi,_IdlePTD-KERNBASE
@ -456,9 +446,6 @@ begin: /* now running relocated at KERNBASE where the system is linked to run */
movl _proc0paddr,%eax
movl %esi,PCB_CR3(%eax)
lea 7*NBPG(%esi),%esi /* skip past stack. */
pushl %esi
/* relocate debugger gdt entries */
movl $_gdt+8*9,%eax /* adjust slots 9-17 */
@ -473,6 +460,13 @@ reloc_gdt:
int $3
1:
/*
* Skip over the page tables and the kernel stack
* XXX 4 is kstack size
*/
lea (NKPDE + 4) * NBPG(%esi),%esi
pushl %esi /* value of first for init386(first) */
call _init386 /* wire 386 chip for unix operation */
movl $0,_PTD
@ -1663,7 +1657,7 @@ ENTRY(swtch)
movl %esi,PCB_ESI(%ecx)
movl %edi,PCB_EDI(%ecx)
#ifdef NPX
#if NNPX > 0
/* have we used fp, and need a save? */
mov _curproc,%eax
cmp %eax,_npxproc
@ -1675,7 +1669,7 @@ ENTRY(swtch)
popl %eax
popl %ecx
1:
#endif
#endif /* NNPX > 0 */
movl _CMAP2,%eax /* save temporary map PTE */
movl %eax,PCB_CMAP2(%ecx) /* in our context */
@ -1810,7 +1804,7 @@ ENTRY(savectx)
movl %esi,PCB_ESI(%ecx)
movl %edi,PCB_EDI(%ecx)
#ifdef NPX
#if NNPX > 0
/*
* If npxproc == NULL, then the npx h/w state is irrelevant and the
* state had better already be in the pcb. This is true for forks
@ -1846,7 +1840,7 @@ ENTRY(savectx)
addl $12,%esp
popl %ecx
1:
#endif
#endif /* NNPX > 0 */
movl _CMAP2,%edx /* save temporary map PTE */
movl %edx,PCB_CMAP2(%ecx) /* in our context */
@ -1975,7 +1969,7 @@ IDTVEC(page)
IDTVEC(rsvd)
pushl $0; TRAP(T_RESERVED)
IDTVEC(fpu)
#ifdef NPX
#if NNPX > 0
/*
* Handle like an interrupt so that we can call npxintr to clear the
* error. It would be better to handle npx interrupts as traps but
@ -1997,9 +1991,9 @@ IDTVEC(fpu)
incl _cnt+V_TRAP
call _npxintr
jmp doreti
#else
#else /* NNPX > 0 */
pushl $0; TRAP(T_ARITHTRAP)
#endif
#endif /* NNPX > 0 */
/* 17 - 31 reserved for future exp */
IDTVEC(rsvd0)
pushl $0; TRAP(17)

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.6 1993/10/10 06:07:57 rgrimes Exp $
* $Id: locore.s,v 1.7 1993/10/13 07:11:11 rgrimes Exp $
*/
@ -121,9 +121,9 @@
.globl _PTmap,_PTD,_PTDpde,_Sysmap
.set _PTmap,PTDPTDI << PDRSHIFT
.set _PTD,_PTmap + (PTDPTDI * NBPG)
.set _PTDpde,_PTD + (PTDPTDI * 4) /* XXX 4=sizeof pte */
.set _PTDpde,_PTD + (PTDPTDI * 4) /* XXX 4=sizeof pde */
.set _Sysmap,0xFDFF8000
.set _Sysmap,_PTmap + (KPTDI * NBPG)
/*
* APTmap, APTD is the alternate recursive pagemap.
@ -132,7 +132,7 @@
.globl _APTmap,_APTD,_APTDpde
.set _APTmap,APTDPTDI << PDRSHIFT
.set _APTD,_APTmap + (APTDPTDI * NBPG)
.set _APTDpde,_PTD + (APTDPTDI * 4) /* XXX 4=sizeof pte */
.set _APTDpde,_PTD + (APTDPTDI * 4) /* XXX 4=sizeof pde */
/*
* Access to each processes kernel stack is via a region of
@ -240,37 +240,6 @@ ENTRY(btext)
*/
movl $tmpstk-KERNBASE,%esp /* bootstrap stack end location */
#ifdef garbage
/* count up memory */
xorl %eax,%eax /* start with base memory at 0x0 */
#movl $0xA0000/NBPG,%ecx /* look every 4K up to 640K */
movl $0xA0,%ecx /* look every 4K up to 640K */
1: movl (%eax),%ebx /* save location to check */
movl $0xa55a5aa5,(%eax) /* write test pattern */
/* flush stupid cache here! (with bcopy(0,0,512*1024) ) */
cmpl $0xa55a5aa5,(%eax) /* does not check yet for rollover */
jne 2f
movl %ebx,(%eax) /* restore memory */
addl $NBPG,%eax
loop 1b
2: shrl $12,%eax
movl %eax,_Maxmem-KERNBASE
movl $0x100000,%eax /* next, talley remaining memory */
#movl $((0xFFF000-0x100000)/NBPG),%ecx
movl $(0xFFF-0x100),%ecx
1: movl (%eax),%ebx /* save location to check */
movl $0xa55a5aa5,(%eax) /* write test pattern */
cmpl $0xa55a5aa5,(%eax) /* does not check yet for rollover */
jne 2f
movl %ebx,(%eax) /* restore memory */
addl $NBPG,%eax
loop 1b
2: shrl $12,%eax
movl %eax,_Maxmem-KERNBASE
#endif
/*
* Virtual address space of kernel:
*
@ -294,6 +263,27 @@ ENTRY(btext)
rep
stosb
/*
* If we are loaded at 0x0 check to see if we have space for the
* page tables pages after the kernel and before the 640K ISA memory
* hole. If we do not have space relocate the page table pages and
* the kernel stack to start at 1MB. The value that ends up in esi
* is used by the rest of locore to build the tables. Locore adjusts
* esi each time it allocates a structure and then passes the final
* value to init386(first) as the value first. esi should ALWAYS
* be page aligned!!
*/
movl %esi,%ecx /* Get current first availiable address */
cmpl $0x100000,%ecx /* Lets see if we are already above 1MB */
jge 1f /* yep, don't need to check for room */
addl $(NKPDE + 4) * NBPG,%ecx /* XXX the 4 is for kstack */
/* space for kstack, PTD and PTE's */
cmpl $(640*1024),%ecx
/* see if it fits in low memory */
jle 1f /* yep, don't need to relocate it */
movl $0x100000,%esi /* won't fit, so start it at 1MB */
1:
/* physical address of Idle Address space */
movl %esi,_IdlePTD-KERNBASE
@ -456,9 +446,6 @@ begin: /* now running relocated at KERNBASE where the system is linked to run */
movl _proc0paddr,%eax
movl %esi,PCB_CR3(%eax)
lea 7*NBPG(%esi),%esi /* skip past stack. */
pushl %esi
/* relocate debugger gdt entries */
movl $_gdt+8*9,%eax /* adjust slots 9-17 */
@ -473,6 +460,13 @@ reloc_gdt:
int $3
1:
/*
* Skip over the page tables and the kernel stack
* XXX 4 is kstack size
*/
lea (NKPDE + 4) * NBPG(%esi),%esi
pushl %esi /* value of first for init386(first) */
call _init386 /* wire 386 chip for unix operation */
movl $0,_PTD
@ -1663,7 +1657,7 @@ ENTRY(swtch)
movl %esi,PCB_ESI(%ecx)
movl %edi,PCB_EDI(%ecx)
#ifdef NPX
#if NNPX > 0
/* have we used fp, and need a save? */
mov _curproc,%eax
cmp %eax,_npxproc
@ -1675,7 +1669,7 @@ ENTRY(swtch)
popl %eax
popl %ecx
1:
#endif
#endif /* NNPX > 0 */
movl _CMAP2,%eax /* save temporary map PTE */
movl %eax,PCB_CMAP2(%ecx) /* in our context */
@ -1810,7 +1804,7 @@ ENTRY(savectx)
movl %esi,PCB_ESI(%ecx)
movl %edi,PCB_EDI(%ecx)
#ifdef NPX
#if NNPX > 0
/*
* If npxproc == NULL, then the npx h/w state is irrelevant and the
* state had better already be in the pcb. This is true for forks
@ -1846,7 +1840,7 @@ ENTRY(savectx)
addl $12,%esp
popl %ecx
1:
#endif
#endif /* NNPX > 0 */
movl _CMAP2,%edx /* save temporary map PTE */
movl %edx,PCB_CMAP2(%ecx) /* in our context */
@ -1975,7 +1969,7 @@ IDTVEC(page)
IDTVEC(rsvd)
pushl $0; TRAP(T_RESERVED)
IDTVEC(fpu)
#ifdef NPX
#if NNPX > 0
/*
* Handle like an interrupt so that we can call npxintr to clear the
* error. It would be better to handle npx interrupts as traps but
@ -1997,9 +1991,9 @@ IDTVEC(fpu)
incl _cnt+V_TRAP
call _npxintr
jmp doreti
#else
#else /* NNPX > 0 */
pushl $0; TRAP(T_ARITHTRAP)
#endif
#endif /* NNPX > 0 */
/* 17 - 31 reserved for future exp */
IDTVEC(rsvd0)
pushl $0; TRAP(17)

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.10 1993/10/10 06:01:44 rgrimes Exp $
* $Id: machdep.c,v 1.11 1993/10/14 18:15:35 rgrimes Exp $
*/
#include "npx.h"
@ -198,16 +198,21 @@ cpu_startup()
#endif
/*
* Determine how many buffers to allocate.
* Use 10% of memory for the first 2 Meg, 5% of the remaining
* memory. Insure a minimum of 16 buffers.
* Use 20% of memory of memory beyond the first 2MB
* Insure a minimum of 16 fs buffers.
* We allocate 1/2 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;
bufpages = (ctob(physmem) - 2048*1024) / NBPG / 5;
if (bufpages < 32)
bufpages = 32;
/*
* We must still limit the maximum number of buffers to be no
* more than 2/5's of the size of the kernal malloc region, this
* will only take effect for machines with lots of memory
*/
bufpages = min(bufpages, (VM_KMEM_SIZE / NBPG) * 2 / 5);
if (nbuf == 0) {
nbuf = bufpages / 2;
if (nbuf < 16)
@ -240,9 +245,12 @@ cpu_startup()
/*
* Allocate a submap for buffer space allocations.
* XXX we are NOT using buffer_map, but due to
* the references to it we will just allocate 1 page of
* vm (not real memory) to make things happy...
*/
buffer_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
bufpages*NBPG, TRUE);
/* bufpages * */NBPG, TRUE);
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
@ -747,7 +755,7 @@ setregs(p, entry)
load_cr0(rcr0() | CR0_TS); /* start emulating */
#if NNPX > 0
npxinit(__INITIAL_NPXCW__);
#endif
#endif /* NNPX > 0 */
}
/*

View File

@ -35,9 +35,8 @@
* SUCH DAMAGE.
*
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
* $Id: pmap.c,v 1.5 1993/10/12 13:53:25 rgrimes Exp $
* $Id: pmap.c,v 1.6 1993/10/12 15:09:37 rgrimes Exp $
*/
static char rcsid[] = "$Id: pmap.c,v 1.5 1993/10/12 13:53:25 rgrimes Exp $";
/*
* Derived from hp300 version by Mike Hibler, this version by William
@ -1051,9 +1050,6 @@ pmap_enter(pmap, va, pa, prot, wired)
va += NBPG;
} while (++ix != i386pagesperpage);
pte--;
#ifdef DEBUGx
cache, tlb flushes
#endif
/*pads(pmap);*/
/*load_cr3(((struct pcb *)curproc->p_addr)->pcb_ptd);*/
tlbflush();
@ -1159,6 +1155,7 @@ struct pte *pmap_pte(pmap, va)
if (pmapdebug & PDB_FOLLOW)
printf("pmap_pte(%x, %x) ->\n", pmap, va);
#endif
if (pmap && pmap_pde_v(pmap_pde(pmap, va))) {
/* are we current address space or kernel? */
@ -1711,7 +1708,7 @@ pads(pm) pmap_t pm; {
for (i = 0; i < 1024; i++)
if(pm->pm_pdir[i].pd_v)
for (j = 0; j < 1024 ; j++) {
va = (i<<22)+(j<<12);
va = (i<<PD_SHIFT)+(j<<PG_SHIFT);
if (pm == kernel_pmap && va < KERNBASE)
continue;
if (pm != kernel_pmap && va > UPT_MAX_ADDRESS)

View File

@ -33,22 +33,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)trap.c 7.4 (Berkeley) 5/13/91
*
* PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
* -------------------- ----- ----------------------
* CURRENT PATCH LEVEL: 1 00137
* -------------------- ----- ----------------------
*
* 08 Apr 93 Bruce Evans Several VM system fixes
* Paul Kranenburg Add counter for vmstat
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
* $Id$
*/
static char rcsid[] = "$Header: /a/cvs/386BSD/src/sys/i386/i386/trap.c,v 1.2 1993/07/27 10:52:20 davidg Exp $";
/*
* 386 Trap and System call handleing
*/
#include "npx.h"
#include "machine/cpu.h"
#include "machine/psl.h"
#include "machine/reg.h"
@ -206,10 +199,10 @@ if(curpcb == 0 || curproc == 0) goto we_re_toast;
goto out;
case T_DNA|T_USER:
#ifdef NPX
#if NNPX > 0
/* if a transparent fault (due to context switch "late") */
if (npxdna()) return;
#endif
#endif /* NNPX > 0 */
#ifdef MATH_EMULATE
i = math_emulate(&frame);
if (i == 0) return;
@ -257,27 +250,6 @@ if(curpcb == 0 || curproc == 0) goto we_re_toast;
unsigned nss,v;
va = trunc_page((vm_offset_t)eva);
/*
* Avoid even looking at pde_v(va) for high va's. va's
* above VM_MAX_KERNEL_ADDRESS don't correspond to normal
* PDE's (half of them correspond to APDEpde and half to
* an unmapped kernel PDE). va's betweeen 0xFEC00000 and
* VM_MAX_KERNEL_ADDRESS correspond to unmapped kernel PDE's
* (XXX - why are only 3 initialized when 6 are required to
* reach VM_MAX_KERNEL_ADDRESS?). Faulting in an unmapped
* kernel page table would give inconsistent PTD's.
*
* XXX - faulting in unmapped page tables wastes a page if
* va turns out to be invalid.
*
* XXX - should "kernel address space" cover the kernel page
* tables? Might have same problem with PDEpde as with
* APDEpde (or there may be no problem with APDEpde).
*/
if (va > 0xFEBFF000) {
rv = KERN_FAILURE; /* becomes SIGBUS */
goto nogo;
}
/*
* It is only a kernel address space fault iff:
* 1. (type & T_USER) == 0 and

View File

@ -35,22 +35,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
*
* PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
* -------------------- ----- ----------------------
* CURRENT PATCH LEVEL: 1 00154
* -------------------- ----- ----------------------
*
* 20 Apr 93 Bruce Evans New npx-0.5 code
*
*/
/*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
* $Id$
*/
static char rcsid[] = "$Header: /usr/chroot/CVS/386BSD/src/sys/i386/i386/vm_machdep.c,v 1.3 1993/07/27 10:52:21 davidg Exp $";
#include "npx.h"
#include "param.h"
#include "systm.h"
#include "proc.h"
@ -152,9 +142,9 @@ cpu_exit(p)
{
static struct pcb nullpcb; /* pcb to overwrite on last swtch */
#ifdef NPX
#if NNPX > 0
npxexit(p);
#endif
#endif /* NNPX */
/* move to inactive space and stack, passing arg accross */
p = swtch_to_inactive(p);
@ -174,9 +164,9 @@ cpu_exit(p)
register struct proc *p;
{
#ifdef NPX
#if NNPX > 0
npxexit(p);
#endif
#endif /* NNPX */
splclock();
swtch();
/*
@ -308,8 +298,8 @@ kernacc(addr, count, rw)
for (pde += ix; cnt; cnt--, pde++)
if (pde->pd_v == 0)
return(0);
ix = btop(addr-0xfe000000);
cnt = btop(addr-0xfe000000+count+NBPG-1);
ix = btop(addr-KERNBASE);
cnt = btop(addr-KERNBASE+count+NBPG-1);
if (cnt > (int)&Syssize)
return(0);
cnt -= ix;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
* $Id: genassym.c,v 1.3 1993/10/10 02:09:44 rgrimes Exp $
* $Id: genassym.c,v 1.4 1993/10/12 15:33:18 rgrimes Exp $
*/
#include "sys/param.h"
@ -141,7 +141,6 @@ main()
printf("#define\tPCB_LDT %d\n", &pcb->pcb_tss.tss_ldt);
printf("#define\tPCB_USERLDT %d\n", &pcb->pcb_ldt);
printf("#define\tPCB_IOOPT %d\n", &pcb->pcb_tss.tss_ioopt);
printf("#define\tNKMEMCLUSTERS %d\n", NKMEMCLUSTERS);
printf("#define\tU_PROF %d\n", &up->u_stats.p_prof);
printf("#define\tU_PROFSCALE %d\n", &up->u_stats.p_prof.pr_scale);
printf("#define\tPR_BASE %d\n", &uprof->pr_base);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.6 1993/10/10 06:07:57 rgrimes Exp $
* $Id: locore.s,v 1.7 1993/10/13 07:11:11 rgrimes Exp $
*/
@ -121,9 +121,9 @@
.globl _PTmap,_PTD,_PTDpde,_Sysmap
.set _PTmap,PTDPTDI << PDRSHIFT
.set _PTD,_PTmap + (PTDPTDI * NBPG)
.set _PTDpde,_PTD + (PTDPTDI * 4) /* XXX 4=sizeof pte */
.set _PTDpde,_PTD + (PTDPTDI * 4) /* XXX 4=sizeof pde */
.set _Sysmap,0xFDFF8000
.set _Sysmap,_PTmap + (KPTDI * NBPG)
/*
* APTmap, APTD is the alternate recursive pagemap.
@ -132,7 +132,7 @@
.globl _APTmap,_APTD,_APTDpde
.set _APTmap,APTDPTDI << PDRSHIFT
.set _APTD,_APTmap + (APTDPTDI * NBPG)
.set _APTDpde,_PTD + (APTDPTDI * 4) /* XXX 4=sizeof pte */
.set _APTDpde,_PTD + (APTDPTDI * 4) /* XXX 4=sizeof pde */
/*
* Access to each processes kernel stack is via a region of
@ -240,37 +240,6 @@ ENTRY(btext)
*/
movl $tmpstk-KERNBASE,%esp /* bootstrap stack end location */
#ifdef garbage
/* count up memory */
xorl %eax,%eax /* start with base memory at 0x0 */
#movl $0xA0000/NBPG,%ecx /* look every 4K up to 640K */
movl $0xA0,%ecx /* look every 4K up to 640K */
1: movl (%eax),%ebx /* save location to check */
movl $0xa55a5aa5,(%eax) /* write test pattern */
/* flush stupid cache here! (with bcopy(0,0,512*1024) ) */
cmpl $0xa55a5aa5,(%eax) /* does not check yet for rollover */
jne 2f
movl %ebx,(%eax) /* restore memory */
addl $NBPG,%eax
loop 1b
2: shrl $12,%eax
movl %eax,_Maxmem-KERNBASE
movl $0x100000,%eax /* next, talley remaining memory */
#movl $((0xFFF000-0x100000)/NBPG),%ecx
movl $(0xFFF-0x100),%ecx
1: movl (%eax),%ebx /* save location to check */
movl $0xa55a5aa5,(%eax) /* write test pattern */
cmpl $0xa55a5aa5,(%eax) /* does not check yet for rollover */
jne 2f
movl %ebx,(%eax) /* restore memory */
addl $NBPG,%eax
loop 1b
2: shrl $12,%eax
movl %eax,_Maxmem-KERNBASE
#endif
/*
* Virtual address space of kernel:
*
@ -294,6 +263,27 @@ ENTRY(btext)
rep
stosb
/*
* If we are loaded at 0x0 check to see if we have space for the
* page tables pages after the kernel and before the 640K ISA memory
* hole. If we do not have space relocate the page table pages and
* the kernel stack to start at 1MB. The value that ends up in esi
* is used by the rest of locore to build the tables. Locore adjusts
* esi each time it allocates a structure and then passes the final
* value to init386(first) as the value first. esi should ALWAYS
* be page aligned!!
*/
movl %esi,%ecx /* Get current first availiable address */
cmpl $0x100000,%ecx /* Lets see if we are already above 1MB */
jge 1f /* yep, don't need to check for room */
addl $(NKPDE + 4) * NBPG,%ecx /* XXX the 4 is for kstack */
/* space for kstack, PTD and PTE's */
cmpl $(640*1024),%ecx
/* see if it fits in low memory */
jle 1f /* yep, don't need to relocate it */
movl $0x100000,%esi /* won't fit, so start it at 1MB */
1:
/* physical address of Idle Address space */
movl %esi,_IdlePTD-KERNBASE
@ -456,9 +446,6 @@ begin: /* now running relocated at KERNBASE where the system is linked to run */
movl _proc0paddr,%eax
movl %esi,PCB_CR3(%eax)
lea 7*NBPG(%esi),%esi /* skip past stack. */
pushl %esi
/* relocate debugger gdt entries */
movl $_gdt+8*9,%eax /* adjust slots 9-17 */
@ -473,6 +460,13 @@ reloc_gdt:
int $3
1:
/*
* Skip over the page tables and the kernel stack
* XXX 4 is kstack size
*/
lea (NKPDE + 4) * NBPG(%esi),%esi
pushl %esi /* value of first for init386(first) */
call _init386 /* wire 386 chip for unix operation */
movl $0,_PTD
@ -1663,7 +1657,7 @@ ENTRY(swtch)
movl %esi,PCB_ESI(%ecx)
movl %edi,PCB_EDI(%ecx)
#ifdef NPX
#if NNPX > 0
/* have we used fp, and need a save? */
mov _curproc,%eax
cmp %eax,_npxproc
@ -1675,7 +1669,7 @@ ENTRY(swtch)
popl %eax
popl %ecx
1:
#endif
#endif /* NNPX > 0 */
movl _CMAP2,%eax /* save temporary map PTE */
movl %eax,PCB_CMAP2(%ecx) /* in our context */
@ -1810,7 +1804,7 @@ ENTRY(savectx)
movl %esi,PCB_ESI(%ecx)
movl %edi,PCB_EDI(%ecx)
#ifdef NPX
#if NNPX > 0
/*
* If npxproc == NULL, then the npx h/w state is irrelevant and the
* state had better already be in the pcb. This is true for forks
@ -1846,7 +1840,7 @@ ENTRY(savectx)
addl $12,%esp
popl %ecx
1:
#endif
#endif /* NNPX > 0 */
movl _CMAP2,%edx /* save temporary map PTE */
movl %edx,PCB_CMAP2(%ecx) /* in our context */
@ -1975,7 +1969,7 @@ IDTVEC(page)
IDTVEC(rsvd)
pushl $0; TRAP(T_RESERVED)
IDTVEC(fpu)
#ifdef NPX
#if NNPX > 0
/*
* Handle like an interrupt so that we can call npxintr to clear the
* error. It would be better to handle npx interrupts as traps but
@ -1997,9 +1991,9 @@ IDTVEC(fpu)
incl _cnt+V_TRAP
call _npxintr
jmp doreti
#else
#else /* NNPX > 0 */
pushl $0; TRAP(T_ARITHTRAP)
#endif
#endif /* NNPX > 0 */
/* 17 - 31 reserved for future exp */
IDTVEC(rsvd0)
pushl $0; TRAP(17)

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.10 1993/10/10 06:01:44 rgrimes Exp $
* $Id: machdep.c,v 1.11 1993/10/14 18:15:35 rgrimes Exp $
*/
#include "npx.h"
@ -198,16 +198,21 @@ cpu_startup()
#endif
/*
* Determine how many buffers to allocate.
* Use 10% of memory for the first 2 Meg, 5% of the remaining
* memory. Insure a minimum of 16 buffers.
* Use 20% of memory of memory beyond the first 2MB
* Insure a minimum of 16 fs buffers.
* We allocate 1/2 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;
bufpages = (ctob(physmem) - 2048*1024) / NBPG / 5;
if (bufpages < 32)
bufpages = 32;
/*
* We must still limit the maximum number of buffers to be no
* more than 2/5's of the size of the kernal malloc region, this
* will only take effect for machines with lots of memory
*/
bufpages = min(bufpages, (VM_KMEM_SIZE / NBPG) * 2 / 5);
if (nbuf == 0) {
nbuf = bufpages / 2;
if (nbuf < 16)
@ -240,9 +245,12 @@ cpu_startup()
/*
* Allocate a submap for buffer space allocations.
* XXX we are NOT using buffer_map, but due to
* the references to it we will just allocate 1 page of
* vm (not real memory) to make things happy...
*/
buffer_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
bufpages*NBPG, TRUE);
/* bufpages * */NBPG, TRUE);
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
@ -747,7 +755,7 @@ setregs(p, entry)
load_cr0(rcr0() | CR0_TS); /* start emulating */
#if NNPX > 0
npxinit(__INITIAL_NPXCW__);
#endif
#endif /* NNPX > 0 */
}
/*

View File

@ -35,9 +35,8 @@
* SUCH DAMAGE.
*
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
* $Id: pmap.c,v 1.5 1993/10/12 13:53:25 rgrimes Exp $
* $Id: pmap.c,v 1.6 1993/10/12 15:09:37 rgrimes Exp $
*/
static char rcsid[] = "$Id: pmap.c,v 1.5 1993/10/12 13:53:25 rgrimes Exp $";
/*
* Derived from hp300 version by Mike Hibler, this version by William
@ -1051,9 +1050,6 @@ pmap_enter(pmap, va, pa, prot, wired)
va += NBPG;
} while (++ix != i386pagesperpage);
pte--;
#ifdef DEBUGx
cache, tlb flushes
#endif
/*pads(pmap);*/
/*load_cr3(((struct pcb *)curproc->p_addr)->pcb_ptd);*/
tlbflush();
@ -1159,6 +1155,7 @@ struct pte *pmap_pte(pmap, va)
if (pmapdebug & PDB_FOLLOW)
printf("pmap_pte(%x, %x) ->\n", pmap, va);
#endif
if (pmap && pmap_pde_v(pmap_pde(pmap, va))) {
/* are we current address space or kernel? */
@ -1711,7 +1708,7 @@ pads(pm) pmap_t pm; {
for (i = 0; i < 1024; i++)
if(pm->pm_pdir[i].pd_v)
for (j = 0; j < 1024 ; j++) {
va = (i<<22)+(j<<12);
va = (i<<PD_SHIFT)+(j<<PG_SHIFT);
if (pm == kernel_pmap && va < KERNBASE)
continue;
if (pm != kernel_pmap && va > UPT_MAX_ADDRESS)

View File

@ -33,22 +33,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)trap.c 7.4 (Berkeley) 5/13/91
*
* PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
* -------------------- ----- ----------------------
* CURRENT PATCH LEVEL: 1 00137
* -------------------- ----- ----------------------
*
* 08 Apr 93 Bruce Evans Several VM system fixes
* Paul Kranenburg Add counter for vmstat
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
* $Id$
*/
static char rcsid[] = "$Header: /a/cvs/386BSD/src/sys/i386/i386/trap.c,v 1.2 1993/07/27 10:52:20 davidg Exp $";
/*
* 386 Trap and System call handleing
*/
#include "npx.h"
#include "machine/cpu.h"
#include "machine/psl.h"
#include "machine/reg.h"
@ -206,10 +199,10 @@ if(curpcb == 0 || curproc == 0) goto we_re_toast;
goto out;
case T_DNA|T_USER:
#ifdef NPX
#if NNPX > 0
/* if a transparent fault (due to context switch "late") */
if (npxdna()) return;
#endif
#endif /* NNPX > 0 */
#ifdef MATH_EMULATE
i = math_emulate(&frame);
if (i == 0) return;
@ -257,27 +250,6 @@ if(curpcb == 0 || curproc == 0) goto we_re_toast;
unsigned nss,v;
va = trunc_page((vm_offset_t)eva);
/*
* Avoid even looking at pde_v(va) for high va's. va's
* above VM_MAX_KERNEL_ADDRESS don't correspond to normal
* PDE's (half of them correspond to APDEpde and half to
* an unmapped kernel PDE). va's betweeen 0xFEC00000 and
* VM_MAX_KERNEL_ADDRESS correspond to unmapped kernel PDE's
* (XXX - why are only 3 initialized when 6 are required to
* reach VM_MAX_KERNEL_ADDRESS?). Faulting in an unmapped
* kernel page table would give inconsistent PTD's.
*
* XXX - faulting in unmapped page tables wastes a page if
* va turns out to be invalid.
*
* XXX - should "kernel address space" cover the kernel page
* tables? Might have same problem with PDEpde as with
* APDEpde (or there may be no problem with APDEpde).
*/
if (va > 0xFEBFF000) {
rv = KERN_FAILURE; /* becomes SIGBUS */
goto nogo;
}
/*
* It is only a kernel address space fault iff:
* 1. (type & T_USER) == 0 and

View File

@ -35,22 +35,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
*
* PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
* -------------------- ----- ----------------------
* CURRENT PATCH LEVEL: 1 00154
* -------------------- ----- ----------------------
*
* 20 Apr 93 Bruce Evans New npx-0.5 code
*
*/
/*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
* $Id$
*/
static char rcsid[] = "$Header: /usr/chroot/CVS/386BSD/src/sys/i386/i386/vm_machdep.c,v 1.3 1993/07/27 10:52:21 davidg Exp $";
#include "npx.h"
#include "param.h"
#include "systm.h"
#include "proc.h"
@ -152,9 +142,9 @@ cpu_exit(p)
{
static struct pcb nullpcb; /* pcb to overwrite on last swtch */
#ifdef NPX
#if NNPX > 0
npxexit(p);
#endif
#endif /* NNPX */
/* move to inactive space and stack, passing arg accross */
p = swtch_to_inactive(p);
@ -174,9 +164,9 @@ cpu_exit(p)
register struct proc *p;
{
#ifdef NPX
#if NNPX > 0
npxexit(p);
#endif
#endif /* NNPX */
splclock();
swtch();
/*
@ -308,8 +298,8 @@ kernacc(addr, count, rw)
for (pde += ix; cnt; cnt--, pde++)
if (pde->pd_v == 0)
return(0);
ix = btop(addr-0xfe000000);
cnt = btop(addr-0xfe000000+count+NBPG-1);
ix = btop(addr-KERNBASE);
cnt = btop(addr-KERNBASE+count+NBPG-1);
if (cnt > (int)&Syssize)
return(0);
cnt -= ix;

View File

@ -33,22 +33,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)trap.c 7.4 (Berkeley) 5/13/91
*
* PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
* -------------------- ----- ----------------------
* CURRENT PATCH LEVEL: 1 00137
* -------------------- ----- ----------------------
*
* 08 Apr 93 Bruce Evans Several VM system fixes
* Paul Kranenburg Add counter for vmstat
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
* $Id$
*/
static char rcsid[] = "$Header: /a/cvs/386BSD/src/sys/i386/i386/trap.c,v 1.2 1993/07/27 10:52:20 davidg Exp $";
/*
* 386 Trap and System call handleing
*/
#include "npx.h"
#include "machine/cpu.h"
#include "machine/psl.h"
#include "machine/reg.h"
@ -206,10 +199,10 @@ if(curpcb == 0 || curproc == 0) goto we_re_toast;
goto out;
case T_DNA|T_USER:
#ifdef NPX
#if NNPX > 0
/* if a transparent fault (due to context switch "late") */
if (npxdna()) return;
#endif
#endif /* NNPX > 0 */
#ifdef MATH_EMULATE
i = math_emulate(&frame);
if (i == 0) return;
@ -257,27 +250,6 @@ if(curpcb == 0 || curproc == 0) goto we_re_toast;
unsigned nss,v;
va = trunc_page((vm_offset_t)eva);
/*
* Avoid even looking at pde_v(va) for high va's. va's
* above VM_MAX_KERNEL_ADDRESS don't correspond to normal
* PDE's (half of them correspond to APDEpde and half to
* an unmapped kernel PDE). va's betweeen 0xFEC00000 and
* VM_MAX_KERNEL_ADDRESS correspond to unmapped kernel PDE's
* (XXX - why are only 3 initialized when 6 are required to
* reach VM_MAX_KERNEL_ADDRESS?). Faulting in an unmapped
* kernel page table would give inconsistent PTD's.
*
* XXX - faulting in unmapped page tables wastes a page if
* va turns out to be invalid.
*
* XXX - should "kernel address space" cover the kernel page
* tables? Might have same problem with PDEpde as with
* APDEpde (or there may be no problem with APDEpde).
*/
if (va > 0xFEBFF000) {
rv = KERN_FAILURE; /* becomes SIGBUS */
goto nogo;
}
/*
* It is only a kernel address space fault iff:
* 1. (type & T_USER) == 0 and