Merge in UVM support from Neil Carson <neil@causality.com>.

This commit is contained in:
mark 1998-06-02 20:41:46 +00:00
parent 0618ed7122
commit bdfeab3714
30 changed files with 799 additions and 565 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ast.c,v 1.13 1998/05/08 23:24:08 mark Exp $ */
/* $NetBSD: ast.c,v 1.14 1998/06/02 20:41:46 mark Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe
@ -40,6 +40,8 @@
* Created : 11/10/94
*/
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/user.h>
@ -54,6 +56,12 @@
#include <machine/cpufunc.h>
#include <machine/psl.h>
#if defined(UVM)
/*#include <sys/types.h>*/
#include <vm/vm.h>
#include <uvm/uvm_extern.h>
#endif
int want_resched = 0;
void
@ -150,7 +158,13 @@ ast(frame)
{
struct proc *p = curproc;
#if defined(UVM)
uvmexp.traps++;
uvmexp.softs++;
#else
cnt.v_trap++;
cnt.v_soft++;
#endif
#ifdef DIAGNOSTIC
if (p == NULL) {
@ -161,7 +175,6 @@ ast(frame)
panic("ast: nopcb!");
#endif
cnt.v_soft++;
if (p->p_flag & P_OWEUPC) {
p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.2 1998/06/01 22:47:27 mark Exp $ */
/* $NetBSD: bus_dma.c,v 1.3 1998/06/02 20:41:47 mark Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -37,6 +37,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -55,6 +56,10 @@
#include <vm/vm_kern.h>
#include <vm/vm_page.h>
#ifdef UVM
#include <uvm/uvm_extern.h>
#endif
#define _ARM32_BUS_DMA_PRIVATE
#include <machine/bus.h>
@ -422,8 +427,11 @@ _bus_dmamem_free(t, segs, nsegs)
TAILQ_INSERT_TAIL(&mlist, m, pageq);
}
}
#if defined(UVM)
uvm_pglistfree(&mlist);
#else
vm_page_free_memory(&mlist);
#endif
}
/*
@ -449,7 +457,12 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
#endif /* DEBUG_DMA */
size = round_page(size);
#if defined(UVM)
va = uvm_km_valloc(kernel_map, size);
#else
va = kmem_alloc_pageable(kmem_map, size);
#endif
if (va == 0)
return (ENOMEM);
@ -518,7 +531,11 @@ _bus_dmamem_unmap(t, kva, size)
#endif /* DIAGNOSTIC */
size = round_page(size);
#if defined(UVM)
uvm_km_free(kernel_map, (vm_offset_t)kva, size);
#else
kmem_free(kmem_map, (vm_offset_t)kva, size);
#endif
}
/*
@ -691,8 +708,13 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
* Allocate pages from the VM system.
*/
TAILQ_INIT(&mlist);
#if defined(UVM)
error = uvm_pglistalloc(size, low, high, alignment, boundary,
&mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
#else
error = vm_page_alloc_memory(size, low, high,
alignment, boundary, &mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
#endif
if (error)
return (error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpuswitch.S,v 1.23 1998/04/30 21:22:00 mark Exp $ */
/* $NetBSD: cpuswitch.S,v 1.24 1998/06/02 20:41:47 mark Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -43,6 +43,7 @@
* Created : 15/10/94
*/
#include "opt_uvm.h"
#include "assym.h"
#include <machine/param.h>
#include <machine/cpu.h>
@ -650,7 +651,11 @@ Lse_context_switched:
* pmap gets released in vmspace_free()
*/
ldr r0, [r3, #(P_VMSPACE)]
#if defined(UVM)
bl _uvmspace_free
#else
bl _vmspace_free
#endif
/* This has to be done here */
mov r2, #(UPAGES << PGSHIFT)
@ -658,7 +663,11 @@ Lse_context_switched:
ldr r1, [r0, #(P_ADDR)]
ldr r0, Lkernel_map
ldr r0, [r0]
#if defined(UVM)
bl _uvm_km_free
#else
bl _kmem_free
#endif
/* Paranoia */
mov r0, #0x00000000

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_machdep.c,v 1.8 1998/02/21 02:42:42 mark Exp $ */
/* $NetBSD: db_machdep.c,v 1.9 1998/06/02 20:41:47 mark Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/vnode.h>
@ -99,7 +100,6 @@ db_show_vnode_cmd(addr, have_addr, count, modif)
}
}
void
db_show_vmstat_cmd(addr, have_addr, count, modif)
db_expr_t addr;
@ -107,6 +107,7 @@ db_show_vmstat_cmd(addr, have_addr, count, modif)
db_expr_t count;
char *modif;
{
#if !defined(UVM)
struct vmmeter sum;
sum = cnt;
@ -141,6 +142,50 @@ db_show_vmstat_cmd(addr, have_addr, count, modif)
db_printf("%9u pages active\n", sum.v_active_count);
db_printf("%9u pages inactive\n", sum.v_inactive_count);
db_printf("%9u bytes per page\n", sum.v_page_size);
#else
db_printf("Current UVM status:\n");
db_printf(" pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d\n",
uvmexp.pagesize, uvmexp.pagesize, uvmexp.pagemask,
uvmexp.pageshift);
db_printf(" %d VM pages: %d active, %d inactive, %d wired, %d free\n",
uvmexp.npages, uvmexp.active, uvmexp.inactive, uvmexp.wired,
uvmexp.free);
db_printf(" freemin=%d, free-target=%d, inactive-target=%d, "
"wired-max=%d\n", uvmexp.freemin, uvmexp.freetarg, uvmexp.inactarg,
uvmexp.wiredmax);
db_printf(" faults=%d, traps=%d, intrs=%d, ctxswitch=%d\n",
uvmexp.faults, uvmexp.traps, uvmexp.intrs, uvmexp.swtch);
db_printf(" softint=%d, syscalls=%d, swapins=%d, swapouts=%d\n",
uvmexp.softs, uvmexp.syscalls, uvmexp.swapins, uvmexp.swapouts);
db_printf(" fault counts:\n");
db_printf(" noram=%d, noanon=%d, pgwait=%d, pgrele=%d\n",
uvmexp.fltnoram, uvmexp.fltnoanon, uvmexp.fltpgwait,
uvmexp.fltpgrele);
db_printf(" ok relocks(total)=%d(%d), anget(retrys)=%d(%d), "
"amapcopy=%d\n", uvmexp.fltrelckok, uvmexp.fltrelck,
uvmexp.fltanget, uvmexp.fltanretry, uvmexp.fltamcopy);
db_printf(" neighbor anon/obj pg=%d/%d, gets(lock/unlock)=%d/%d\n",
uvmexp.fltnamap, uvmexp.fltnomap, uvmexp.fltlget, uvmexp.fltget);
db_printf(" cases: anon=%d, anoncow=%d, obj=%d, prcopy=%d, przero=%d\n",
uvmexp.flt_anon, uvmexp.flt_acow, uvmexp.flt_obj, uvmexp.flt_prcopy,
uvmexp.flt_przero);
db_printf(" daemon and swap counts:\n");
db_printf(" woke=%d, revs=%d, scans=%d, swout=%d\n", uvmexp.pdwoke,
uvmexp.pdrevs, uvmexp.pdscans, uvmexp.pdswout);
db_printf(" busy=%d, freed=%d, reactivate=%d, deactivate=%d\n",
uvmexp.pdbusy, uvmexp.pdfreed, uvmexp.pdreact, uvmexp.pddeact);
db_printf(" pageouts=%d, pending=%d, nswget=%d\n", uvmexp.pdpageouts,
uvmexp.pdpending, uvmexp.nswget);
db_printf(" nswapdev=%d, nanon=%d, nfreeanon=%d\n", uvmexp.nswapdev,
uvmexp.nanon, uvmexp.nfreeanon);
db_printf(" kernel pointers:\n");
db_printf(" objs(kmem/mb)=%p/%p\n", uvmexp.kmem_object,
uvmexp.mb_object);
#endif
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: fault.c,v 1.23 1998/05/01 15:44:51 mark Exp $ */
/* $NetBSD: fault.c,v 1.24 1998/06/02 20:41:48 mark Exp $ */
/*
* Copyright (c) 1994-1997 Mark Brinicombe.
@ -43,6 +43,7 @@
* Created : 28/11/94
*/
#include "opt_uvm.h"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -53,6 +54,10 @@
#include <vm/vm.h>
#include <vm/vm_kern.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <machine/frame.h>
#include <machine/katelib.h>
#include <machine/cpu.h>
@ -149,7 +154,11 @@ data_abort_handler(frame)
enable_interrupts(I32_bit);
/* Update vmmeter statistics */
#if defined(UVM)
uvmexp.traps++;
#else
cnt.v_trap++;
#endif
/* Get fault address and status from the CPU */
fault_address = cpu_faultaddress();
@ -431,7 +440,11 @@ copyfault:
goto out;
else {
/* The page must be mapped to cause a permission fault. */
#if defined(UVM)
rv = uvm_fault(map, va, 0, ftype);
#else
rv = vm_fault(map, va, ftype, FALSE);
#endif
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("fault result=%d\n", rv);
@ -536,7 +549,11 @@ copyfault:
}
}
#if defined(UVM)
rv = uvm_fault(map, va, 0, ftype);
#else
rv = vm_fault(map, va, ftype, FALSE);
#endif
if (rv == KERN_SUCCESS) {
if (nss > vm->vm_ssize)
vm->vm_ssize = nss;
@ -549,7 +566,7 @@ nogo:
printf("Failed page fault in kernel\n");
if (pcb->pcb_onfault)
goto copyfault;
printf("vm_fault(%p, %lx, %x, 0) -> %x\n",
printf("[u]vm_fault(%p, %lx, %x, 0) -> %x\n",
map, va, ftype, rv);
goto we_re_toast;
}
@ -617,7 +634,11 @@ nogo:
#endif
ftype = VM_PROT_READ;
#if defined(UVM)
rv = uvm_fault(map, va, 0, ftype);
#else
rv = vm_fault(map, va, ftype, FALSE);
#endif
if (rv == KERN_SUCCESS) {
if (nss > vm->vm_ssize)
vm->vm_ssize = nss;
@ -631,7 +652,7 @@ nogo1:
printf("Section fault in SVC mode\n");
if (pcb->pcb_onfault)
goto copyfault;
printf("vm_fault(%p, %lx, %x, 0) -> %x\n",
printf("[u]vm_fault(%p, %lx, %x, 0) -> %x\n",
map, va, ftype, rv);
goto we_re_toast;
}
@ -689,7 +710,11 @@ prefetch_abort_handler(frame)
enable_interrupts(I32_bit);
/* Update vmmeter statistics */
#if defined(UVM)
uvmexp.traps++;
#else
cnt.v_trap++;
#endif
/* Call the cpu specific abort fixup routine */
error = cpu_prefetchabt_fixup(frame);

View File

@ -1,4 +1,4 @@
/* $NetBSD: genassym.c,v 1.12 1997/10/06 00:47:34 mark Exp $ */
/* $NetBSD: genassym.c,v 1.13 1998/06/02 20:41:48 mark Exp $ */
/*-
* Copyright (c) 1982, 1990 The Regents of the University of California.
@ -36,6 +36,8 @@
* SUCH DAMAGE.
*/
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
@ -46,6 +48,10 @@
#include <vm/vm.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <machine/pmap.h>
#include <machine/frame.h>
#include <machine/vmparam.h>
@ -57,7 +63,11 @@ int
main()
{
struct proc *p = 0;
#if defined(UVM)
struct uvmexp *uvme = 0;
#else
struct vmmeter *vm = 0;
#endif
struct pcb *pcb = 0;
struct trapframe *tf = 0;
struct sigframe *sigf = 0;
@ -115,9 +125,15 @@ main()
def("USER_SIZE", sizeof(struct user));
#if defined(UVM)
def("V_TRAP", &uvme->traps);
def("V_INTR", &uvme->intrs);
def("V_SOFT", &uvme->softs);
#else
def("V_TRAP", &vm->v_trap);
def("V_INTR", &vm->v_intr);
def("V_SOFT", &vm->v_soft);
#endif
def("VM_MAP", &vms->vm_map);
def("VM_PMAP", &vms->vm_map.pmap);

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.4 1998/02/21 23:21:28 mark Exp $ */
/* $NetBSD: intr.c,v 1.5 1998/06/02 20:41:48 mark Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -33,16 +33,9 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* RiscBSD kernel project
*
* irqhandler.c
*
* IRQ/FIQ initialisation, claim, release and handler routines
*
* Created : 30/09/94
*/
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/syslog.h>
@ -50,6 +43,10 @@
#include <vm/vm.h>
#include <net/netisr.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <machine/irqhandler.h>
#include <machine/cpu.h>
@ -126,7 +123,11 @@ dosoftints()
*/
if (softints & IRQMASK_SOFTCLOCK) {
++cnt.v_soft;
#if defined(UVM)
++uvmexp.softs;
#else
++cnt.v_soft;
#endif
#ifdef IRQSTATS
++intrcnt[IRQ_SOFTCLOCK];
#endif /* IRQSTATS */
@ -139,7 +140,11 @@ dosoftints()
*/
if (softints & IRQMASK_SOFTNET) {
++cnt.v_soft;
#if defined(UVM)
++uvmexp.softs;
#else
++cnt.v_soft;
#endif
#ifdef IRQSTATS
++intrcnt[IRQ_SOFTNET];
#endif /* IRQSTATS */

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.24 1998/05/08 23:25:31 mark Exp $ */
/* $NetBSD: locore.S,v 1.25 1998/06/02 20:41:48 mark Exp $ */
/*
* Copyright (C) 1994-1997 Mark Brinicombe
@ -31,13 +31,15 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "opt_uvm.h"
#include "ipkdb.h"
#include "assym.h"
#include <sys/syscall.h>
#include <sys/errno.h>
#include <machine/asm.h>
#include <machine/cpu.h>
#include <machine/frame.h>
#include <machine/param.h>
#include <sys/syscall.h>
/* What size should this really be ? It is only used by init_arm() */
#define INIT_ARM_STACK_SIZE 2048
@ -515,4 +517,42 @@ ENTRY(atomic_clear_bit)
msr cpsr_all, r2
mov pc, lr
#if defined(UVM)
/*
* kcopy(caddr_t from, caddr_t to, size_t len);
*
* Copy len bytes, abort on fault.
*/
Lcurpcb:
.word _curpcb
ENTRY(kcopy)
teq r2, #0x00000000
moveq r0, #0x00000000
moveq pc, lr
stmfd sp!, {r4, lr}
ldr r4, Lcurpcb
ldr r4, [r4]
add r3, pc, #Lkcopyfault - . - 8
str r3, [r4, #PCB_ONFAULT]
Lkcopy_loop:
ldrb r3, [r0], #0x0001
strb r3, [r1], #0x0001
subs r2, r2, #1
bne Lkcopy_loop
mov r0, #0x00000000
str r0, [r4, #PCB_ONFAULT]
ldmfd sp!, {r4, pc}
Lkcopyfault:
mov r0, #0x00000000
str r0, [r4, #PCB_ONFAULT]
mov r0, #EFAULT
ldmfd sp!, {r4, pc}
#endif
/* End of locore.S */

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.35 1998/05/08 16:55:15 kleink Exp $ */
/* $NetBSD: machdep.c,v 1.36 1998/06/02 20:41:49 mark Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -45,6 +45,8 @@
* Created : 17/09/94
*/
#include "opt_uvm.h"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -83,6 +85,10 @@
#include <vm/vm_kern.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <machine/signal.h>
#include <machine/frame.h>
#include <machine/cpu.h>
@ -94,15 +100,19 @@
#include "ipkdb.h"
#include "md.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 int physmem;
#ifndef PMAP_STATIC_L1S
extern int max_processes;
#endif /* !PMAP_STATIC_L1S */
#if 0
extern int cpu_cache;
int cpu_ctrl;
#endif
#if NMD > 0 && defined(MEMORY_DISK_HOOKS) && !defined(MINIROOTSIZE)
extern u_int memory_disc_size; /* Memory disc size */
#endif /* NMD && MEMORY_DISK_HOOKS && !MINIROOTSIZE */
@ -386,16 +396,18 @@ cpu_startup()
* not be buffered).
*/
printf(version);
printf("real mem = %d (%d pages)\n", arm_page_to_byte(physmem), physmem);
/*
* Find out how much space we need, allocate it,
* and then give everything true virtual addresses.
*/
size = allocsys((caddr_t)0);
#if defined(UVM)
sysbase = (caddr_t)uvm_km_zalloc(kernel_map, round_page(size));
#else
sysbase = (caddr_t)kmem_alloc(kernel_map, round_page(size));
#endif
if (sysbase == 0)
panic("cpu_startup: no room for system tables %d bytes required", (u_int)size);
if ((caddr_t)((allocsys(sysbase) - sysbase)) != size)
@ -405,16 +417,24 @@ cpu_startup()
* Now allocate buffers proper. They are different than the above
* in that they usually occupy more virtual memory than physical.
*/
bufsize = MAXBSIZE * nbuf;
printf("cpu_startup: buffer VM size = %ld\n", bufsize);
#if defined(UVM)
if (uvm_map(kernel_map, (vm_offset_t *)&buffers, round_page(bufsize),
NULL, UVM_UNKNOWN_OFFSET,
UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
UVM_ADV_NORMAL, 0)) != KERN_SUCCESS)
panic("cpu_startup: cannot allocate UVM space for buffers");
minaddr = (vm_offset_t)buffers;
#else
buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,
&maxaddr, bufsize, TRUE);
minaddr = (vm_offset_t)buffers;
if (vm_map_find(buffer_map, vm_object_allocate(bufsize),
(vm_offset_t)0, &minaddr, bufsize, FALSE) != KERN_SUCCESS)
panic("startup: cannot allocate buffers");
panic("cpu_startup: cannot allocate buffers");
#endif
printf("cpu_startup: buffer VM base=%p size = %ld\n", buffers, bufsize);
if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
/* don't want to alloc more physical mem than needed */
@ -424,6 +444,23 @@ cpu_startup()
base = bufpages / nbuf;
residual = bufpages % nbuf;
for (loop = 0; loop < nbuf; ++loop) {
#if defined(UVM)
vm_size_t curbufsize;
vm_offset_t curbuf;
struct vm_page *pg;
curbuf = (vm_offset_t) buffers + (loop * MAXBSIZE);
curbufsize = CLBYTES * ((loop < residual) ? (base+1) : base);
while (curbufsize) {
if ((pg = uvm_pagealloc(NULL, 0, NULL)) == NULL)
panic("cpu_startup: More RAM needed for buffer cache");
pmap_enter(kernel_map->pmap, curbuf,
VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, TRUE);
curbuf += PAGE_SIZE;
curbufsize -= PAGE_SIZE;
}
#else
vm_size_t curbufsize;
vm_offset_t curbuf;
@ -439,26 +476,42 @@ cpu_startup()
curbufsize = CLBYTES * (loop < residual ? base+1 : base);
vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
vm_map_simplify(buffer_map, curbuf);
#endif
}
/*
* 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
/*
* Initialise callouts
@ -468,8 +521,12 @@ cpu_startup()
for (loop = 1; loop < ncallout; ++loop)
callout[loop - 1].c_next = &callout[loop];
printf("avail mem = %d (%d pages)\n", (int)ptoa(cnt.v_free_count),
(int)ptoa(cnt.v_free_count) / NBPG);
#if defined(UVM)
printf("Available memory = %ld\n", ptoa(uvmexp.free - bufpages));
#else
printf("avail mem = %ld (%ld pages)\n", ptoa(cnt.v_free_count),
ptoa(cnt.v_free_count) / NBPG);
#endif
printf("using %d buffers containing %d bytes of memory\n",
nbuf, bufpages * CLBYTES);
@ -578,8 +635,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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.5 1998/05/07 21:01:42 kleink Exp $ */
/* $NetBSD: mem.c,v 1.6 1998/06/02 20:41:50 mark Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -42,6 +42,7 @@
* Memory special file
*/
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/buf.h>
@ -54,6 +55,9 @@
#include <machine/cpu.h>
#include <vm/vm.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
extern char *memhook; /* poor name! */
caddr_t zeropage;
@ -133,9 +137,15 @@ mmrw(dev, uio, flags)
case 1:
v = uio->uio_offset;
c = min(iov->iov_len, MAXPHYS);
#if defined(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

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.12 1998/04/19 22:43:27 mark Exp $ */
/* $NetBSD: syscall.c,v 1.13 1998/06/02 20:41:51 mark Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
@ -43,6 +43,7 @@
* Created : 09/11/94
*/
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/filedesc.h>
#include <sys/errno.h>
@ -63,12 +64,17 @@
#include <sys/user.h>
#include <sys/syscall.h>
#include <sys/syscallargs.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
#ifdef KTRACE
#include <sys/ktrace.h>
#endif
#include <vm/vm.h>
#include <vm/vm_kern.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <machine/cpu.h>
#include <machine/frame.h>
#include <machine/katelib.h>
@ -133,7 +139,11 @@ syscall(frame, code)
u_quad_t sticks;
int regparams;
#if defined(UVM)
uvmexp.syscalls++;
#else
cnt.v_syscall++;
#endif
/*
* Trap SWI instructions executed in non-USR32 mode
@ -286,11 +296,19 @@ syscall(frame, code)
SYSCALL_SPECIAL_RETURN;
break;
case 0x1017:
#if defined(UVM)
frame->tf_r0 = uvm_km_zalloc(kernel_map, round_page(frame->tf_r0));
#else
frame->tf_r0 = kmem_alloc(kernel_map, round_page(frame->tf_r0));
#endif
SYSCALL_SPECIAL_RETURN;
break;
case 0x1018:
#if defined(UVM)
uvm_km_free(kernel_map, frame->tf_r0, frame->tf_r1);
#else
kmem_free(kernel_map, frame->tf_r0, frame->tf_r1);
#endif
SYSCALL_SPECIAL_RETURN;
break;
#endif /* NHYDRABUS */

View File

@ -1,4 +1,4 @@
/* $NetBSD: undefined.c,v 1.11 1998/04/19 22:43:27 mark Exp $ */
/* $NetBSD: undefined.c,v 1.12 1998/06/02 20:41:51 mark Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe.
@ -45,6 +45,7 @@
#define FAST_FPE
#include "opt_uvm.h"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -57,6 +58,11 @@
#include <sys/acct.h>
#endif
#if defined(UVM)
#include <vm/vm.h>
#include <uvm/uvm_extern.h>
#endif
#include <machine/cpu.h>
#include <machine/frame.h>
#include <machine/katelib.h>
@ -132,8 +138,12 @@ undefinedinstruction(frame)
enable_interrupts(I32_bit);
/* Update vmmeter statistics */
#if defined(UVM)
uvmexp.traps++;
#else
cnt.v_trap++;
#endif
fault_pc = frame->tf_pc - INSN_SIZE;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.23 1998/06/02 14:34:55 mark Exp $ */
/* $NetBSD: vm_machdep.c,v 1.24 1998/06/02 20:41:51 mark Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -43,6 +43,8 @@
* Created : 08/10/94
*/
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
@ -57,6 +59,10 @@
#include <vm/vm.h>
#include <vm/vm_kern.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <machine/cpu.h>
#include <machine/pmap.h>
#include <machine/reg.h>
@ -191,8 +197,9 @@ cpu_set_kpc(p, pc)
*
* We clean up a little and then call switch_exit() with the old proc as an
* argument. switch_exit() first switches to proc0's context, then does the
* vmspace_free() and kmem_free() that we don't do here, and finally jumps
* into switch() to wait for another process to wake up.
* vmspace_free() and kmem_free() (or their UVM counterparts) that we don't
* do here, and finally jumps into switch() to wait for another process
* to wake up.
*/
void
@ -221,8 +228,11 @@ cpu_exit(p)
log(LOG_INFO, "%d bytes of svc stack fill pattern\n", loop);
}
#endif /* STACKCHECKS */
#if defined(UVM)
uvmexp.swtch++;
#else
cnt.v_swtch++;
#endif
switch_exit(p, &proc0);
}
@ -342,7 +352,11 @@ vmapbuf(bp, len)
faddr = trunc_page(bp->b_saveaddr = bp->b_data);
off = (vm_offset_t)bp->b_data - faddr;
len = round_page(off + len);
#if defined(UVM)
taddr = uvm_km_valloc_wait(phys_map, len);
#else
taddr = kmem_alloc_wait(phys_map, len);
#endif
bp->b_data = (caddr_t)(taddr + off);
/*
@ -398,7 +412,11 @@ vunmapbuf(bp, len)
addr = trunc_page(bp->b_data);
off = (vm_offset_t)bp->b_data - addr;
len = round_page(off + len);
#if defined(UVM)
uvm_km_free_wakeup(phys_map, addr, len);
#else
kmem_free_wakeup(phys_map, addr, len);
#endif
bp->b_data = bp->b_saveaddr;
bp->b_saveaddr = 0;

View File

@ -1,4 +1,4 @@
# $NetBSD: A7000,v 1.21 1998/05/08 23:40:20 mark Exp $
# $NetBSD: A7000,v 1.22 1998/06/02 20:41:52 mark Exp $
#
# A7000 - Full A7000 configuration
#
@ -16,7 +16,7 @@ options SWAPPAGER # paging; REQUIRED
options VNODEPAGER # mmap() of files
options DEVPAGER # mmap() of devices
#options NTP # NTP phase/frequency locked loop
#options MACHINE_NEW_NONCONTIG
#options UVM # Use UVM instead of Mach VM.
# CPU options

View File

@ -1,4 +1,4 @@
# $NetBSD: A7INST,v 1.11 1998/05/08 23:40:20 mark Exp $
# $NetBSD: A7INST,v 1.12 1998/06/02 20:41:52 mark Exp $
#
# A7INST - A7000 install configuration
#
@ -16,7 +16,7 @@ options SWAPPAGER # paging; REQUIRED
options VNODEPAGER # mmap() of files
options DEVPAGER # mmap() of devices
#options NTP # NTP phase/frequency locked loop
#options MACHINE_NEW_NONCONTIG
#options UVM # Use UVM instead of Mach VM.
# CPU options

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.38 1998/05/08 23:40:21 mark Exp $
# $NetBSD: GENERIC,v 1.39 1998/06/02 20:41:52 mark Exp $
#
# GENERIC -- everything that's currently supported
#
@ -16,7 +16,7 @@ options SWAPPAGER # paging; REQUIRED
options VNODEPAGER # mmap() of files
options DEVPAGER # mmap() of devices
#options NTP # NTP phase/frequency locked loop
#options MACHINE_NEW_NONCONTIG
#options UVM # Use UVM instead of Mach VM.
# CPU options

View File

@ -1,4 +1,4 @@
# $NetBSD: RC7500,v 1.16 1998/05/08 23:40:21 mark Exp $
# $NetBSD: RC7500,v 1.17 1998/06/02 20:41:52 mark Exp $
#
# RC7500 - Config for the VLSI RC7500 board
#
@ -19,7 +19,7 @@ options SWAPPAGER # paging; REQUIRED
options VNODEPAGER # mmap() of files
options DEVPAGER # mmap() of devices
#options NTP # NTP phase/frequency locked loop
#options MACHINE_NEW_NONCONTIG
#options UVM # Use UVM instead of Mach VM.
# CPU options

View File

@ -1,4 +1,4 @@
# $NetBSD: RISCPC,v 1.10 1998/05/08 23:40:21 mark Exp $
# $NetBSD: RISCPC,v 1.11 1998/06/02 20:41:53 mark Exp $
#
# RISCPC -- Full RiscPC config
#
@ -16,7 +16,7 @@ options SWAPPAGER # paging; REQUIRED
options VNODEPAGER # mmap() of files
options DEVPAGER # mmap() of devices
#options NTP # NTP phase/frequency locked loop
#options MACHINE_NEW_NONCONTIG
#options UVM # Use UVM instead of Mach VM.
# CPU options

View File

@ -1,4 +1,4 @@
# $NetBSD: RPCINST,v 1.10 1998/05/08 23:40:21 mark Exp $
# $NetBSD: RPCINST,v 1.11 1998/06/02 20:41:53 mark Exp $
#
# RPCINST -- RiscPC install configuration
#
@ -16,7 +16,7 @@ options SWAPPAGER # paging; REQUIRED
options VNODEPAGER # mmap() of files
options DEVPAGER # mmap() of devices
#options NTP # NTP phase/frequency locked loop
#options MACHINE_NEW_NONCONTIG
#options UVM # Use UVM instead of Mach VM.
# CPU options

View File

@ -1,4 +1,4 @@
# $NetBSD: VOYAGER,v 1.32 1998/05/08 23:40:22 mark Exp $
# $NetBSD: VOYAGER,v 1.33 1998/06/02 20:41:53 mark Exp $
#
# VOYAGER - Mark's development kernel
#
@ -16,7 +16,7 @@ options SWAPPAGER # paging; REQUIRED
options VNODEPAGER # mmap() of files
options DEVPAGER # mmap() of devices
#options NTP # NTP phase/frequency locked loop
#options MACHINE_NEW_NONCONTIG
#options UVM # Use UVM instead of Mach VM.
# CPU options

View File

@ -1,4 +1,4 @@
/* $NetBSD: md_hooks.c,v 1.10 1997/10/14 11:32:47 mark Exp $ */
/* $NetBSD: md_hooks.c,v 1.11 1998/06/02 20:41:53 mark Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross
@ -27,6 +27,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/device.h>
@ -36,6 +37,10 @@
#include <vm/vm_map.h>
#include <vm/vm_kern.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <dev/md.h>
#ifdef MINIROOTSIZE
@ -76,7 +81,11 @@ md_attach_hook(unit, md)
#endif /* MEMORY_DISK_SIZE */
if (memory_disc_size != 0) {
md->md_size = round_page(memory_disc_size);
#if defined(UVM)
md->md_addr = (caddr_t)uvm_km_zalloc(kernel_map, memory_disc_size);
#else
md->md_addr = (caddr_t)kmem_alloc(kernel_map, memory_disc_size);
#endif
md->md_type = MD_KMEM_FIXED;
bootmd = md;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.11 1998/02/18 02:05:33 cgd Exp $ */
/* $NetBSD: pmap.h,v 1.12 1998/06/02 20:41:54 mark Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
@ -14,22 +14,20 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the RiscBSD team.
* 4. The name "RiscBSD" nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
* This product includes software developed by Mark Brinicombe
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ARM32_PMAP_H_
@ -39,30 +37,25 @@
#include <machine/pte.h>
/*
* virtual address to page table entry and
* to physical address.
* Data structures used by pmap
*/
#define vtopte(va) \
((pt_entry_t *)(PROCESS_PAGE_TBLS_BASE + (arm_byte_to_page((unsigned int)(va)) << 2)))
#define vtophys(va) \
((*vtopte(va) & PG_FRAME) | ((unsigned int)(va) & ~PG_FRAME))
/* Structure that describes a Level 1 page table */
/*
* Structure that describes a Level 1 page table and the flags
* associated with it.
*/
struct l1pt {
SIMPLEQ_ENTRY(l1pt) pt_queue; /* Queue pointers */
struct pglist pt_plist; /* Allocated page list */
vm_offset_t pt_va; /* Allocated virtual address */
int pt_flags; /* Flags */
int pt_flags; /* Flags */
};
#define PTFLAG_STATIC 1 /* Statically allocated */
#define PTFLAG_KPT 2 /* Kernel pt's are mapped */
#define PTFLAG_CLEAN 4 /* L1 is clean */
};
/*
* Pmap stuff
* The pmap structure itself.
*/
struct pmap {
pd_entry_t *pm_pdir; /* KVA of page directory */
@ -70,7 +63,6 @@ struct pmap {
void *pm_unused1; /* Reserved for l2 map */
vm_offset_t pm_pptpt; /* PA of pt's page table */
vm_offset_t pm_vptpt; /* VA of pt's page table */
/* boolean_t pm_pdchanged;*/ /* pdir changed */
short pm_dref; /* page directory ref count */
short pm_count; /* pmap reference count */
simple_lock_data_t pm_lock; /* lock on pmap */
@ -79,21 +71,10 @@ struct pmap {
typedef struct pmap *pmap_t;
/*
* For speed we store the both the virtual address and the page table
* entry address for each page hook.
*/
typedef struct {
vm_offset_t va;
pt_entry_t *pte;
} pagehook_t;
/*
* For each vm_page_t, there is a list of all currently valid virtual
* mappings of that page. An entry is a pv_entry_t, the list is pv_table.
*/
typedef struct pv_entry {
struct pv_entry *pv_next; /* next pv_entry */
pmap_t pv_pmap; /* pmap where mapping lies */
@ -101,6 +82,10 @@ typedef struct pv_entry {
int pv_flags; /* flags */
} *pv_entry_t;
/*
* A pv_page_info struture looks like this. It is used to contain status
* information for pv_entry freelists.
*/
struct pv_page;
struct pv_page_info {
@ -110,10 +95,12 @@ struct pv_page_info {
};
/*
* This is basically:
* ((NBPG - sizeof(struct pv_page_info)) / sizeof(struct pv_entry))
* A pv_page itself looks like this. pv_entries are requested from the VM a
* pv_page at a time.
*
* We also define a macro that states the number of pv_entries per page
* allocated.
*/
#define NPVPPG ((NBPG - sizeof(struct pv_page_info)) / sizeof(struct pv_entry))
struct pv_page {
@ -121,28 +108,68 @@ struct pv_page {
struct pv_entry pvp_pv[NPVPPG];
};
#ifdef _KERNEL
pv_entry_t pv_table; /* array of entries, one per page */
extern pmap_t kernel_pmap;
extern struct pmap kernel_pmap_store;
/*
* Page hooks. I'll eliminate these sometime soon :-)
*
* For speed we store the both the virtual address and the page table
* entry address for each page hook.
*/
typedef struct {
vm_offset_t va;
pt_entry_t *pte;
} pagehook_t;
#define pmap_kernel() (&kernel_pmap_store)
#define pmap_update() cpu_tlb_flushID()
/*
* _KERNEL specific macros, functions and prototypes
*/
#ifdef _KERNEL
/*
* Commonly referenced structures
*/
extern pv_entry_t pv_table; /* Phys to virt mappings, per page. */
extern pmap_t kernel_pmap; /* pmap pointer used for the kernel */
extern struct pmap kernel_pmap_store; /* kernel_pmap points to this */
/*
* Macros that we need to export
*/
#define pmap_kernel() (&kernel_pmap_store)
#define pmap_update() cpu_tlb_flushID()
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
boolean_t pmap_testbit __P((vm_offset_t, int));
void pmap_changebit __P((vm_offset_t, int, int));
#define pmap_phys_address(ppn) (arm_page_to_byte((ppn)))
static __inline vm_offset_t
pmap_phys_address(int ppn)
{
return(arm_page_to_byte(ppn));
}
vm_offset_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int));
/*
* Functions that we need to export
*/
extern boolean_t pmap_testbit __P((vm_offset_t, int));
extern void pmap_changebit __P((vm_offset_t, int, int));
extern vm_offset_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int));
#endif /* _KERNEL */
#endif /* _ARM32_PMAP_H_ */
/*
* Useful macros and constants
*/
/* End of pmap.h */
/* Virtual address to page table entry */
#define vtopte(va) \
((pt_entry_t *)(PROCESS_PAGE_TBLS_BASE + \
(arm_byte_to_page((unsigned int)(va)) << 2)))
/* Virtual address to physical address */
#define vtophys(va) \
((*vtopte(va) & PG_FRAME) | ((unsigned int)(va) & ~PG_FRAME))
/* L1 and L2 page table macros */
#define pmap_pde(m, v) (&((m)->pm_pdir[((vm_offset_t)(v) >> PDSHIFT)&4095]))
#define pmap_pte_pa(pte) (*(pte) & PG_FRAME)
#define pmap_pde_v(pde) (*(pde) != 0)
#define pmap_pte_v(pte) (*(pte) != 0)
/* Size of the kernel part of the L1 page table */
#define KERNEL_PD_SIZE 0x400
#endif /* _ARM32_PMAP_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: iomd_irq.S,v 1.15 1998/04/01 23:09:06 mark Exp $ */
/* $NetBSD: iomd_irq.S,v 1.16 1998/06/02 20:41:54 mark Exp $ */
/*
* Copyright (c) 1994-1997 Mark Brinicombe.
@ -43,6 +43,7 @@
* Created : 27/09/94
*/
#include "opt_uvm.h"
#include "assym.h"
#include <machine/asm.h>
#include <machine/cpu.h>
@ -195,7 +196,7 @@ irqloop:
moveq r0, r8 /* IRQ requests as arg 0 */
beq _stray_irqhandler /* call special handler */
ldr r0, Lcnt
ldr r0, Lcnt
ldr r1, [r0, #(V_INTR)]
add r1, r1, #0x00000001
str r1, [r0, #(V_INTR)]
@ -209,7 +210,7 @@ irqchainloop:
*/
#ifdef IRQSTATS
ldr r0, Lintrcnt
ldr r0, Lintrcnt
ldr r1, [r6, #(IH_NUM)]
add r0, r0, r1, lsl #2
@ -371,7 +372,11 @@ ENTRY(irq_setmasks)
Lcnt:
#if defined(UVM)
.word _uvmexp
#else
.word _cnt
#endif
Lintrcnt:
.word _intrcnt

View File

@ -1,4 +1,4 @@
/* $NetBSD: esc.c,v 1.4 1997/10/14 22:09:24 mark Exp $ */
/* $NetBSD: esc.c,v 1.5 1998/06/02 20:41:54 mark Exp $ */
/*
* Copyright (c) 1995 Scott Stevens
@ -53,6 +53,7 @@
* Modified for NetBSD/arm32 by Scott Stevens
*/
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
@ -64,6 +65,9 @@
#include <vm/vm.h>
#include <vm/vm_kern.h>
#include <vm/vm_page.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <machine/pmap.h>
#include <machine/cpu.h>
#include <machine/io.h>
@ -196,7 +200,11 @@ escinitialize(dev)
/*
* Setup bump buffer.
*/
#if defined(UVM)
dev->sc_bump_va = (u_char *)uvm_km_zalloc(kernel_map, dev->sc_bump_sz);
#else
dev->sc_bump_va = (u_char *)kmem_alloc(kernel_map, dev->sc_bump_sz);
#endif
dev->sc_bump_pa = pmap_extract(kernel_pmap, (vm_offset_t)dev->sc_bump_va);
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: sfas.c,v 1.11 1997/08/27 11:23:36 bouyer Exp $ */
/* $NetBSD: sfas.c,v 1.12 1998/06/02 20:41:55 mark Exp $ */
/*
* Copyright (c) 1995 Scott Stevens
@ -49,6 +49,7 @@
* Modified for NetBSD/arm32 by Scott Stevens
*/
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
@ -60,6 +61,9 @@
#include <vm/vm.h>
#include <vm/vm_kern.h>
#include <vm/vm_page.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <machine/pmap.h>
#include <machine/cpu.h>
#include <machine/io.h>
@ -196,7 +200,11 @@ sfasinitialize(dev)
/*
* Setup bump buffer.
*/
#if defined(UVM)
dev->sc_bump_va = (u_char *)uvm_km_zalloc(kernel_map, dev->sc_bump_sz);
#else
dev->sc_bump_va = (u_char *)kmem_alloc(kernel_map, dev->sc_bump_sz);
#endif
dev->sc_bump_pa = pmap_extract(kernel_pmap, (vm_offset_t)dev->sc_bump_va);
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: beep.c,v 1.12 1998/01/13 02:10:43 thorpej Exp $ */
/* $NetBSD: beep.c,v 1.13 1998/06/02 20:41:55 mark Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe
@ -42,6 +42,7 @@
*
*/
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
@ -57,6 +58,10 @@
#include <vm/vm.h>
#include <vm/vm_kern.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <machine/irqhandler.h>
#include <machine/katelib.h>
#include <machine/vidc.h>
@ -147,8 +152,12 @@ beepattach(parent, self, aux)
sc->sc_iobase = mb->mb_iobase;
sc->sc_open = 0;
sc->sc_count = 0;
#if defined(UVM)
sc->sc_buffer0 = uvm_km_zalloc(kernel_map, NBPG);
#else
sc->sc_buffer0 = kmem_alloc(kernel_map, NBPG);
#endif
if (sc->sc_buffer0 == 0)
panic("beep: Cannot allocate buffer memory\n");
if ((sc->sc_buffer0 & (NBPG -1)) != 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidcconsole.c,v 1.17 1998/02/21 23:40:03 mark Exp $ */
/* $NetBSD: vidcconsole.c,v 1.18 1998/06/02 20:41:57 mark Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
@ -44,6 +44,8 @@
* Last updated : 07/02/96
*/
#include "opt_uvm.h"
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/param.h>
@ -61,6 +63,10 @@
#include <vm/vm.h>
#include <vm/vm_kern.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <machine/cpu.h>
#include <machine/param.h>
#include <machine/katelib.h>
@ -1327,8 +1333,11 @@ vidc_cursor_init(vc)
if (!cursor_data) {
/* Allocate cursor memory first time round */
#if defined(UVM)
cursor_data = (char *)uvm_km_zalloc(kernel_map, NBPG);
#else
cursor_data = (char *)kmem_alloc(kernel_map, NBPG);
#endif
if (!cursor_data)
panic("Cannot allocate memory for hardware cursor\n");
IOMD_WRITE_WORD(IOMD_CURSINIT, pmap_extract(kernel_pmap,

View File

@ -1,4 +1,4 @@
/* $NetBSD: lmcaudio.c,v 1.17 1998/01/13 02:10:44 thorpej Exp $ */
/* $NetBSD: lmcaudio.c,v 1.18 1998/06/02 20:41:55 mark Exp $ */
/*
* Copyright (c) 1996, Danny C Tsen.
@ -39,11 +39,12 @@
* /dev/audio (partial) compatibility.
*/
#include <sys/param.h> /* proc.h */
#include <sys/types.h> /* dunno */
#include <sys/conf.h> /* autoconfig functions */
#include <sys/device.h> /* device calls */
#include <sys/proc.h> /* device calls */
#include "opt_uvm.h"
#include <sys/param.h>
#include <sys/types.h>
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/proc.h>
#include <sys/audioio.h>
#include <sys/errno.h>
#include <sys/systm.h>
@ -52,6 +53,10 @@
#include <vm/vm.h>
#include <vm/vm_kern.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <dev/audio_if.h>
#include <machine/irqhandler.h>
@ -236,19 +241,19 @@ lmcaudio_attach(parent, self, aux)
/* Program the silence buffer and reset the DMA channel */
#if defined(UVM)
ag.silence = uvm_km_alloc(kernel_map, NBPG);
ag.beep = uvm_km_zalloc(kernel_map, NBPG);
#else
ag.silence = kmem_alloc(kernel_map, NBPG);
if (ag.silence == NULL)
panic("lmcaudio: Cannot allocate memory\n");
bzero((char *)ag.silence, NBPG);
ag.beep = kmem_alloc(kernel_map, NBPG);
if (ag.beep == NULL)
#endif
if (ag.silence == NULL || ag.beep == NULL)
panic("lmcaudio: Cannot allocate memory\n");
bzero((char *)ag.silence, NBPG);
bcopy((char *)beep_waveform, (char *)ag.beep, sizeof(beep_waveform));
conv_jap((u_char *) ag.beep, sizeof(beep_waveform));
conv_jap((u_char *)ag.beep, sizeof(beep_waveform));
ag.buffer = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidcaudio.c,v 1.22 1998/01/18 03:48:38 mark Exp $ */
/* $NetBSD: vidcaudio.c,v 1.23 1998/06/02 20:41:55 mark Exp $ */
/*
* Copyright (c) 1995 Melvin Tang-Richardson
@ -43,6 +43,8 @@
*
*/
#include "opt_uvm.h"
#include <sys/param.h> /* proc.h */
#include <sys/types.h> /* dunno */
#include <sys/conf.h> /* autoconfig functions */
@ -55,6 +57,10 @@
#include <vm/vm.h>
#include <vm/vm_kern.h>
#if defined(UVM)
#include <uvm/uvm_extern.h>
#endif
#include <dev/audio_if.h>
#include <machine/irqhandler.h>
@ -222,9 +228,12 @@ vidcaudio_attach(parent, self, aux)
vidcaudio_rate(32); /* 24*1024*/
/* Program the silence buffer and reset the DMA channel */
/* Program the silence buffer and reset the DMA channel */
#if defined(UVM)
ag.silence = uvm_km_alloc(kernel_map, NBPG);
#else
ag.silence = kmem_alloc(kernel_map, NBPG);
#endif
if (ag.silence == NULL)
panic("vidcaudio: Cannot allocate memory\n");