diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-05-30 20:40:05 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-05-30 20:40:05 +0000 |
commit | 6519346a2658942d5829a998e2b77ce0bc492537 (patch) | |
tree | 334e047d5c56febb9b623db287c4fc1a8c17b834 /sys/arch/sun3 | |
parent | 4e59b31bb80fe574ea2601def260089240b95a17 (diff) |
Preliminary UVM support. UVM kernels don't work for the moment, though.
Diffstat (limited to 'sys/arch/sun3')
-rw-r--r-- | sys/arch/sun3/include/pmap.h | 7 | ||||
-rw-r--r-- | sys/arch/sun3/sun3/dvma.c | 23 | ||||
-rw-r--r-- | sys/arch/sun3/sun3/genassym.cf | 5 | ||||
-rw-r--r-- | sys/arch/sun3/sun3/intreg.c | 12 | ||||
-rw-r--r-- | sys/arch/sun3/sun3/isr.c | 16 | ||||
-rw-r--r-- | sys/arch/sun3/sun3/locore.s | 8 | ||||
-rw-r--r-- | sys/arch/sun3/sun3/machdep.c | 103 | ||||
-rw-r--r-- | sys/arch/sun3/sun3/mem.c | 7 | ||||
-rw-r--r-- | sys/arch/sun3/sun3/pmap.c | 84 | ||||
-rw-r--r-- | sys/arch/sun3/sun3/trap.c | 14 | ||||
-rw-r--r-- | sys/arch/sun3/sun3/vm_machdep.c | 18 |
11 files changed, 247 insertions, 50 deletions
diff --git a/sys/arch/sun3/include/pmap.h b/sys/arch/sun3/include/pmap.h index 58e102c832a..dba933cadf5 100644 --- a/sys/arch/sun3/include/pmap.h +++ b/sys/arch/sun3/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.7 1997/02/19 00:03:34 kstailey Exp $ */ +/* $OpenBSD: pmap.h,v 1.8 2001/05/30 20:39:59 miod Exp $ */ /* $NetBSD: pmap.h,v 1.18 1997/01/27 19:41:06 gwr Exp $ */ /*- @@ -60,7 +60,10 @@ extern struct pmap kernel_pmap_store; #define pmap_kernel() (&kernel_pmap_store) /* This is called from locore.s:cpu_switch() */ -void pmap_activate __P((pmap_t pmap)); +void pmap_switch __P((pmap_t pmap)); + +void pmap_activate __P((struct proc *)); +void pmap_deactivate __P((struct proc *)); /* This lets us have some say in choosing VA locations. */ extern void pmap_prefer(vm_offset_t, vm_offset_t *); diff --git a/sys/arch/sun3/sun3/dvma.c b/sys/arch/sun3/sun3/dvma.c index eefbcf0ef9a..bbc73953a2d 100644 --- a/sys/arch/sun3/sun3/dvma.c +++ b/sys/arch/sun3/sun3/dvma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvma.c,v 1.8 1999/01/11 05:12:05 millert Exp $ */ +/* $OpenBSD: dvma.c,v 1.9 2001/05/30 20:40:03 miod Exp $ */ /* $NetBSD: dvma.c,v 1.5 1996/11/20 18:57:29 gwr Exp $ */ /*- @@ -53,6 +53,10 @@ #include <vm/vm_kern.h> #include <vm/vm_map.h> +#ifdef UVM +#include <uvm/uvm.h> +#endif + #include <machine/autoconf.h> #include <machine/cpu.h> #include <machine/control.h> @@ -83,8 +87,13 @@ dvma_init() * then allocate the segment pool from that. The * remainder will be used as the DVMA page pool. */ +#ifdef UVM + phys_map = uvm_map_create(pmap_kernel(), + DVMA_SPACE_START, DVMA_SPACE_END, 1); +#else phys_map = vm_map_create(pmap_kernel(), DVMA_SPACE_START, DVMA_SPACE_END, 1); +#endif if (phys_map == NULL) panic("unable to create DVMA map"); @@ -93,7 +102,11 @@ dvma_init() * The remainder of phys_map is used for DVMA scratch * memory pages (i.e. driver control blocks, etc.) */ +#ifdef UVM + segmap_addr = uvm_km_valloc_wait(phys_map, dvma_segmap_size); +#else segmap_addr = kmem_alloc_wait(phys_map, dvma_segmap_size); +#endif if (segmap_addr != DVMA_SPACE_START) panic("dvma_init: unable to allocate DVMA segments"); @@ -119,7 +132,11 @@ dvma_malloc(bytes) if (!bytes) return NULL; new_size = m68k_round_page(bytes); +#ifdef UVM + new_mem = (caddr_t) uvm_km_alloc(phys_map, new_size); +#else new_mem = (caddr_t) kmem_alloc(phys_map, new_size); +#endif if (!new_mem) panic("dvma_malloc: no space in phys_map"); /* The pmap code always makes DVMA pages non-cached. */ @@ -136,7 +153,11 @@ dvma_free(addr, size) { vm_size_t sz = m68k_round_page(size); +#ifdef UVM + uvm_km_free(phys_map, (vm_offset_t)addr, sz); +#else kmem_free(phys_map, (vm_offset_t)addr, sz); +#endif } /* diff --git a/sys/arch/sun3/sun3/genassym.cf b/sys/arch/sun3/sun3/genassym.cf index abc95789adc..ca8c5d913bc 100644 --- a/sys/arch/sun3/sun3/genassym.cf +++ b/sys/arch/sun3/sun3/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.1 2001/01/04 22:41:22 miod Exp $ +# $OpenBSD: genassym.cf,v 1.2 2001/05/30 20:40:03 miod Exp $ # $NetBSD: genassym.c,v 1.32 1996/10/23 16:39:27 gwr Exp $ # @@ -47,6 +47,9 @@ include <sys/proc.h> include <sys/syscall.h> include <vm/vm.h> +ifdef UVM +include <uvm/uvm_extern.h> +endif include <machine/control.h> include <machine/cpu.h> diff --git a/sys/arch/sun3/sun3/intreg.c b/sys/arch/sun3/sun3/intreg.c index a300f0fbf44..e44ecfa42fa 100644 --- a/sys/arch/sun3/sun3/intreg.c +++ b/sys/arch/sun3/sun3/intreg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intreg.c,v 1.6 2001/01/03 01:47:30 miod Exp $ */ +/* $OpenBSD: intreg.c,v 1.7 2001/05/30 20:40:03 miod Exp $ */ /* $NetBSD: intreg.c,v 1.5 1996/11/20 18:57:32 gwr Exp $ */ /*- @@ -55,6 +55,12 @@ #include <machine/mon.h> #include <machine/obio.h> +#include <vm/vm.h> + +#ifdef UVM +#include <uvm/uvm_extern.h> +#endif + #include "interreg.h" struct intreg_softc { @@ -146,7 +152,11 @@ soft1intr(arg) splx(s); if (sir.sir_any) { +#ifdef UVM + uvmexp.softs++; +#else cnt.v_soft++; +#endif if (sir.sir_which[SIR_NET]) { s = splhigh(); n = netisr; diff --git a/sys/arch/sun3/sun3/isr.c b/sys/arch/sun3/sun3/isr.c index d46ae879868..29b4e2f5f74 100644 --- a/sys/arch/sun3/sun3/isr.c +++ b/sys/arch/sun3/sun3/isr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isr.c,v 1.12 2001/01/04 22:33:52 miod Exp $ */ +/* $OpenBSD: isr.c,v 1.13 2001/05/30 20:40:03 miod Exp $ */ /* $NetBSD: isr.c,v 1.25 1996/11/20 18:57:32 gwr Exp $ */ /*- @@ -54,6 +54,12 @@ #include <machine/mon.h> #include <machine/obio.h> +#include <vm/vm.h> + +#ifdef UVM +#include <uvm/uvm_extern.h> +#endif + #include "vector.h" extern int intrcnt[]; /* statistics */ @@ -101,7 +107,11 @@ isr_autovec(evec) n = intrcnt[ipl]; intrcnt[ipl] = n+1; +#ifdef UVM + uvmexp.intrs++; +#else cnt.v_intr++; +#endif isr = isr_autovec_list[ipl]; if (isr == NULL) { @@ -168,7 +178,11 @@ isr_vectored(evec) ipl = (ipl >> 8) & 7; intrcnt[ipl]++; +#ifdef UVM + uvmexp.intrs++; +#else cnt.v_intr++; +#endif if (vec < 64 || vec >= 256) { printf("isr_vectored: vector=0x%x (invalid)\n", vec); diff --git a/sys/arch/sun3/sun3/locore.s b/sys/arch/sun3/sun3/locore.s index 9a88dd59db3..11fd159d43e 100644 --- a/sys/arch/sun3/sun3/locore.s +++ b/sys/arch/sun3/sun3/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.22 2001/01/04 22:42:07 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.23 2001/05/30 20:40:04 miod Exp $ */ /* $NetBSD: locore.s,v 1.40 1996/11/06 20:19:54 cgd Exp $ */ /* @@ -812,14 +812,14 @@ Lswnofpsave: #endif /* - * Call pmap_activate() to set the MMU context register + * Call pmap_switch() to set the MMU context register */ movl a2@(VM_PMAP),a2 | pmap = &vm.vm_map.pmap pea a2@ | push pmap - jbsr _C_LABEL(pmap_activate) | pmap_activate(pmap) + jbsr _C_LABEL(pmap_switch) | pmap_switch(pmap) addql #4,sp movl _C_LABEL(curpcb),a1 | restore p_addr -| Note: pmap_activate will clear the cache if needed. +| Note: pmap_switch will clear the cache if needed. /* * Reload the registers for the new process. diff --git a/sys/arch/sun3/sun3/machdep.c b/sys/arch/sun3/sun3/machdep.c index 1f1112389d4..77ff45b02d7 100644 --- a/sys/arch/sun3/sun3/machdep.c +++ b/sys/arch/sun3/sun3/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.31 2001/05/17 18:41:50 provos Exp $ */ +/* $OpenBSD: machdep.c,v 1.32 2001/05/30 20:40:04 miod Exp $ */ /* $NetBSD: machdep.c,v 1.77 1996/10/13 03:47:51 christos Exp $ */ /* @@ -84,6 +84,10 @@ #include <vm/vm_kern.h> #include <vm/vm_page.h> +#ifdef UVM +#include <uvm/uvm_extern.h> +#endif + #include <dev/cons.h> #include <machine/cpu.h> @@ -99,13 +103,20 @@ extern char *cpu_string; extern char version[]; extern short exframesize[]; -extern vm_offset_t vmmap; /* XXX - poor name. See mem.c */ int physmem; int fputype; label_t *nofault; vm_offset_t vmmap; +#ifdef 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 = NULL; +#endif + /* * safepri is a safe priority for sleep to set for a spin-wait * during autoconfiguration or after a panic. @@ -115,7 +126,9 @@ int safepri = PSL_LOWIPL; /* * Declare these as initialized data so we can patch them. */ +#ifndef UVM int nswbuf = 0; +#endif #ifdef NBUF int nbuf = NBUF; #else @@ -235,12 +248,14 @@ allocsys(v) /* More buffer pages than fits into the buffers is senseless. */ if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE) bufpages = nbuf * MAXBSIZE / PAGE_SIZE; +#ifndef UVM if (nswbuf == 0) { nswbuf = (nbuf / 2) &~ 1; /* force even */ if (nswbuf > 256) nswbuf = 256; /* sanity */ } valloc(swbuf, struct buf, nswbuf); +#endif valloc(buf, struct buf, nbuf); return v; } @@ -282,7 +297,11 @@ cpu_startup() * and then give everything true virtual addresses. */ sz = (int)allocsys((caddr_t)0); +#ifdef UVM + if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(sz))) == 0) +#else if ((v = (caddr_t)kmem_alloc(kernel_map, round_page(sz))) == 0) +#endif panic("startup: no room for tables"); if (allocsys(v) - v != sz) panic("startup: table size inconsistency"); @@ -292,12 +311,21 @@ cpu_startup() * in that they usually occupy more virtual memory than physical. */ size = MAXBSIZE * nbuf; +#ifdef UVM + if (uvm_map(kernel_map, (vaddr_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 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 if ((bufpages / nbuf) >= btoc(MAXBSIZE)) { /* don't want to alloc more physical mem than needed */ bufpages = btoc(MAXBSIZE) * nbuf; @@ -305,10 +333,33 @@ cpu_startup() base = bufpages / nbuf; residual = bufpages % nbuf; for (i = 0; i < nbuf; i++) { - vm_size_t curbufsize; - vm_offset_t curbuf; + vsize_t curbufsize; + vaddr_t curbuf; +#ifdef UVM + 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 = PAGE_SIZE * ((i < residual) ? (base+1) : base); + + while (curbufsize != 0) { + pg = uvm_pagealloc(NULL, 0, NULL, 0); + if (pg == NULL) + panic("cpu_startup: not enough memory for " + "buffer cache"); + pmap_enter(kernel_map->pmap, curbuf, + VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, TRUE, + VM_PROT_READ|VM_PROT_WRITE); + curbuf += PAGE_SIZE; + curbufsize -= PAGE_SIZE; + } +#else + /* * First <residual> buffers get (base+1) physical pages * allocated for them. The rest get (base) physical pages. * @@ -319,14 +370,20 @@ cpu_startup() curbufsize = PAGE_SIZE * (i < 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. */ +#ifdef UVM + exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, + 16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL); +#else exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, 16*NCARGS, TRUE); +#endif /* * We don't use a submap for physio, and use a separate map @@ -335,15 +392,24 @@ cpu_startup() * device drivers clone the kernel mappings into DVMA space. */ +#ifdef UVM + mb_map = uvm_km_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr, + VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL); +#else mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr, VM_MBUF_SIZE, FALSE); +#endif /* * Initialize timeouts */ timeout_init(); +#ifdef 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 * PAGE_SIZE); @@ -352,7 +418,11 @@ cpu_startup() * This page is handed to pmap_enter() therefore * it has to be in the normal kernel VA range. */ +#ifdef UVM + vmmap = uvm_km_valloc_wait(kernel_map, NBPG); +#else vmmap = kmem_alloc_wait(kernel_map, NBPG); +#endif /* * Create the DVMA maps. @@ -427,17 +497,20 @@ char machine[] = "sun3"; /* cpu "architecture" */ char cpu_model[120]; extern long hostid; -static void +void identifycpu() { - /* - * actual identification done earlier because i felt like it, - * and i believe i will need the info to deal with some VAC, and awful - * framebuffer placement problems. could be moved later. - */ + /* + * actual identification done earlier because i felt like it, + * and i believe i will need the info to deal with some VAC, and awful + * framebuffer placement problems. could be moved later. + */ strcpy(cpu_model, "Sun 3/"); - /* should eventually include whether it has a VAC, mc6888x version, etc */ + /* + * should eventually include whether it has a VAC, mc6888x + * version, etc + */ strcat(cpu_model, cpu_string); printf("Model: %s (hostid %lx)\n", cpu_model, hostid); @@ -515,7 +588,7 @@ int sigpid = 0; * XXX - Put waittime checks in there too? */ int waittime = -1; /* XXX - Who else looks at this? -gwr */ -static void +void reboot_sync() { extern struct proc proc0; @@ -533,7 +606,7 @@ reboot_sync() /* * Common part of the BSD and SunOS reboot system calls. */ -int +__dead int reboot2(howto, user_boot_string) int howto; char *user_boot_string; @@ -614,7 +687,7 @@ reboot2(howto, user_boot_string) * that specifies a machine-dependent boot string that * is passed to the boot program if RB_STRING is set. */ -void +__dead void boot(howto) int howto; { @@ -879,7 +952,7 @@ regdump(fp, sbytes) #define KSADDR ((int *)((u_int)curproc->p_addr + USPACE - NBPG)) -static void +void dumpmem(ptr, sz, ustack) register int *ptr; int sz, ustack; diff --git a/sys/arch/sun3/sun3/mem.c b/sys/arch/sun3/sun3/mem.c index 0d7cf24bd9f..58e5081e55b 100644 --- a/sys/arch/sun3/sun3/mem.c +++ b/sys/arch/sun3/sun3/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.10 2001/05/05 20:56:54 art Exp $ */ +/* $OpenBSD: mem.c,v 1.11 2001/05/30 20:40:04 miod Exp $ */ /* $NetBSD: mem.c,v 1.19 1995/08/08 21:09:01 gwr Exp $ */ /* @@ -196,8 +196,13 @@ mmrw(dev, uio, flags) */ o = v & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); +#ifdef UVM + if (!uvm_kernacc((caddr_t)v, c, + uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) +#else if (!kernacc((caddr_t)v, c, uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) +#endif { error = EFAULT; goto unlock; diff --git a/sys/arch/sun3/sun3/pmap.c b/sys/arch/sun3/sun3/pmap.c index 2228733c03f..10453292b79 100644 --- a/sys/arch/sun3/sun3/pmap.c +++ b/sys/arch/sun3/sun3/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.22 2001/05/13 00:33:34 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.23 2001/05/30 20:40:04 miod Exp $ */ /* $NetBSD: pmap.c,v 1.64 1996/11/20 18:57:35 gwr Exp $ */ /*- @@ -82,6 +82,10 @@ #include <vm/vm_kern.h> #include <vm/vm_page.h> +#ifdef UVM +#include <uvm/uvm.h> +#endif + #include <machine/pte.h> #include <machine/control.h> @@ -378,7 +382,6 @@ static void pv_unlink __P((pmap_t, vm_offset_t, vm_offset_t)); static void pv_remove_all __P(( vm_offset_t pa)); static void pv_changepte __P((pv_entry_t, int, int)); static void pv_syncflags __P((pv_entry_t head)); -static void pv_init __P((void)); static void pmeg_clean __P((pmeg_t pmegp)); static void pmeg_clean_free __P((void)); @@ -403,6 +406,8 @@ static void pmap_protect_range_noctx __P((pmap_t, vm_offset_t, vm_offset_t)); static void pmap_protect_range_mmu __P((pmap_t, vm_offset_t, vm_offset_t)); static void pmap_protect_range __P((pmap_t, vm_offset_t, vm_offset_t)); +void pmap_switch __P((pmap_t pmap)); + extern int pmap_page_index __P((paddr_t)); extern u_int pmap_free_pages __P((void)); extern int pmap_next_page __P((vm_offset_t *)); @@ -1408,22 +1413,6 @@ pv_unlink(pmap, pa, va) } static void -pv_init() -{ - int sz; - - sz = PA_PGNUM(avail_end); - sz *= sizeof(struct pv_entry); - - pv_head_table = (pv_entry_t) kmem_alloc(kernel_map, sz); - if (!pv_head_table) - mon_panic("pmap: kmem_alloc() of pv table failed"); - bzero((caddr_t) pv_head_table, sz); - - pv_initialized++; -} - -static void sun3_protection_init() { unsigned int *kp, prot; @@ -1486,8 +1475,13 @@ pmap_bootstrap() /* Initialization for pmap_next_page() */ avail_next = avail_start; +#ifdef UVM + uvmexp.pagesize = PAGE_SIZE; + uvm_setpagesize(); +#else cnt.v_page_size = PAGE_SIZE; vm_set_page_size(); +#endif sun3_protection_init(); @@ -1609,8 +1603,21 @@ void pmap_init() { extern int physmem; + int sz; + + sz = PA_PGNUM(avail_end); + sz *= sizeof(struct pv_entry); + +#ifdef UVM + pv_head_table = (pv_entry_t) uvm_km_zalloc(kernel_map, sz); +#else + pv_head_table = (pv_entry_t) kmem_alloc(kernel_map, sz); +#endif + if (!pv_head_table) + mon_panic("pmap: kmem_alloc() of pv table failed"); + bzero((caddr_t) pv_head_table, sz); - pv_init(); + pv_initialized++; physmem = btoc((u_int)avail_end); } @@ -1659,14 +1666,26 @@ pmap_page_upload() */ a = atop(avail_start); b = atop(hole_start); +#ifdef UVM + uvm_page_physload(a, b, a, b, VM_FREELIST_DEFAULT); +#else vm_page_physload(a, b, a, b); +#endif c = atop(hole_start + hole_size); d = atop(avail_end); +#ifdef UVM + uvm_page_physload(b, d, c, d, VM_FREELIST_DEFAULT); +#else vm_page_physload(b, d, c, d); +#endif } else { a = atop(avail_start); d = atop(avail_end); +#ifdef UVM + uvm_page_physload(a, d, a, d, VM_FREELIST_DEFAULT); +#else vm_page_physload(a, d, a, d); +#endif } } @@ -2669,7 +2688,7 @@ pmap_is_referenced(pa) * switching to a new process. Load new translations. */ void -pmap_activate(pmap) +pmap_switch(pmap) pmap_t pmap; { int old_ctx; @@ -2776,12 +2795,12 @@ pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr) * Function: * Extract the physical page address associated * with the given map/virtual_address pair. - * Returns zero if VA not valid. + * Returns FALSE if VA not valid. */ vm_offset_t pmap_extract(pmap, va) pmap_t pmap; - vm_offset_t va; + vaddr_t va; { int s, sme, segnum, ptenum, pte; vm_offset_t pa; @@ -3341,3 +3360,24 @@ set_pte_pmeg(int pmeg_num, int page_num, int pte) temp_seg_inuse--; } + +void +pmap_activate(p) + struct proc *p; +{ + pmap_t pmap = p->p_vmspace->vm_map.pmap; + int s; + + if (p == curproc) { + s = splpmap(); + pmap_switch(pmap); + splx(s); + } +} + +void +pmap_deactivate(p) + struct proc *p; +{ + /* not implemented. */ +} diff --git a/sys/arch/sun3/sun3/trap.c b/sys/arch/sun3/sun3/trap.c index c9657f5790a..b17fd21edaf 100644 --- a/sys/arch/sun3/sun3/trap.c +++ b/sys/arch/sun3/sun3/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.23 2001/05/05 20:56:55 art Exp $ */ +/* $OpenBSD: trap.c,v 1.24 2001/05/30 20:40:04 miod Exp $ */ /* $NetBSD: trap.c,v 1.63-1.65ish 1997/01/16 15:41:40 gwr Exp $ */ /* @@ -209,7 +209,11 @@ trap(type, code, v, frame) u_quad_t sticks; int si_type; +#ifdef UVM + uvmexp.traps++; +#else cnt.v_trap++; +#endif p = curproc; ucode = 0; sig = 0; @@ -527,7 +531,11 @@ trap(type, code, v, frame) } /* OK, let the VM code handle the fault. */ +#ifdef UVM + rv = uvm_fault(map, va, 0, ftype); +#else rv = vm_fault(map, va, ftype, FALSE); +#endif #ifdef DEBUG if (rv && MDB_ISPID(p->p_pid)) { printf("vm_fault(%x, %x, %x, 0) -> %x\n", @@ -618,7 +626,11 @@ syscall(code, frame) register_t args[8], rval[2]; u_quad_t sticks; +#ifdef UVM + uvmexp.syscalls++; +#else cnt.v_syscall++; +#endif if (!USERMODE(frame.f_sr)) panic("syscall"); p = curproc; diff --git a/sys/arch/sun3/sun3/vm_machdep.c b/sys/arch/sun3/sun3/vm_machdep.c index 10a525395d2..ed6d185761b 100644 --- a/sys/arch/sun3/sun3/vm_machdep.c +++ b/sys/arch/sun3/sun3/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.14 2001/05/05 20:56:55 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.15 2001/05/30 20:40:04 miod Exp $ */ /* $NetBSD: vm_machdep.c,v 1.35 1996/04/26 18:38:06 gwr Exp $ */ /* @@ -60,6 +60,10 @@ #include <vm/vm_kern.h> /* #include <vm/vm_map.h> */ +#ifdef UVM +#include <uvm/uvm_extern.h> +#endif + #include <machine/cpu.h> #include <machine/machdep.h> #include <machine/pmap.h> @@ -200,7 +204,11 @@ cpu_exit(p) { (void) splimp(); +#ifdef UVM + uvmexp.swtch++; +#else cnt.v_swtch++; +#endif switch_exit(p); /* NOTREACHED */ } @@ -360,7 +368,11 @@ vmapbuf(bp, sz) off = addr & PGOFSET; addr = trunc_page(addr); size = round_page(bp->b_bcount + off); +#ifdef UVM + kva = uvm_km_valloc_wait(kernel_map, size); +#else kva = kmem_alloc_wait(kernel_map, size); +#endif bp->b_data = (caddr_t)(kva + off); npf = btoc(size); @@ -415,7 +427,11 @@ vunmapbuf(bp, sz) * pmap_remove but that will do nothing since we * already removed the actual mappings. */ +#ifdef UVM + uvm_km_free_wakeup(kernel_map, pgva, size); +#else kmem_free_wakeup(kernel_map, pgva, size); +#endif bp->b_data = bp->b_saveaddr; bp->b_saveaddr = NULL; } |