Implement changes for MACHINE_NEW_NONCONTIG and UVM.
This commit is contained in:
parent
4e915f8681
commit
0e88177c0b
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: VME147,v 1.20 1997/12/17 21:20:06 scw Exp $
|
||||
# $NetBSD: VME147,v 1.21 1998/02/21 19:03:25 scw Exp $
|
||||
|
||||
include "arch/mvme68k/conf/std.mvme68k"
|
||||
|
||||
|
@ -7,6 +7,9 @@ options MVME147
|
|||
|
||||
maxusers 2
|
||||
|
||||
options UVM
|
||||
#options DDB
|
||||
|
||||
options DIAGNOSTIC, DEBUG
|
||||
|
||||
#options SYSVSHM
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap.h,v 1.9 1998/02/18 02:05:34 cgd Exp $ */
|
||||
/* $NetBSD: pmap.h,v 1.10 1998/02/21 19:03:25 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987 Carnegie-Mellon University
|
||||
|
@ -142,19 +142,15 @@ extern vm_offset_t vm_first_phys, vm_num_phys;
|
|||
|
||||
extern struct pv_entry *pv_table; /* array of entries, one per page */
|
||||
|
||||
#ifndef MACHINE_NONCONTIG
|
||||
#ifndef MACHINE_NEW_NONCONTIG
|
||||
#define pmap_page_index(pa) atop(pa - vm_first_phys)
|
||||
#endif
|
||||
#define pa_to_pvh(pa) (&pv_table[pmap_page_index(pa)])
|
||||
|
||||
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
|
||||
#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
|
||||
|
||||
extern pt_entry_t *Sysmap;
|
||||
extern char *vmmap; /* map for mem, dumps, etc. */
|
||||
|
||||
vm_offset_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int));
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* !_MACHINE_PMAP_H_ */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vmparam.h,v 1.5 1997/10/12 15:39:35 scw Exp $ */
|
||||
/* $NetBSD: vmparam.h,v 1.6 1998/02/21 19:03:25 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -42,9 +42,13 @@
|
|||
* @(#)vmparam.h 8.2 (Berkeley) 4/19/94
|
||||
*/
|
||||
|
||||
#ifndef _MVME68K_VMPARAM_H_
|
||||
#define _MVME68K_VMPARAM_H_
|
||||
|
||||
/*
|
||||
* Machine dependent constants for MVME68K
|
||||
*/
|
||||
|
||||
/*
|
||||
* USRTEXT is the start of the user text/data space, while USRSTACK
|
||||
* is the top (end) of the user stack. LOWPAGES and HIGHPAGES are
|
||||
|
@ -232,4 +236,26 @@
|
|||
/* pcb base */
|
||||
#define pcbb(p) ((u_int)(p)->p_addr)
|
||||
|
||||
#define MACHINE_NONCONTIG /* VM <=> pmap interface modifier */
|
||||
/* Use new VM page bootstrap interface. */
|
||||
#define MACHINE_NEW_NONCONTIG
|
||||
|
||||
#ifdef MACHINE_NEW_NONCONTIG
|
||||
/*
|
||||
* Constants which control the way the VM system deals with memory segments.
|
||||
* The mvme68k port has two physical memory segments: 1 for onboard RAM
|
||||
* and another for contiguous VMEbus RAM.
|
||||
*/
|
||||
#define VM_PHYSSEG_MAX 2
|
||||
#define VM_PHYSSEG_STRAT VM_PSTRAT_RANDOM
|
||||
#define VM_PHYSSEG_NOADD
|
||||
|
||||
/*
|
||||
* pmap-specific data stored in the vm_physmem[] array.
|
||||
*/
|
||||
struct pmap_physseg {
|
||||
struct pv_entry *pvent; /* pv table for this seg */
|
||||
char *attrs; /* page attributes for this seg */
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* _MVME68K_VMPARAM_H_ */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: genassym.cf,v 1.7 1998/01/06 08:46:17 thorpej Exp $
|
||||
# $NetBSD: genassym.cf,v 1.8 1998/02/21 19:03:26 scw Exp $
|
||||
|
||||
#
|
||||
# Copyright (c) 1982, 1990, 1993
|
||||
|
@ -46,6 +46,10 @@ include <sys/user.h>
|
|||
|
||||
include <vm/vm.h>
|
||||
|
||||
ifdef UVM
|
||||
include <uvm/uvm_extern.h>
|
||||
endif
|
||||
|
||||
include <machine/cpu.h>
|
||||
include <machine/psl.h>
|
||||
include <machine/reg.h>
|
||||
|
@ -106,7 +110,7 @@ define UPAGES UPAGES
|
|||
define USPACE USPACE
|
||||
define NBPG NBPG
|
||||
define PGSHIFT PGSHIFT
|
||||
#define USRSTACK USRSTACK
|
||||
define USRSTACK USRSTACK
|
||||
|
||||
# boot stuff
|
||||
define RB_SBOOT RB_SBOOT
|
||||
|
@ -134,7 +138,11 @@ define SSLEEP SSLEEP
|
|||
define SRUN SRUN
|
||||
|
||||
# interrupt/fault metering
|
||||
ifdef UVM
|
||||
define UVMEXP_INTRS offsetof(struct uvmexp, intrs)
|
||||
else
|
||||
define V_INTR offsetof(struct vmmeter, v_intr)
|
||||
endif
|
||||
|
||||
# PSL values (should just include psl.h?)
|
||||
define PSL_S PSL_S
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isr.c,v 1.7 1997/11/13 10:43:11 veego Exp $ */
|
||||
/* $NetBSD: isr.c,v 1.8 1998/02/21 19:03:26 scw Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -40,13 +40,22 @@
|
|||
* Link and dispatch interrupts.
|
||||
*/
|
||||
|
||||
#include "opt_uvm.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/vmmeter.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#ifdef UVM
|
||||
#include <vm/vm.h>
|
||||
#include <uvm/uvm_extern.h>
|
||||
#endif
|
||||
|
||||
#include <net/netisr.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <mvme68k/mvme68k/isr.h>
|
||||
|
||||
isr_autovec_list_t isr_autovec[NISRAUTOVEC];
|
||||
|
@ -213,7 +222,11 @@ isrdispatch_autovec(evec)
|
|||
ipl = vec - ISRAUTOVEC;
|
||||
|
||||
intrcnt[ipl]++;
|
||||
#ifdef UVM
|
||||
uvmexp.intrs++;
|
||||
#else
|
||||
cnt.v_intr++;
|
||||
#endif
|
||||
|
||||
list = &isr_autovec[ipl];
|
||||
if (list->lh_first == NULL) {
|
||||
|
@ -251,7 +264,11 @@ isrdispatch_vectored(pc, evec, frame)
|
|||
ipl = (getsr() >> 8) & 7;
|
||||
|
||||
intrcnt[ipl]++;
|
||||
#ifdef UVM
|
||||
uvmexp.intrs++;
|
||||
#else
|
||||
cnt.v_intr++;
|
||||
#endif
|
||||
|
||||
if ((vec < ISRVECTORED) || (vec >= (ISRVECTORED + NISRVECTORED)))
|
||||
panic("isrdispatch_vectored: bad vec 0x%x\n", vec);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locore.s,v 1.32 1998/01/05 23:16:32 thorpej Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.33 1998/02/21 19:03:26 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -42,10 +42,11 @@
|
|||
* @(#)locore.s 8.6 (Berkeley) 5/27/94
|
||||
*/
|
||||
|
||||
#include "opt_uvm.h"
|
||||
|
||||
#include "assym.h"
|
||||
#include <machine/asm.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/vmparam.h>
|
||||
|
||||
/*
|
||||
* Temporary stack for a variety of purposes.
|
||||
|
@ -164,20 +165,7 @@ start: | start of kernel and .text!
|
|||
RELOC(_myea, a0)
|
||||
movl 0xfffe0778,a0@ | XXXCDC -- HARDWIRED HEX
|
||||
|
||||
/* initialize memory sizes (for pmap_bootstrap) */
|
||||
#ifndef MACHINE_NONCONTIG
|
||||
movl 0xfffe0774,d1 | XXXCDC -- hardwired HEX
|
||||
moveq #PGSHIFT,d2
|
||||
lsrl d2,d1 | convert to page (click) number
|
||||
RELOC(_maxmem, a0)
|
||||
movl d1,a0@ | save as maxmem
|
||||
movl a5,d0 | lowram value from ROM via boot
|
||||
lsrl d2,d0 | convert to page number
|
||||
subl d0,d1 | compute amount of RAM present
|
||||
RELOC(_physmem, a0)
|
||||
movl d1,a0@ | and physmem
|
||||
#else
|
||||
/* initialise list of physical memory segments */
|
||||
/* initialise list of physical memory segments for pmap_bootstrap */
|
||||
RELOC(_phys_seg_list, a0)
|
||||
movl a5,a0@ | phys_seg_list[0].ps_start
|
||||
movl 0xfffe0774,d1 | End + 1 of onboard memory
|
||||
|
@ -218,8 +206,6 @@ Lsavmaxmem:
|
|||
lsrl d2,d1 | convert to page (click) number
|
||||
RELOC(_maxmem, a0)
|
||||
movl d1,a0@ | save as maxmem
|
||||
#endif
|
||||
|
||||
jra Lstart1
|
||||
Lnot147:
|
||||
#endif
|
||||
|
@ -393,7 +379,11 @@ Lmotommu2:
|
|||
Lenab1:
|
||||
/* select the software page size now */
|
||||
lea tmpstk,sp | temporary stack
|
||||
#ifdef UVM
|
||||
jbsr _uvm_setpagesize | select software page size
|
||||
#else
|
||||
jbsr _vm_set_page_size | select software page size
|
||||
#endif
|
||||
/* set kernel stack, user SP, and initial pcb */
|
||||
movl _proc0paddr,a1 | get proc0 pcb addr
|
||||
lea a1@(USPACE-4),sp | set kernel stack to end of area
|
||||
|
@ -840,7 +830,11 @@ Lsigr1:
|
|||
|
||||
_spurintr: /* Level 0 */
|
||||
addql #1,_intrcnt+0
|
||||
#ifdef UVM
|
||||
addql #1,_uvmexp+UVMEXP_INTRS
|
||||
#else
|
||||
addql #1,_cnt+V_INTR
|
||||
#endif
|
||||
jra rei
|
||||
|
||||
_intrhand_autovec: /* Levels 1 through 6 */
|
||||
|
@ -973,7 +967,10 @@ Ldorte:
|
|||
*/
|
||||
#include <m68k/m68k/support.s>
|
||||
|
||||
.globl _whichqs,_qs,_cnt,_panic
|
||||
#ifndef UVM
|
||||
.globl _cnt
|
||||
#endif
|
||||
.globl _whichqs,_qs,_panic
|
||||
.globl _curproc,_want_resched
|
||||
|
||||
/*
|
||||
|
@ -1010,7 +1007,11 @@ ENTRY(switch_exit)
|
|||
movl #USPACE,sp@- | size of u-area
|
||||
movl a0@(P_ADDR),sp@- | address of process's u-area
|
||||
movl _kernel_map,sp@- | map it was allocated in
|
||||
#ifdef UVM
|
||||
jbsr _uvm_km_free | deallocate it
|
||||
#else
|
||||
jbsr _kmem_free | deallocate it
|
||||
#endif
|
||||
lea sp@(12),sp | pop args
|
||||
|
||||
jra _cpu_switch
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.33 1998/02/19 04:18:33 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.34 1998/02/21 19:03:26 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -42,6 +42,8 @@
|
|||
* @(#)machdep.c 8.10 (Berkeley) 4/20/94
|
||||
*/
|
||||
|
||||
#include "opt_uvm.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/signalvar.h>
|
||||
|
@ -80,6 +82,10 @@
|
|||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_page.h>
|
||||
|
||||
#if defined(UVM)
|
||||
#include <uvm/uvm_extern.h>
|
||||
#endif
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
@ -92,7 +98,7 @@
|
|||
|
||||
#include <machine/kcore.h> /* XXX should be pulled in by sys/kcore.h */
|
||||
|
||||
#ifdef MACHINE_NONCONTIG
|
||||
#ifdef MACHINE_NEW_NONCONTIG
|
||||
#include <mvme68k/mvme68k/seglist.h>
|
||||
#endif
|
||||
|
||||
|
@ -101,7 +107,13 @@
|
|||
/* the following is used externally (sysctl_hw) */
|
||||
char machine[] = MACHINE; /* from <machine/param.h> */
|
||||
|
||||
#if defined(UVM)
|
||||
vm_map_t exec_map = NULL;
|
||||
vm_map_t mb_map = NULL;
|
||||
vm_map_t phys_map = NULL;
|
||||
#else
|
||||
vm_map_t buffer_map;
|
||||
#endif
|
||||
extern vm_offset_t avail_end;
|
||||
|
||||
/*
|
||||
|
@ -191,6 +203,24 @@ mvme68k_init()
|
|||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Tell the VM system about available physical memory.
|
||||
*/
|
||||
#ifdef MACHINE_NEW_NONCONTIG
|
||||
for (i = 0; i < MAX_PHYS_SEGS && phys_seg_list[i].ps_start; i++)
|
||||
#if defined(UVM)
|
||||
uvm_page_physload(atop(phys_seg_list[i].ps_start),
|
||||
atop(phys_seg_list[i].ps_end),
|
||||
atop(phys_seg_list[i].ps_start),
|
||||
atop(phys_seg_list[i].ps_end));
|
||||
#else
|
||||
vm_page_physload(atop(phys_seg_list[i].ps_start),
|
||||
atop(phys_seg_list[i].ps_end),
|
||||
atop(phys_seg_list[i].ps_start),
|
||||
atop(phys_seg_list[i].ps_end));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Initialize interrupt handlers. */
|
||||
isrinit();
|
||||
|
||||
|
@ -218,7 +248,7 @@ mvme68k_init()
|
|||
* Initialize error message buffer (at end of core).
|
||||
* avail_end was pre-decremented in pmap_bootstrap to compensate.
|
||||
*/
|
||||
#ifdef MACHINE_NONCONTIG
|
||||
#ifdef MACHINE_NEW_NONCONTIG
|
||||
#define MVME_MSG_BUF_START phys_seg_list[0].ps_end
|
||||
#else
|
||||
#define MVME_MSG_BUF_START avail_end
|
||||
|
@ -342,8 +372,8 @@ cpu_startup()
|
|||
identifycpu();
|
||||
printf("real mem = %d", ctob(physmem));
|
||||
|
||||
#ifdef MACHINE_NONCONTIG
|
||||
maxaddr = 0;
|
||||
#ifdef MACHINE_NEW_NONCONTIG
|
||||
maxaddr = 0;
|
||||
for (i = 1; i < MAX_PHYS_SEGS && phys_seg_list[i].ps_start; i++)
|
||||
maxaddr += phys_seg_list[i].ps_end - phys_seg_list[i].ps_start;
|
||||
|
||||
|
@ -354,12 +384,17 @@ cpu_startup()
|
|||
printf("\n");
|
||||
|
||||
/*
|
||||
* Fine out how much space we need, allocate it,
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
size = (vm_size_t)allocsys((caddr_t)0);
|
||||
#if defined(UVM)
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(size))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
#else
|
||||
if ((v = (caddr_t)kmem_alloc(kernel_map, round_page(size))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
#endif
|
||||
if ((allocsys(v) - v) != size)
|
||||
panic("startup: talbe size inconsistency");
|
||||
|
||||
|
@ -369,15 +404,53 @@ cpu_startup()
|
|||
* in that they usually occupy more virtual memory than physical.
|
||||
*/
|
||||
size = MAXBSIZE * nbuf;
|
||||
#if defined(UVM)
|
||||
if (uvm_map(kernel_map, (vm_offset_t *) &buffers, round_page(size),
|
||||
NULL, UVM_UNKNOWN_OFFSET,
|
||||
UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
|
||||
UVM_ADV_NORMAL, 0)) != KERN_SUCCESS)
|
||||
panic("startup: cannot allocate VM for buffers");
|
||||
minaddr = (vm_offset_t)buffers;
|
||||
#else
|
||||
buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,
|
||||
&maxaddr, size, TRUE);
|
||||
minaddr = (vm_offset_t)buffers;
|
||||
if (vm_map_find(buffer_map, vm_object_allocate(size), (vm_offset_t)0,
|
||||
&minaddr, size, FALSE) != KERN_SUCCESS)
|
||||
panic("startup: cannot allocate buffers");
|
||||
#endif
|
||||
base = bufpages / nbuf;
|
||||
residual = bufpages % nbuf;
|
||||
for (i = 0; i < nbuf; i++) {
|
||||
#if defined(UVM)
|
||||
vm_size_t curbufsize;
|
||||
vm_offset_t curbuf;
|
||||
struct vm_page *pg;
|
||||
|
||||
/*
|
||||
* Each buffer has MAXBSIZE bytes of VM space allocated. Of
|
||||
* that MAXBSIZE space, we allocate and map (base+1) pages
|
||||
* for the first "residual" buffers, and then we allocate
|
||||
* "base" pages for the rest.
|
||||
*/
|
||||
curbuf = (vm_offset_t) buffers + (i * MAXBSIZE);
|
||||
curbufsize = CLBYTES * ((i < residual) ? (base+1) : base);
|
||||
|
||||
while (curbufsize) {
|
||||
pg = uvm_pagealloc(NULL, 0, NULL);
|
||||
if (pg == NULL)
|
||||
panic("cpu_startup: not enough memory for "
|
||||
"buffer cache");
|
||||
#ifdef PMAP_NEW
|
||||
pmap_kenter_pgs(curbuf, &pg, 1);
|
||||
#else
|
||||
pmap_enter(kernel_map->pmap, curbuf,
|
||||
VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, TRUE);
|
||||
#endif
|
||||
curbuf += PAGE_SIZE;
|
||||
curbufsize -= PAGE_SIZE;
|
||||
}
|
||||
#else /* ! UVM */
|
||||
vm_size_t curbufsize;
|
||||
vm_offset_t curbuf;
|
||||
|
||||
|
@ -392,24 +465,42 @@ cpu_startup()
|
|||
curbufsize = CLBYTES * (i < residual ? base+1 : base);
|
||||
vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
|
||||
vm_map_simplify(buffer_map, curbuf);
|
||||
#endif /* UVM */
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a submap for exec arguments. This map effectively
|
||||
* limits the number of processes exec'ing at any time.
|
||||
*/
|
||||
#if defined(UVM)
|
||||
exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
16*NCARGS, TRUE, FALSE, NULL);
|
||||
#else
|
||||
exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
16*NCARGS, TRUE);
|
||||
#endif
|
||||
/*
|
||||
* Allocate a submap for physio
|
||||
*/
|
||||
#if defined(UVM)
|
||||
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
VM_PHYS_SIZE, TRUE, FALSE, NULL);
|
||||
#else
|
||||
phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
VM_PHYS_SIZE, TRUE);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Finally, allocate mbuf cluster submap.
|
||||
*/
|
||||
#if defined(UVM)
|
||||
mb_map = uvm_km_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
|
||||
VM_MBUF_SIZE, FALSE, FALSE, NULL);
|
||||
#else
|
||||
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
|
||||
VM_MBUF_SIZE, FALSE);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize callouts
|
||||
*/
|
||||
|
@ -421,7 +512,11 @@ cpu_startup()
|
|||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
printf("avail mem = %d\n", ptoa(cnt.v_free_count));
|
||||
#if defined(UVM)
|
||||
printf("avail mem = %ld\n", ptoa(uvmexp.free));
|
||||
#else
|
||||
printf("avail mem = %ld\n", ptoa(cnt.v_free_count));
|
||||
#endif
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
|
||||
|
@ -432,18 +527,31 @@ cpu_startup()
|
|||
* XXX Should just change KERNBASE and VM_MIN_KERNEL_ADDRESS,
|
||||
* XXX but not right now.
|
||||
*/
|
||||
#if defined(UVM)
|
||||
if (uvm_map_protect(kernel_map, 0, round_page(&kernel_text),
|
||||
UVM_PROT_NONE, TRUE) != KERN_SUCCESS)
|
||||
panic("can't mark pre-text pages off-limits");
|
||||
#else
|
||||
if (vm_map_protect(kernel_map, 0, round_page(&kernel_text),
|
||||
VM_PROT_NONE, TRUE) != KERN_SUCCESS)
|
||||
panic("can't mark pre-text pages off-limits");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Tell the VM system that writing to the kernel text isn't allowed.
|
||||
* If we don't, we might end up COW'ing the text segment!
|
||||
*/
|
||||
#if defined(UVM)
|
||||
if (uvm_map_protect(kernel_map, trunc_page(&kernel_text),
|
||||
round_page(&etext), UVM_PROT_READ|UVM_PROT_EXEC, TRUE)
|
||||
!= KERN_SUCCESS)
|
||||
panic("can't protect kernel text");
|
||||
#else
|
||||
if (vm_map_protect(kernel_map, trunc_page(&kernel_text),
|
||||
round_page(&etext), VM_PROT_READ|VM_PROT_EXECUTE, TRUE)
|
||||
!= KERN_SUCCESS)
|
||||
panic("can't protect kernel text");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set up CPU-specific registers, cache, etc.
|
||||
|
@ -517,7 +625,9 @@ allocsys(v)
|
|||
if (nswbuf > 256)
|
||||
nswbuf = 256; /* sanity */
|
||||
}
|
||||
#if !defined(UVM)
|
||||
valloc(swbuf, struct buf, nswbuf);
|
||||
#endif
|
||||
valloc(buf, struct buf, nbuf);
|
||||
return (v);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mem.c,v 1.2 1997/02/02 08:27:15 thorpej Exp $ */
|
||||
/* $NetBSD: mem.c,v 1.3 1998/02/21 19:03:26 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -44,16 +44,22 @@
|
|||
* Memory special file
|
||||
*/
|
||||
|
||||
#include "opt_uvm.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#ifdef UVM
|
||||
#include <uvm/uvm_extern.h>
|
||||
#endif
|
||||
|
||||
extern u_int lowram;
|
||||
static caddr_t devzeropage;
|
||||
|
@ -85,9 +91,9 @@ mmrw(dev, uio, flags)
|
|||
struct uio *uio;
|
||||
int flags;
|
||||
{
|
||||
register vm_offset_t o, v;
|
||||
register int c;
|
||||
register struct iovec *iov;
|
||||
vm_offset_t o, v;
|
||||
int c;
|
||||
struct iovec *iov;
|
||||
int error = 0;
|
||||
static int physlock;
|
||||
|
||||
|
@ -137,9 +143,15 @@ mmrw(dev, uio, flags)
|
|||
case 1:
|
||||
v = uio->uio_offset;
|
||||
c = min(iov->iov_len, MAXPHYS);
|
||||
#ifdef UVM
|
||||
if (!uvm_kernacc((caddr_t)v, c,
|
||||
uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
|
||||
return (EFAULT);
|
||||
#else
|
||||
if (!kernacc((caddr_t)v, c,
|
||||
uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
|
||||
return (EFAULT);
|
||||
#endif
|
||||
error = uiomove((caddr_t)v, c, uio);
|
||||
continue;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap_bootstrap.c,v 1.7 1997/12/06 20:29:59 scw Exp $ */
|
||||
/* $NetBSD: pmap_bootstrap.c,v 1.8 1998/02/21 19:03:27 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -45,7 +45,7 @@
|
|||
#include <machine/vmparam.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#ifdef MACHINE_NONCONTIG
|
||||
#ifdef MACHINE_NEW_NONCONTIG
|
||||
#include <mvme68k/mvme68k/seglist.h>
|
||||
#endif
|
||||
|
||||
|
@ -62,7 +62,7 @@ extern pt_entry_t *Sysptmap, *Sysmap;
|
|||
extern int maxmem, physmem;
|
||||
extern vm_offset_t avail_start, avail_end, virtual_avail, virtual_end;
|
||||
extern vm_size_t mem_size;
|
||||
#ifdef MACHINE_NONCONTIG
|
||||
#ifdef MACHINE_NEW_NONCONTIG
|
||||
extern vm_size_t avail_remaining;
|
||||
extern vm_offset_t avail_next;
|
||||
#endif
|
||||
|
@ -104,7 +104,7 @@ pmap_bootstrap(nextpa, firstpa)
|
|||
u_int nptpages, kstsize;
|
||||
register st_entry_t protoste, *ste;
|
||||
register pt_entry_t protopte, *pte, *epte;
|
||||
#ifdef MACHINE_NONCONTIG
|
||||
#ifdef MACHINE_NEW_NONCONTIG
|
||||
int i;
|
||||
#endif
|
||||
|
||||
|
@ -411,7 +411,7 @@ pmap_bootstrap(nextpa, firstpa)
|
|||
*/
|
||||
RELOC(avail_start, vm_offset_t) = nextpa;
|
||||
|
||||
#ifndef MACHINE_NONCONTIG
|
||||
#ifndef MACHINE_NEW_NONCONTIG
|
||||
RELOC(avail_end, vm_offset_t) =
|
||||
m68k_ptob(RELOC(maxmem, int))
|
||||
/* XXX allow for msgbuf */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: seglist.h,v 1.1 1997/10/09 21:45:05 scw Exp $ */
|
||||
/* $NetBSD: seglist.h,v 1.2 1998/02/21 19:03:27 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 The Steve Woodford
|
||||
|
@ -48,7 +48,7 @@ struct phys_seg_list_t {
|
|||
};
|
||||
|
||||
/* Space for onboard RAM, and one contiguous offboard segment */
|
||||
#define MAX_PHYS_SEGS 2
|
||||
#define MAX_PHYS_SEGS VM_PHYSSEG_MAX
|
||||
|
||||
/* Instantiated in pmap.c */
|
||||
extern struct phys_seg_list_t phys_seg_list[MAX_PHYS_SEGS];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: trap.c,v 1.14 1998/02/13 07:41:56 scottr Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.15 1998/02/21 19:03:27 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -42,6 +42,8 @@
|
|||
* @(#)trap.c 8.5 (Berkeley) 1/4/94
|
||||
*/
|
||||
|
||||
#include "opt_uvm.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
|
@ -64,6 +66,10 @@
|
|||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
|
||||
#if defined(UVM)
|
||||
#include <uvm/uvm_extern.h>
|
||||
#endif
|
||||
|
||||
#ifdef COMPAT_HPUX
|
||||
#include <compat/hpux/hpux.h>
|
||||
#endif
|
||||
|
@ -239,7 +245,11 @@ trap(type, code, v, frame)
|
|||
#endif
|
||||
int bit;
|
||||
|
||||
#if defined(UVM)
|
||||
uvmexp.traps++;
|
||||
#else
|
||||
cnt.v_trap++;
|
||||
#endif
|
||||
p = curproc;
|
||||
ucode = 0;
|
||||
if (USERMODE(frame.f_sr)) {
|
||||
|
@ -458,7 +468,11 @@ copyfault:
|
|||
while (bit = ffs(ssir)) {
|
||||
--bit;
|
||||
ssir &= ~(1 << bit);
|
||||
#if defined(UVM)
|
||||
uvmexp.softs++;
|
||||
#else
|
||||
cnt.v_soft++;
|
||||
#endif
|
||||
if (sir_routines[bit])
|
||||
sir_routines[bit](sir_args[bit]);
|
||||
}
|
||||
|
@ -467,7 +481,11 @@ copyfault:
|
|||
* If this was not an AST trap, we are all done.
|
||||
*/
|
||||
if (type != (T_ASTFLT|T_USER)) {
|
||||
#if defined(UVM)
|
||||
uvmexp.traps++;
|
||||
#else
|
||||
cnt.v_trap--;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
spl0();
|
||||
|
@ -532,18 +550,31 @@ copyfault:
|
|||
rv = pmap_mapmulti(map->pmap, va);
|
||||
if (rv != KERN_SUCCESS) {
|
||||
bva = HPMMBASEADDR(va);
|
||||
#if defined(UVM)
|
||||
rv = uvm_fault(map, bva, 0, ftype);
|
||||
#else
|
||||
rv = vm_fault(map, bva, ftype, FALSE);
|
||||
#endif
|
||||
if (rv == KERN_SUCCESS)
|
||||
(void) pmap_mapmulti(map->pmap, va);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#if defined(UVM)
|
||||
rv = uvm_fault(map, va, 0, ftype);
|
||||
#ifdef DEBUG
|
||||
if (rv && MDB_ISPID(p->p_pid))
|
||||
printf("uvm_fault(%p, 0x%lx, 0, 0x%x) -> 0x%x\n",
|
||||
map, va, ftype, rv);
|
||||
#endif
|
||||
#else /* ! UVM */
|
||||
rv = vm_fault(map, va, ftype, FALSE);
|
||||
#ifdef DEBUG
|
||||
if (rv && MDB_ISPID(p->p_pid))
|
||||
printf("vm_fault(%x, %x, %x, 0) -> %x\n",
|
||||
map, va, ftype, rv);
|
||||
#endif
|
||||
#endif /* UVM */
|
||||
/*
|
||||
* If this was a stack access we keep track of the maximum
|
||||
* accessed stack size. Also, if vm_fault gets a protection
|
||||
|
@ -574,8 +605,13 @@ copyfault:
|
|||
if (type == T_MMUFLT) {
|
||||
if (p->p_addr->u_pcb.pcb_onfault)
|
||||
goto copyfault;
|
||||
#if defined(UVM)
|
||||
printf("uvm_fault(%p, 0x%lx, 0, 0x%x) -> 0x%x\n",
|
||||
map, va, ftype, rv);
|
||||
#else
|
||||
printf("vm_fault(%x, %x, %x, 0) -> %x\n",
|
||||
map, va, ftype, rv);
|
||||
#endif
|
||||
printf(" type %x, code [mmu,,ssw]: %x\n",
|
||||
type, code);
|
||||
goto dopanic;
|
||||
|
@ -904,7 +940,11 @@ syscall(code, frame)
|
|||
register_t args[8], rval[2];
|
||||
u_quad_t sticks;
|
||||
|
||||
#if defined(UVM)
|
||||
uvmexp.syscalls++;
|
||||
#else
|
||||
cnt.v_syscall++;
|
||||
#endif
|
||||
if (!USERMODE(frame.f_sr))
|
||||
panic("syscall");
|
||||
p = curproc;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vm_machdep.c,v 1.10 1998/01/06 07:49:46 thorpej Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.11 1998/02/21 19:03:27 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -42,6 +42,8 @@
|
|||
* @(#)vm_machdep.c 8.6 (Berkeley) 1/12/94
|
||||
*/
|
||||
|
||||
#include "opt_uvm.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
|
@ -55,6 +57,10 @@
|
|||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
|
||||
#ifdef UVM
|
||||
#include <uvm/uvm_extern.h>
|
||||
#endif
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/pte.h>
|
||||
#include <machine/reg.h>
|
||||
|
@ -120,10 +126,18 @@ cpu_exit(p)
|
|||
struct proc *p;
|
||||
{
|
||||
|
||||
#ifdef UVM
|
||||
uvmspace_free(p->p_vmspace);
|
||||
#else
|
||||
vmspace_free(p->p_vmspace);
|
||||
#endif
|
||||
|
||||
(void) splhigh();
|
||||
#ifdef UVM
|
||||
uvmexp.swtch++;
|
||||
#else
|
||||
cnt.v_swtch++;
|
||||
#endif
|
||||
switch_exit(p);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -280,7 +294,11 @@ iomap(paddr, size)
|
|||
size = m68k_round_page(size);
|
||||
|
||||
/* Get some kernel virtual space. */
|
||||
#ifdef UVM
|
||||
va = uvm_km_alloc(kernel_map, size);
|
||||
#else
|
||||
va = kmem_alloc_pageable(kernel_map, size);
|
||||
#endif
|
||||
if (va == 0)
|
||||
return (NULL);
|
||||
rval = va + off;
|
||||
|
@ -302,7 +320,11 @@ iounmap(kva, size)
|
|||
size = m68k_round_page(size);
|
||||
|
||||
physunaccess((caddr_t)va, size);
|
||||
#ifdef UVM
|
||||
uvm_km_free(kernel_map, va, size);
|
||||
#else
|
||||
kmem_free(kernel_map, va, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -364,7 +386,11 @@ vmapbuf(bp, len)
|
|||
uva = m68k_trunc_page(bp->b_saveaddr = bp->b_data);
|
||||
off = (vm_offset_t)bp->b_data - uva;
|
||||
len = m68k_round_page(off + len);
|
||||
#ifdef UVM
|
||||
kva = uvm_km_valloc_wait(phys_map, len);
|
||||
#else
|
||||
kva = kmem_alloc_wait(phys_map, len);
|
||||
#endif
|
||||
bp->b_data = (caddr_t)(kva + off);
|
||||
|
||||
upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
|
||||
|
@ -402,7 +428,11 @@ vunmapbuf(bp, len)
|
|||
* pmap_remove() is unnecessary here, as kmem_free_wakeup()
|
||||
* will do it for us.
|
||||
*/
|
||||
#ifdef UVM
|
||||
uvm_km_free_wakeup(phys_map, kva, len);
|
||||
#else
|
||||
kmem_free_wakeup(phys_map, kva, len);
|
||||
#endif
|
||||
bp->b_data = bp->b_saveaddr;
|
||||
bp->b_saveaddr = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue