diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-06-14 21:30:47 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-06-14 21:30:47 +0000 |
commit | 4b285773bdb76f222c9cc2e367aa3c0a5487339c (patch) | |
tree | 0d699ba3d097126dea62a8b41b8aba2723ae0bae /sys/arch/mvme88k | |
parent | fc6172932d8fdeecc671e7795566fd34da21b853 (diff) |
Big cleanup of VM issues:
o get rid of m88k_foo macros when there is an mi foo macro
o remove the ability, for the pmap module, to handle a native mmu page
size different from the vm module page size. This allows some
optimizations in pmap.c
o remove dead stuff from <machine/vmparam.h>
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r-- | sys/arch/mvme88k/dev/nvram.c | 7 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/sram.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/ssh.c | 6 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/sshdma.c | 6 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/vmel.c | 5 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/vmes.c | 5 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/vs.c | 33 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/mmu.h | 55 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/pmap.h | 9 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/vmparam.h | 107 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore.S | 6 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m18x_cmmu.c | 6 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 14 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/pmap.c | 709 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/pmap_table.c | 5 |
15 files changed, 313 insertions, 664 deletions
diff --git a/sys/arch/mvme88k/dev/nvram.c b/sys/arch/mvme88k/dev/nvram.c index a6a9f5d098a..c43013944c3 100644 --- a/sys/arch/mvme88k/dev/nvram.c +++ b/sys/arch/mvme88k/dev/nvram.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvram.c,v 1.9 2001/03/09 05:44:39 smurph Exp $ */ +/* $OpenBSD: nvram.c,v 1.10 2001/06/14 21:30:34 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -43,6 +43,7 @@ #include <sys/systm.h> #include <sys/uio.h> #include <sys/malloc.h> + #include <machine/psl.h> #include <machine/autoconf.h> #include <machine/bugio.h> @@ -50,6 +51,8 @@ #include <machine/mioctl.h> #include <machine/vmparam.h> +#include <vm/vm_param.h> + #include <mvme88k/dev/memdevs.h> #include <mvme88k/dev/nvramreg.h> #include <mvme88k/dev/pcctworeg.h> @@ -496,5 +499,5 @@ nvrammmap(dev, off, prot) /* allow access only in RAM */ if (off > sc->sc_len) return (-1); - return (m88k_btop(sc->sc_paddr + off)); + return (atop(sc->sc_paddr + off)); } diff --git a/sys/arch/mvme88k/dev/sram.c b/sys/arch/mvme88k/dev/sram.c index f930c54866b..79c128a33a0 100644 --- a/sys/arch/mvme88k/dev/sram.c +++ b/sys/arch/mvme88k/dev/sram.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sram.c,v 1.1 1998/12/15 05:52:31 smurph Exp $ */ +/* $OpenBSD: sram.c,v 1.2 2001/06/14 21:30:34 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -219,5 +219,5 @@ srammmap(dev, off, prot) /* allow access only in RAM */ if (off > sc->sc_len) return (-1); - return (m88k_btop(sc->sc_paddr + off)); + return (atop(sc->sc_paddr + off)); } diff --git a/sys/arch/mvme88k/dev/ssh.c b/sys/arch/mvme88k/dev/ssh.c index 9ddd0ff2f1f..cdf1665a7b6 100644 --- a/sys/arch/mvme88k/dev/ssh.c +++ b/sys/arch/mvme88k/dev/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.3 2001/03/09 05:44:39 smurph Exp $ */ +/* $OpenBSD: ssh.c,v 1.4 2001/06/14 21:30:35 miod Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -680,8 +680,8 @@ sshreset(sc) for (i = 0; i < SSH_NACB; i++) { pmap_cache_ctrl(pmap_kernel(), - M88K_TRUNC_PAGE((vm_offset_t)acb), - M88K_ROUND_PAGE((vm_offset_t)acb+sizeof(*acb)), + trunc_page((vm_offset_t)acb), + round_page((vm_offset_t)acb+sizeof(*acb)), CACHE_INH); TAILQ_INSERT_TAIL(&sc->free_list, acb, chain); diff --git a/sys/arch/mvme88k/dev/sshdma.c b/sys/arch/mvme88k/dev/sshdma.c index b394146c61c..42b50ee43a8 100644 --- a/sys/arch/mvme88k/dev/sshdma.c +++ b/sys/arch/mvme88k/dev/sshdma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshdma.c,v 1.3 2001/03/09 05:44:39 smurph Exp $ */ +/* $OpenBSD: sshdma.c,v 1.4 2001/06/14 21:30:35 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur @@ -173,8 +173,8 @@ afscattach(parent, self, auxp) struct pcctworeg *pcc2 = (struct pcctworeg *)ca->ca_master; - pmap_cache_ctrl(pmap_kernel(), M88K_TRUNC_PAGE((vm_offset_t)sc), - M88K_ROUND_PAGE((vm_offset_t)sc + sizeof(*sc)), + pmap_cache_ctrl(pmap_kernel(), trunc_page((vm_offset_t)sc), + round_page((vm_offset_t)sc + sizeof(*sc)), CACHE_INH); pcctwointr_establish(PCC2V_NCR, &sc->sc_ih); diff --git a/sys/arch/mvme88k/dev/vmel.c b/sys/arch/mvme88k/dev/vmel.c index ece0f933461..cc70108b3d4 100644 --- a/sys/arch/mvme88k/dev/vmel.c +++ b/sys/arch/mvme88k/dev/vmel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmel.c,v 1.3 2001/03/09 05:44:39 smurph Exp $ */ +/* $OpenBSD: vmel.c,v 1.4 2001/06/14 21:30:35 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -37,6 +37,7 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/device.h> + #include <machine/cpu.h> #include <machine/autoconf.h> #include <mvme88k/dev/vme.h> @@ -165,5 +166,5 @@ vmelmmap(dev, off, prot) printf("vmel %x pa %x\n", off, pa); if (pa == NULL) return (-1); - return (m88k_btop(pa)); + return (atop(pa)); } diff --git a/sys/arch/mvme88k/dev/vmes.c b/sys/arch/mvme88k/dev/vmes.c index b9490861e17..180f6ef6c8b 100644 --- a/sys/arch/mvme88k/dev/vmes.c +++ b/sys/arch/mvme88k/dev/vmes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmes.c,v 1.3 2001/03/09 05:44:39 smurph Exp $ */ +/* $OpenBSD: vmes.c,v 1.4 2001/06/14 21:30:35 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -37,6 +37,7 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/device.h> + #include <machine/autoconf.h> #include <machine/cpu.h> #include <mvme88k/dev/vme.h> @@ -165,5 +166,5 @@ vmesmmap(dev, off, prot) printf("vmes %x pa %x\n", off, pa); if (pa == NULL) return (-1); - return (m88k_btop(pa)); + return (atop(pa)); } diff --git a/sys/arch/mvme88k/dev/vs.c b/sys/arch/mvme88k/dev/vs.c index da71e0ef0ca..16fe67e91d0 100644 --- a/sys/arch/mvme88k/dev/vs.c +++ b/sys/arch/mvme88k/dev/vs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vs.c,v 1.6 2001/05/16 12:49:47 ho Exp $ */ +/* $OpenBSD: vs.c,v 1.7 2001/06/14 21:30:35 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. @@ -48,26 +48,25 @@ #include <sys/dkstat.h> #include <sys/buf.h> #include <sys/malloc.h> + +#include <vm/vm_param.h> + #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> + #include <machine/autoconf.h> #include <machine/param.h> -#if defined(MVME187) || defined(MVME188) || defined(MVME197) - #define PAGESIZE 4096 +#if defined(mvme88k) #include <mvme88k/dev/vsreg.h> #include <mvme88k/dev/vsvar.h> #include <mvme88k/dev/vme.h> /* vme_findvec() */ #include <machine/mmu.h> /* DMA_CACHE_SYNC, etc... */ - #define ROUND_PAGE m88k_round_page - #define TRUNC_PAGE m88k_trunc_page #else #include <mvme68k/dev/vsreg.h> #include <mvme68k/dev/vsvar.h> #include <mvme68k/dev/vme.h> /* vme_findvec() */ - #define ROUND_PAGE m68k_round_page - #define TRUNC_PAGE m68k_trunc_page -#endif /* MVME187 */ +#endif /* mvme88k */ int vs_checkintr __P((struct vs_softc *, struct scsi_xfer *, int *)); void vs_chksense __P((struct scsi_xfer *)); @@ -323,18 +322,18 @@ vs_scsicmd(xs) iopb->iopb_EVCT = (u_char)sc->sc_evec; /* - * Since the 187 doesn't support cache snooping, we have + * Since the 88k doesn't support cache snooping, we have * to flush the cache for a write and flush with inval for * a read, prior to starting the IO. */ if (xs->flags & SCSI_DATA_IN) { /* read */ -#if defined(MVME187) || defined(MVME188) || defined(MVME197) +#if defined(mvme88k) dma_cachectl((vm_offset_t)xs->data, xs->datalen, DMA_CACHE_SYNC_INVAL); #endif iopb->iopb_OPTION |= OPT_READ; } else { /* write */ -#if defined(MVME187) || defined(MVME188) || defined(MVME197) +#if defined(mvme88k) dma_cachectl((vm_offset_t)xs->data, xs->datalen, DMA_CACHE_SYNC); #endif @@ -1007,19 +1006,19 @@ vs_build_memory_structure(xs, iopb) * Check if we need scatter/gather */ - if (len > PAGESIZE) { - for (level = 0, point_virt = ROUND_PAGE(starting_point_virt+1); + if (len > PAGE_SIZE) { + for (level = 0, point_virt = round_page(starting_point_virt+1); /* if we do already scatter/gather we have to stay in the loop and jump */ point_virt < virt + (vm_offset_t)len || sg ; - point_virt += PAGESIZE) { /* out later */ + point_virt += PAGE_SIZE) { /* out later */ point2_phys = kvtop(point_virt); - if ((point2_phys - TRUNC_PAGE(point1_phys) - PAGESIZE) || /* physical memory is not contiguous */ + if ((point2_phys - trunc_page(point1_phys) - PAGE_SIZE) || /* physical memory is not contiguous */ (point_virt - starting_point_virt >= MAX_SG_BLOCK_SIZE && sg)) { /* we only can access (1<<16)-1 bytes in scatter/gather_mode */ if (point_virt - starting_point_virt >= MAX_SG_BLOCK_SIZE) { /* We were walking too far for one scatter/gather block ... */ - assert( MAX_SG_BLOCK_SIZE > PAGESIZE ); - point_virt = TRUNC_PAGE(starting_point_virt+MAX_SG_BLOCK_SIZE-1); /* So go back to the beginning of the last matching page */ + assert( MAX_SG_BLOCK_SIZE > PAGE_SIZE ); + point_virt = trunc_page(starting_point_virt+MAX_SG_BLOCK_SIZE-1); /* So go back to the beginning of the last matching page */ /* and gererate the physadress of this location for the next time. */ point2_phys = kvtop(point_virt); } diff --git a/sys/arch/mvme88k/include/mmu.h b/sys/arch/mvme88k/include/mmu.h index 67eca239b82..3e68f895b3b 100644 --- a/sys/arch/mvme88k/include/mmu.h +++ b/sys/arch/mvme88k/include/mmu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mmu.h,v 1.7 2001/03/09 05:44:40 smurph Exp $ */ +/* $OpenBSD: mmu.h,v 1.8 2001/06/14 21:30:40 miod Exp $ */ /* * Ashura Project */ @@ -12,36 +12,12 @@ #ifndef __MACHINE_MMU_H__ #define __MACHINE_MMU_H__ -/* for m88k_pgbytes, m8kk_pgshift */ -#include <machine/vmparam.h> - - /* * Parameters which determine the 'geometry' of the M88K page tables in memory. */ #define SDT_BITS 10 /* M88K segment table size bits */ #define PDT_BITS 10 /* M88K page table size bits */ -#define PG_BITS M88K_PGSHIFT /* M88K hardware page size bits */ - -/* - * Shifts and masks for M88K (hardware) page - */ -/* M88K_PGBYTES, PG_SHIFT in vm_param.h */ -#define M88K_PGOFSET (M88K_PGBYTES-1) /* offset into M88K page */ -#define M88K_PGMASK (~M88K_PGOFSET) /* page mask */ - -/* - * Convert byte address to page frame number - */ -#define M88K_BTOP(x) (((unsigned) (x)) >> M88K_PGSHIFT) -#define M88K_PTOB(x) (((unsigned) (x)) << M88K_PGSHIFT) - -/* - * Round off or truncate to the nearest page. These will work for - * either addresses of counts. (i.e. 1 byte round to 1 page bytes). - */ -#define M88K_TRUNC_PAGE(x) (((unsigned) (x) & M88K_PGMASK)) -#define M88K_ROUND_PAGE(x) M88K_TRUNC_PAGE((x) + M88K_PGOFSET) +#define PG_BITS PAGE_SHIFT /* M88K hardware page size bits */ /* * M88K area descriptors @@ -216,7 +192,7 @@ typedef union batc_template { /* * Va spaces mapped by tables and PDT table group. */ -#define PDT_VA_SPACE (PDT_ENTRIES * M88K_PGBYTES) +#define PDT_VA_SPACE (PDT_ENTRIES * PAGE_SIZE) #define PDT_TABLE_GROUP_VA_SPACE (PDT_VA_SPACE * PDT_TABLE_GROUP_SIZE) /* @@ -234,33 +210,12 @@ typedef union batc_template { /* * Alignment checks for pages (must lie on page boundaries). */ -#define PAGE_ALIGNED(ad) (((vm_offset_t)(ad) & ~M88K_PGMASK) == 0) +#define PAGE_ALIGNED(ad) (((vm_offset_t)(ad) & PAGE_MASK) == 0) #define CHECK_PAGE_ALIGN(ad,who) \ if (!PAGE_ALIGNED(ad)) \ printf("%s: addr %x not page aligned.\n", who, ad) /* - * Validate PTE's for all hardware pages in a VM page. - * "ptes_per_vm_page" should be set in pmap_bootstrap. - * - * PARAMETERS: - * pt_entry_t *start; - * unsigned long template; - */ -#define DO_PTES(start, template) \ -{ \ - int i_; \ - pt_entry_t *p_ = start; \ - \ - for (i_ = ptes_per_vm_page; i_>0; i_--) { \ - *(int *)p_++ = (unsigned long)(template); \ - template += M88K_PGBYTES; \ - /* (unsigned long)(template) for m88k C compiler\ - '90.7.24 Fuzzy */ \ - } \ -} - -/* * Flags for cmmu_store() <cmmu.s> */ #define STORE_CMD 0 @@ -307,7 +262,7 @@ extern vm_offset_t kmapva; sdt = (sdt_entry_t *)kmapva + SDTIDX(va) + SDT_ENTRIES; \ (pte_template_t *)(sdt->table_addr << PDT_SHIFT) + PDTIDX(va); \ }) -u_int kvtop( ); +extern u_int kvtop __P((vm_offset_t)); #define DMA_CACHE_SYNC 0x1 #define DMA_CACHE_SYNC_INVAL 0x2 diff --git a/sys/arch/mvme88k/include/pmap.h b/sys/arch/mvme88k/include/pmap.h index 5d7676c26f0..35b6ca62894 100644 --- a/sys/arch/mvme88k/include/pmap.h +++ b/sys/arch/mvme88k/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.11 2001/01/13 05:18:59 smurph Exp $ */ +/* $OpenBSD: pmap.h,v 1.12 2001/06/14 21:30:40 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1991 Carnegie Mellon University @@ -74,9 +74,7 @@ extern struct pmap kernel_pmap_store; #define pmap_kernel() (&kernel_pmap_store) #define pmap_resident_count(pmap) ((pmap)->stats.resident_count) /* Used in builtin/device_pager.c */ -#define pmap_phys_address(frame) ((vm_offset_t) (M88K_PTOB(frame))) -/* Used in kern/mach_timedev.c */ -#define pmap_phys_to_frame(phys) ((int) (M88K_BTOP(phys))) +#define pmap_phys_address(frame) ((vm_offset_t) (ptoa(frame))) #define PMAP_ACTIVATE(proc) pmap_activate(proc) #define PMAP_DEACTIVATE(proc) pmap_deactivate(proc) @@ -97,7 +95,6 @@ extern struct pmap kernel_pmap_store; void pmap_activate(struct proc *p); void pmap_deactivate(struct proc *p); -int pmap_check_transaction(pmap_t pmap, vm_offset_t va, vm_prot_t type); vm_offset_t pmap_map( vm_offset_t virt, @@ -127,8 +124,6 @@ vm_offset_t pmap_extract_unlocked(pmap_t pmap, vm_offset_t va); void copy_to_phys(vm_offset_t srcva, vm_offset_t dstpa, int bytecount); void copy_from_phys(vm_offset_t srcpa, vm_offset_t dstva, int bytecount); void pmap_redzone(pmap_t pmap, vm_offset_t va); -boolean_t pmap_verify_free(vm_offset_t phys); -boolean_t pmap_valid_page(vm_offset_t p); void icache_flush(vm_offset_t pa); void pmap_dcache_flush(pmap_t pmap, vm_offset_t va); void pmap_cache_flush(pmap_t pmap, vm_offset_t virt, int bytes, int mode); diff --git a/sys/arch/mvme88k/include/vmparam.h b/sys/arch/mvme88k/include/vmparam.h index 9c1cb050964..0d85c23b848 100644 --- a/sys/arch/mvme88k/include/vmparam.h +++ b/sys/arch/mvme88k/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.11 2001/05/06 00:45:53 art Exp $ */ +/* $OpenBSD: vmparam.h,v 1.12 2001/06/14 21:30:40 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1992 Carnegie Mellon University @@ -26,15 +26,7 @@ */ /* - * HISTORY - */ -/* - * File: vm_param.h - * * machine dependent virtual memory parameters. - * Most of the declarations are preceeded by M88K_ (or m88k_) - * which is OK because only M88K specific code will be using - * them. */ @@ -129,55 +121,24 @@ /* * Mach derived constants */ -#define BYTE_SIZE 8 /* byte size in bits */ - -#define M88K_PGBYTES (1<<12) /* bytes per m88k page */ -#define M88K_PGSHIFT 12 /* number of bits to shift for pages */ - -/* - * Convert bytes to pages and convert pages to bytes. - * No rounding is used. - */ - -#define m88k_btop(x) (((unsigned)(x)) >> M88K_PGSHIFT) -#define m88k_ptob(x) (((unsigned)(x)) << M88K_PGSHIFT) - -/* - * Round off or truncate to the nearest page. These will work - * for either addresses or counts. (i.e. 1 byte rounds to 1 page - * bytes. - */ - -#define m88k_round_page(x) ((((unsigned)(x)) + M88K_PGBYTES - 1) & \ - ~(M88K_PGBYTES-1)) -#define m88k_trunc_page(x) (((unsigned)(x)) & ~(M88K_PGBYTES-1)) - -#define VM_MIN_ADDRESS ((vm_offset_t) 0) -#define VM_MAX_ADDRESS ((vm_offset_t) 0xffc00000U) +#define VM_MIN_ADDRESS ((vm_offset_t) 0) +#define VM_MAX_ADDRESS ((vm_offset_t) 0xffc00000U) #define VM_MIN_USER_ADDRESS ((vm_offset_t) 0) -#define VM_MAX_USER_ADDRESS ((vm_offset_t) 0xffc00000U) +#define VM_MAX_USER_ADDRESS ((vm_offset_t) 0xffc00000U) /* on vme188, max = 0xf0000000 */ #define VM_MIN_KERNEL_ADDRESS ((vm_offset_t) 0) #define VM_MAX_KERNEL_ADDRESS ((vm_offset_t) 0x1fffffff) -#define KERNEL_STACK_SIZE (3*4096) /* kernel stack size */ -#define INTSTACK_SIZE (3*4096) /* interrupt stack size */ +#define KERNEL_STACK_SIZE (3 * PAGE_SIZE) /* kernel stack size */ +#define INTSTACK_SIZE (3 * PAGE_SIZE) /* interrupt stack size */ /* virtual sizes (bytes) for various kernel submaps */ -#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) -#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) - -/* - * Conversion between MACHINE pages and VM pages - */ - -#define trunc_m88k_to_vm(p) (atop(trunc_page(m88k_ptob(p)))) -#define round_m88k_to_vm(p) (atop(round_page(m88k_ptob(p)))) -#define vm_to_m88k(p) (m88k_btop(ptoa(p))) +#define VM_MBUF_SIZE (NMBCLUSTERS * MCLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS * PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE) /* Use new VM page bootstrap interface. */ #define MACHINE_NEW_NONCONTIG @@ -185,7 +146,7 @@ #if defined(MACHINE_NEW_NONCONTIG) /* * Constants which control the way the VM system deals with memory segments. - * The hp300 only has one physical memory segment. + * The mvme88k only has one physical memory segment. */ #define VM_PHYSSEG_MAX 1 #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH @@ -207,52 +168,4 @@ struct pmap_physseg { #endif /* MACHINE_NEW_NONCONTIG */ - -#if 1 /*Do we really need all this stuff*/ -#if 1 /*Do we really need all this stuff*/ -#if 1 /*Do we really need all this stuff*/ -#define M88K_SGPAGES (1<<10) /* pages per m88k segment */ -#define M88K_SGPGSHIFT 10 /* number of bits to shift for segment-page */ -#define M88K_ALSEGMS (1<<10) /* segments per m88k all space */ -#define M88K_ALSGSHIFT 10 /* number of bits to shift for all-segment */ - -#define M88K_SGBYTES (1<<22) /* bytes per m88k segments */ -#define M88K_SGSHIFT 22 /* number of bits to shift for segment */ -#define M88K_ALPAGES (1<<20) /* pages per m88k all space */ -#define M88K_ALPGSHIFT 20 /* number of bits to shift for all-page */ - -/* - * Convert bytes to pages and convert pages to bytes. - * No rounding is used. - */ - -#define m88k_btopr(x) (((unsigned)(x) + (M88K_PGBYTES - 1)) >> M88K_PGSHIFT) -#define m88k_btosr(x) (((unsigned)(x) + (M88K_SGBYTES - 1)) >> M88K_SGSHIFT) -#define m88k_btos(x) (((unsigned)(x)) >> M88K_SGSHIFT) -#define m88k_stob(x) (((unsigned)(x)) << M88K_SGSHIFT) -#define m88k_ptosr(x) (((unsigned)(x) + (M88K_SGPAGES - 1)) >> M88K_SGPGSHIFT) -#define m88k_ptos(x) (((unsigned)(x)) >> M88K_SGPGSHIFT) -#define m88k_stop(x) (((unsigned)(x)) << M88K_SGPGSHIFT) - -/* - * Round off or truncate to the nearest page. These will work - * for either addresses or counts. (i.e. 1 byte rounds to 1 page - * bytes. - */ - -#define m88k_round_segm(x) ((((unsigned)(x)) + M88K_SGBYTES - 1) & \ - ~(M88K_SGBYTES-1)) -#define m88k_next_segm(x) ((((unsigned)(x)) & ~(M88K_SGBYTES-1)) + \ - M88K_SGBYTES) -#define m88k_trunc_segm(x) (((unsigned)(x)) & ~(M88K_SGBYTES-1)) - -#define m88k_round_seg(x) ((((unsigned)(x)) + M88K_SGBYTES - 1) & \ - ~(M88K_SGBYTES-1)) -#define m88k_trunc_seg(x) (((unsigned)(x)) & ~(M88K_SGBYTES-1)) - -#define VEQR_ADDR 0x20000000 /* kernel virtual eq phy mapping */ -#endif /* Do we really need all this stuff */ -#endif /* Do we really need all this stuf */ -#endif /* Do we really need all this stuff */ - #endif _MACHINE_VM_PARAM_ diff --git a/sys/arch/mvme88k/mvme88k/locore.S b/sys/arch/mvme88k/mvme88k/locore.S index 005d7af47a9..206ae01fd39 100644 --- a/sys/arch/mvme88k/mvme88k/locore.S +++ b/sys/arch/mvme88k/mvme88k/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.16 2001/05/20 05:53:09 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.17 2001/06/14 21:30:45 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -59,10 +59,12 @@ #include "assym.h" #include "ksyms.h" + #include <machine/asm.h> #include <machine/trap.h> #include <machine/m88100.h> #include <machine/psl.h> +#include <machine/param.h> #include <machine/vmparam.h> /* INTSTACK_SIZE */ /***********************************************************************/ @@ -138,7 +140,7 @@ LABEL(_start_text) /* This is the *real* start upon poweron or reset */ * r5 start of mini * r6 end miniroot * r7 ((Clun << 8) ; Dlun & FF) -> bootdev - * r8 cpu type (0x187, 0x188, 1x197) + * r8 cpu type (0x187, 0x188, 0x197) */ /* * (*entry)(flag, bugargs.ctrl_addr, cp, kernel.smini, diff --git a/sys/arch/mvme88k/mvme88k/m18x_cmmu.c b/sys/arch/mvme88k/mvme88k/m18x_cmmu.c index ee7d0334b1d..c8192dc6593 100644 --- a/sys/arch/mvme88k/mvme88k/m18x_cmmu.c +++ b/sys/arch/mvme88k/mvme88k/m18x_cmmu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m18x_cmmu.c,v 1.8 2001/03/18 01:49:39 miod Exp $ */ +/* $OpenBSD: m18x_cmmu.c,v 1.9 2001/06/14 21:30:45 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -1243,7 +1243,7 @@ m18x_cmmu_flush_remote_tlb(cpu, kernel, vaddr, size) cpu = cpu_number(); } - if ((unsigned)size > M88K_PGBYTES) { + if ((unsigned)size > PAGE_SIZE) { /* REGS(cpu, INST_CMMU).scr = REGS(cpu, DATA_CMMU).scr = @@ -2000,7 +2000,7 @@ m18x_cmmu_show_translation(address, supervisor_flag, verbose_flag, cmmu_num) thread->task->map, thread->task->map->pmap); } apr_data.bits = 0; - apr_data.field.st_base = M88K_BTOP(thread->task->map->pmap->sdt_paddr); + apr_data.field.st_base = atop(thread->task->map->pmap->sdt_paddr); apr_data.field.wt = 0; apr_data.field.g = 1; apr_data.field.ci = 0; diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 6467102d8ea..5365ed59d08 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.39 2001/06/13 21:24:52 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.40 2001/06/14 21:30:45 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -508,9 +508,9 @@ cpu_startup() sz = (int)allocsys((caddr_t)0); #if defined(UVM) - if ((v = (caddr_t)uvm_km_zalloc(kernel_map, m88k_round_page(sz))) == 0) + if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(sz))) == 0) #else - if ((v = (caddr_t)kmem_alloc(kernel_map, m88k_round_page(sz))) == 0) + if ((v = (caddr_t)kmem_alloc(kernel_map, round_page(sz))) == 0) #endif panic("startup: no room for tables"); if (allocsys(v) - v != sz) @@ -639,7 +639,7 @@ cpu_startup() */ size = MAXBSIZE * nbuf; #if defined(UVM) - if (uvm_map(kernel_map, (vaddr_t *) &buffers, m88k_round_page(size), + 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) @@ -2277,7 +2277,7 @@ mvme_bootstrap(void) #else vm_set_page_size(); #endif - first_addr = m88k_round_page(first_addr); + first_addr = round_page(first_addr); if (!no_symbols) boothowto |= RB_KDB; @@ -2305,11 +2305,11 @@ mvme_bootstrap(void) /* * Steal MSGBUFSIZE at the top of physical memory for msgbuf */ - avail_end -= m88k_round_page(MSGBUFSIZE); + avail_end -= round_page(MSGBUFSIZE); #ifdef DEBUG printf("MVME%x boot: memory from 0x%x to 0x%x\n", cputyp, avail_start, avail_end); #endif - pmap_bootstrap((vm_offset_t)M88K_TRUNC_PAGE((unsigned)&kernelstart) /* = loadpt */, + pmap_bootstrap((vm_offset_t)trunc_page((unsigned)&kernelstart) /* = loadpt */, &avail_start, &avail_end, &virtual_avail, &virtual_end); diff --git a/sys/arch/mvme88k/mvme88k/pmap.c b/sys/arch/mvme88k/mvme88k/pmap.c index f647a14b34b..bfc7d3ccb57 100644 --- a/sys/arch/mvme88k/mvme88k/pmap.c +++ b/sys/arch/mvme88k/mvme88k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.28 2001/06/08 08:09:14 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.29 2001/06/14 21:30:46 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * All rights reserved. @@ -44,9 +44,6 @@ */ /* don't want to make them general yet. */ -#ifdef luna88k - #define OMRON_PMAP -#endif #define OMRON_PMAP /*#define DEBUG 1*/ @@ -166,19 +163,19 @@ STATIC kpdt_entry_t kpdt_free; /* * Size of kernel page tables, which is enough to map MAX_KERNEL_VA_SIZE */ -#define KERNEL_PDT_SIZE (M88K_BTOP(MAX_KERNEL_VA_SIZE) * sizeof(pt_entry_t)) +#define KERNEL_PDT_SIZE (atop(MAX_KERNEL_VA_SIZE) * sizeof(pt_entry_t)) /* * Size of kernel page tables for mapping onboard IO space. */ #if defined(MVME188) -#define M188_PDT_SIZE (M88K_BTOP(UTIL_SIZE) * sizeof(pt_entry_t)) +#define M188_PDT_SIZE (atop(UTIL_SIZE) * sizeof(pt_entry_t)) #else #define M188_PDT_SIZE 0 #endif #if (defined(MVME187) || defined(MVME197)) -#define M1x7_PDT_SIZE (M88K_BTOP(OBIO_SIZE) * sizeof(pt_entry_t)) +#define M1x7_PDT_SIZE (atop(OBIO_SIZE) * sizeof(pt_entry_t)) #else #define M1x7_PDT_SIZE 0 #endif @@ -192,8 +189,6 @@ STATIC kpdt_entry_t kpdt_free; */ vm_offset_t phys_map_vaddr1, phys_map_vaddr2; -int ptes_per_vm_page; /* no. of ptes required to map one VM page */ - #define PMAP_MAX 512 /* @@ -341,7 +336,6 @@ int etherlen; /* * This variable extract vax's pmap.c. - * pmap_verify_free refer to this. * pmap_init initialize this. * '90.7.17 Fuzzy */ @@ -416,7 +410,7 @@ flush_atc_entry(long users, vm_offset_t va, int kernel) #endif while ((cpu = ff1(tusers)) != 32) { if (cpu_sets[cpu]) { /* just checking to make sure */ - cmmu_flush_remote_tlb(cpu, kernel, va, M88K_PGBYTES); + cmmu_flush_remote_tlb(cpu, kernel, va, PAGE_SIZE); } tusers &= ~(1 << cpu); } @@ -631,9 +625,9 @@ pmap_map(vm_offset_t virt, vm_offset_t start, vm_offset_t end, vm_prot_t prot) aprot = m88k_protection (kernel_pmap, prot); - template.bits = M88K_TRUNC_PAGE(start) | aprot | cmode | DT_VALID; + template.bits = trunc_page(start) | aprot | cmode | DT_VALID; - npages = M88K_BTOP(M88K_ROUND_PAGE(end) - M88K_TRUNC_PAGE(start)); + npages = atop(round_page(end) - trunc_page(start)); for (num_phys_pages = npages; num_phys_pages > 0; num_phys_pages--) { @@ -657,8 +651,8 @@ pmap_map(vm_offset_t virt, vm_offset_t start, vm_offset_t end, vm_prot_t prot) } } #endif - virt += M88K_PGBYTES; - template.bits += M88K_PGBYTES; + virt += PAGE_SIZE; + template.bits += PAGE_SIZE; } return (virt); @@ -732,7 +726,7 @@ pmap_map_batc(vm_offset_t virt, vm_offset_t start, vm_offset_t end, panic("pmap_map_batc: start greater than end address"); aprot = m88k_protection (kernel_pmap, prot); - template.bits = M88K_TRUNC_PAGE(start) | aprot | DT_VALID | cmode; + template.bits = trunc_page(start) | aprot | DT_VALID | cmode; phys = start; batctmp.bits = 0; batctmp.field.sup = 1; /* supervisor */ @@ -742,8 +736,8 @@ pmap_map_batc(vm_offset_t virt, vm_offset_t start, vm_offset_t end, batctmp.field.wp = template.pte.prot; /* protection */ batctmp.field.v = 1; /* valid */ - num_phys_pages = M88K_BTOP(M88K_ROUND_PAGE(end) - - M88K_TRUNC_PAGE(start)); + num_phys_pages = atop(round_page(end) - + trunc_page(start)); while (num_phys_pages > 0) { @@ -754,7 +748,7 @@ pmap_map_batc(vm_offset_t virt, vm_offset_t start, vm_offset_t end, #endif if ( BATC_BLK_ALIGNED(virt) && BATC_BLK_ALIGNED(phys) && - num_phys_pages >= BATC_BLKBYTES/M88K_PGBYTES && + num_phys_pages >= BATC_BLKBYTES/PAGE_SIZE && batc_used < BATC_MAX ) { /* * map by BATC @@ -773,7 +767,7 @@ pmap_map_batc(vm_offset_t virt, vm_offset_t start, vm_offset_t end, } if (pmap_con_dbg & CD_MAPB) { - for (i = 0; i < BATC_BLKBYTES; i += M88K_PGBYTES ) { + for (i = 0; i < BATC_BLKBYTES; i += PAGE_SIZE ) { pte = pmap_pte(kernel_pmap, virt+i); if (pte->dtype) printf("(pmap_map_batc :%x) va %x is already mapped : pte %x\n", curproc, virt+i, ((pte_template_t *)pte)->bits); @@ -783,8 +777,8 @@ pmap_map_batc(vm_offset_t virt, vm_offset_t start, vm_offset_t end, batc_used++; virt += BATC_BLKBYTES; phys += BATC_BLKBYTES; - template.pte.pfn = M88K_BTOP(phys); - num_phys_pages -= BATC_BLKBYTES/M88K_PGBYTES; + template.pte.pfn = atop(phys); + num_phys_pages -= BATC_BLKBYTES/PAGE_SIZE; continue; } if ((pte = pmap_pte(kernel_pmap, virt)) == PT_ENTRY_NULL) @@ -798,13 +792,13 @@ pmap_map_batc(vm_offset_t virt, vm_offset_t start, vm_offset_t end, #endif *pte = template.pte; - virt += M88K_PGBYTES; - phys += M88K_PGBYTES; - template.bits += M88K_PGBYTES; + virt += PAGE_SIZE; + phys += PAGE_SIZE; + template.bits += PAGE_SIZE; num_phys_pages--; } - return (M88K_ROUND_PAGE(virt)); + return (round_page(virt)); } /* pmap_map_batc() */ @@ -877,7 +871,7 @@ pmap_cache_ctrl(pmap_t pmap, vm_offset_t s, vm_offset_t e, unsigned mode) kflush = 0; } - for (va = s; va < e; va += M88K_PGBYTES) { + for (va = s; va < e; va += PAGE_SIZE) { if ((pte = pmap_pte(pmap, va)) == PT_ENTRY_NULL) continue; #ifdef DEBUG @@ -902,10 +896,8 @@ pmap_cache_ctrl(pmap_t pmap, vm_offset_t s, vm_offset_t e, unsigned mode) */ for (cpu=0; cpu<max_cpus; cpu++) if (cpu_sets[cpu]) - /*cmmu_flush_remote_data_cache(cpu, - M88K_PTOB(pte->pfn),M88K_PGBYTES);*/ - cmmu_flush_remote_cache(cpu, M88K_PTOB(pte->pfn), - M88K_PGBYTES); + cmmu_flush_remote_cache(cpu, ptoa(pte->pfn), + PAGE_SIZE); } @@ -988,10 +980,6 @@ pmap_bootstrap(vm_offset_t load_start, /* IN */ printf("pmap_bootstrap : \"load_start\" 0x%x\n", load_start); } #endif - ptes_per_vm_page = PAGE_SIZE >> M88K_PGSHIFT; - if (ptes_per_vm_page == 0) { - panic("pmap_bootstrap: VM page size < MACHINE page size"); - } if (!PAGE_ALIGNED(load_start)) { panic("pmap_bootstrap : \"load_start\" not on the m88k page boundary : 0x%x", load_start); } @@ -1014,9 +1002,9 @@ pmap_bootstrap(vm_offset_t load_start, /* IN */ * 0, making *virt_start == *phys_start, giving a 1-to-1 map) */ - *phys_start = M88K_ROUND_PAGE(*phys_start); + *phys_start = round_page(*phys_start); *virt_start = *phys_start + - (M88K_TRUNC_PAGE((unsigned)&kernelstart) - load_start); + (trunc_page((unsigned)&kernelstart) - load_start); /* * Initialize kernel_pmap structure @@ -1094,9 +1082,9 @@ pmap_bootstrap(vm_offset_t load_start, /* IN */ s_text = load_start; /* paddr of text */ e_text = load_start + ((unsigned)&etext - - M88K_TRUNC_PAGE((unsigned)&kernelstart)); + trunc_page((unsigned)&kernelstart)); /* paddr of end of text section*/ - e_text = M88K_ROUND_PAGE(e_text); + e_text = round_page(e_text); #ifdef OMRON_PMAP #define PMAPER pmap_map @@ -1111,11 +1099,11 @@ pmap_bootstrap(vm_offset_t load_start, /* IN */ 0x10000, (VM_PROT_WRITE | VM_PROT_READ)|(CACHE_INH <<16)); - assert(vaddr == M88K_TRUNC_PAGE((unsigned)&kernelstart)); + assert(vaddr == trunc_page((unsigned)&kernelstart)); /* map the kernel text read only */ vaddr = PMAPER( - (vm_offset_t)M88K_TRUNC_PAGE(((unsigned)&kernelstart)), + (vm_offset_t)trunc_page(((unsigned)&kernelstart)), s_text, e_text, (VM_PROT_WRITE | VM_PROT_READ)|(CACHE_GLOBAL<<16)); /* shouldn't it be RO? XXX*/ @@ -1138,7 +1126,7 @@ pmap_bootstrap(vm_offset_t load_start, /* IN */ } #endif while (vaddr < (*virt_start - kernel_pmap_size)) - vaddr = M88K_ROUND_PAGE(vaddr + 1); + vaddr = round_page(vaddr + 1); } vaddr = PMAPER( vaddr, @@ -1288,7 +1276,7 @@ pmap_bootstrap(vm_offset_t load_start, /* IN */ */ apr_data.bits = 0; - apr_data.field.st_base = M88K_BTOP(kernel_pmap->sdt_paddr); + apr_data.field.st_base = atop(kernel_pmap->sdt_paddr); apr_data.field.wt = 1; apr_data.field.g = 1; apr_data.field.ci = 0; @@ -1576,7 +1564,7 @@ pmap_init(vm_offset_t phys_start, vm_offset_t phys_end) * '90.9.05 Fuzzy * Bug: template page invalid --> template page valid * - * template = M88K_TRUNC_PAGE(phys) + * template = trunc_page(phys) * | m88k_protection (kernel_pmap, VM_PROT_READ | VM_PROT_WRITE) * | DT_VALID; * ^^^^^^^^ add @@ -1591,10 +1579,9 @@ pmap_init(vm_offset_t phys_start, vm_offset_t phys_end) * phys_map_vaddr1 * * Calls: - * M88K_TRUNC_PAGE + * trunc_page * m88k_protection * cmmu_sflush_page - * DO_PTES * bzero * * Special Assumptions: @@ -1609,7 +1596,6 @@ pmap_zero_page(vm_offset_t phys) { vm_offset_t srcva; pte_template_t template; - unsigned int i; unsigned int spl_sav; int my_cpu; pt_entry_t *srcpte; @@ -1618,19 +1604,17 @@ pmap_zero_page(vm_offset_t phys) srcva = (vm_offset_t)(phys_map_vaddr1 + (my_cpu * PAGE_SIZE)); srcpte = pmap_pte(kernel_pmap, srcva); - for (i = 0; i < ptes_per_vm_page; i++, phys += M88K_PGBYTES) { - template.bits = M88K_TRUNC_PAGE(phys) - | m88k_protection(kernel_pmap, VM_PROT_READ | VM_PROT_WRITE) - | DT_VALID | CACHE_GLOBAL; - - spl_sav = splimp(); - cmmu_flush_tlb(1, srcva, M88K_PGBYTES); - *srcpte = template.pte; - splx(spl_sav); - bzero((void*)srcva, M88K_PGBYTES); - /* force the data out */ - cmmu_flush_remote_data_cache(my_cpu,phys, M88K_PGBYTES); - } + template.bits = trunc_page(phys) + | m88k_protection(kernel_pmap, VM_PROT_READ | VM_PROT_WRITE) + | DT_VALID | CACHE_GLOBAL; + + spl_sav = splimp(); + cmmu_flush_tlb(1, srcva, PAGE_SIZE); + *srcpte = template.pte; + splx(spl_sav); + bzero((void*)srcva, PAGE_SIZE); + /* force the data out */ + cmmu_flush_remote_data_cache(my_cpu,phys, PAGE_SIZE); } /* pmap_zero_page() */ /* @@ -1688,12 +1672,11 @@ pmap_pinit(pmap_t p) sdt_entry_t *segdt; int i; unsigned int s; - vm_offset_t addr; /* * Allocate memory for *actual* segment table and *shadow* table. */ - s = M88K_ROUND_PAGE(2 * SDT_SIZE); + s = round_page(2 * SDT_SIZE); #ifdef DEBUG if ((pmap_con_dbg & (CD_CREAT | CD_NORM)) == (CD_CREAT | CD_NORM)) { printf("(pmap_create :%x) need %d pages for sdt\n", @@ -1987,7 +1970,7 @@ pmap_reference(pmap_t p) * SDT_NEXT * pmap_pte * PDT_VALID - * M88K_PTOB + * ptoa * PMAP_MANAGED * LOCK_PVH * UNLOCK_PVH @@ -2023,7 +2006,6 @@ pmap_remove_range(pmap_t pmap, vm_offset_t s, vm_offset_t e) int pfn; int num_removed = 0; int num_unwired = 0; - register int i; pt_entry_t *pte; pv_entry_t prev, cur; pv_entry_t pvl; @@ -2080,7 +2062,7 @@ pmap_remove_range(pmap_t pmap, vm_offset_t s, vm_offset_t e) num_unwired++; pfn = pte->pfn; - pa = M88K_PTOB(pfn); + pa = ptoa(pfn); if (PMAP_MANAGED(pa)) { LOCK_PVH(pa); @@ -2133,31 +2115,26 @@ pmap_remove_range(pmap_t pmap, vm_offset_t s, vm_offset_t e) } /* if PAGE_MANAGED */ /* - * For each pte in vm_page (NOTE: vm_page, not - * M88K (machine dependent) page !! ), reflect - * modify bits to pager and zero (invalidate, + * Reflect modify bits to pager and zero (invalidate, * remove) the pte entry. */ tva = va; - for (i = ptes_per_vm_page; i > 0; i--) { - /* - * Invalidate pte temporarily to avoid being written back - * the modified bit and/or the reference bit by other cpu. - */ - opte.bits = invalidate_pte(pte); - flush_atc_entry(users, tva, kflush); + /* + * Invalidate pte temporarily to avoid being written back + * the modified bit and/or the reference bit by other cpu. + */ + opte.bits = invalidate_pte(pte); + flush_atc_entry(users, tva, kflush); - if (opte.pte.modified) { - if (IS_VM_PHYSADDR(pa)) { - vm_page_set_modified(PHYS_TO_VM_PAGE(opte.bits & M88K_PGMASK)); - } - /* keep track ourselves too */ - if (PMAP_MANAGED(pa)) - SET_ATTRIB(pa, 1); + if (opte.pte.modified) { + if (IS_VM_PHYSADDR(pa)) { + vm_page_set_modified( + PHYS_TO_VM_PAGE(opte.bits & ~PAGE_MASK)); } - pte++; - tva += M88K_PGBYTES; + /* keep track ourselves too */ + if (PMAP_MANAGED(pa)) + SET_ATTRIB(pa, 1); } } /* end for ( va = s; ...) */ @@ -2236,7 +2213,7 @@ pmap_remove(pmap_t map, vm_offset_t s, vm_offset_t e) * PA_TO_PVH * CHECK_PV_LIST * simple_lock - * M88K_PTOB + * ptoa * PDT_VALID * pmap_pte * vm_page_set_modified @@ -2261,7 +2238,6 @@ pmap_remove_all(vm_offset_t phys) { pv_entry_t pvl, cur; register pt_entry_t *pte; - register int i; register vm_offset_t va; register pmap_t pmap; int spl; @@ -2320,7 +2296,7 @@ remove_all_Retry: } if (!PDT_VALID(pte)) panic("pmap_remove_all: pte invalid"); - if (M88K_PTOB(pte->pfn) != phys) + if (ptoa(pte->pfn) != phys) panic("pmap_remove_all: pte doesn't point to page"); if (pte->wired) panic("pmap_remove_all: removing a wired page"); @@ -2335,23 +2311,18 @@ remove_all_Retry: /* * Reflect modified pages to pager. + * + * Invalidate pte temporarily to avoid the modified + * bit and/or the reference bit being written back + * by other cpu. */ - for (i = ptes_per_vm_page; i>0; i--) { - /* - * Invalidate pte temporarily to avoid the modified - * bit and/or the reference bit being written back - * by other cpu. - */ - opte.bits = invalidate_pte(pte); - flush_atc_entry(users, va, kflush); + opte.bits = invalidate_pte(pte); + flush_atc_entry(users, va, kflush); - if (opte.pte.modified) { - vm_page_set_modified((vm_page_t)PHYS_TO_VM_PAGE(phys)); - /* keep track ourselves too */ - SET_ATTRIB(phys, 1); - } - pte++; - va += M88K_PGBYTES; + if (opte.pte.modified) { + vm_page_set_modified((vm_page_t)PHYS_TO_VM_PAGE(phys)); + /* keep track ourselves too */ + SET_ATTRIB(phys, 1); } /* @@ -2385,7 +2356,7 @@ remove_all_Retry: * simple_lock, simple_unlock * panic * PDT_VALID - * M88K_PTOB + * ptoa * pmap_pte * * Special Assumptions: @@ -2400,7 +2371,6 @@ pmap_copy_on_write(vm_offset_t phys) { register pv_entry_t pv_e; register pt_entry_t *pte; - register int i; int spl, spl_sav; register unsigned users; register pte_template_t opte; @@ -2463,28 +2433,23 @@ copy_on_write_Retry: panic("pmap_copy_on_write: pte from pv_list not in map"); if (!PDT_VALID(pte)) panic("pmap_copy_on_write: invalid pte"); - if (M88K_PTOB(pte->pfn) != phys) + if (ptoa(pte->pfn) != phys) panic("pmap_copy_on_write: pte doesn't point to page"); /* * Flush TLBs of which cpus using pmap. + * + * Invalidate pte temporarily to avoid the modified + * bit and/or the reference bit being written back + * by other cpu. */ - - for (i = ptes_per_vm_page; i > 0; i--) { - /* - * Invalidate pte temporarily to avoid the modified - * bit and/or the reference bit being written back - * by other cpu. - */ - spl_sav = splimp(); - opte.bits = invalidate_pte(pte); - opte.pte.prot = M88K_RO; - ((pte_template_t *)pte)->bits = opte.bits; - flush_atc_entry(users, va, kflush); - splx(spl_sav); - pte++; - va += M88K_PGBYTES; - } + spl_sav = splimp(); + opte.bits = invalidate_pte(pte); + opte.pte.prot = M88K_RO; + ((pte_template_t *)pte)->bits = opte.bits; + flush_atc_entry(users, va, kflush); + splx(spl_sav); + simple_unlock(&pmap->lock); pv_e = pv_e->next; } @@ -2528,9 +2493,8 @@ pmap_protect(pmap_t pmap, vm_offset_t s, vm_offset_t e, vm_prot_t prot) pte_template_t maprot; unsigned ap; int spl, spl_sav; - register int i; pt_entry_t *pte; - vm_offset_t va, tva; + vm_offset_t va; register unsigned users; register pte_template_t opte; int kflush; @@ -2589,22 +2553,18 @@ pmap_protect(pmap_t pmap, vm_offset_t s, vm_offset_t e, vm_prot_t prot) #if 0 printf("(pmap_protect :%x) pte good\n", curproc); #endif - tva = va; - for (i = ptes_per_vm_page; i>0; i--) { - /* - * Invalidate pte temporarily to avoid the - * modified bit and/or the reference bit being - * written back by other cpu. - */ - spl_sav = splimp(); - opte.bits = invalidate_pte(pte); - opte.pte.prot = ap; - ((pte_template_t *)pte)->bits = opte.bits; - flush_atc_entry(users, tva, kflush); - splx(spl_sav); - pte++; - tva += M88K_PGBYTES; - } + /* + * Invalidate pte temporarily to avoid the + * modified bit and/or the reference bit being + * written back by other cpu. + */ + spl_sav = splimp(); + opte.bits = invalidate_pte(pte); + opte.pte.prot = ap; + ((pte_template_t *)pte)->bits = opte.bits; + flush_atc_entry(users, va, kflush); + splx(spl_sav); + pte++; } PMAP_UNLOCK(pmap, spl); } /* pmap_protect() */ @@ -2840,7 +2800,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_offset_t pa, pt_entry_t *pte; vm_offset_t old_pa; pte_template_t template; - register int i; pv_entry_t pvl; register unsigned users; register pte_template_t opte; @@ -2897,7 +2856,7 @@ Retry: * Special case if the physical page is already mapped * at this address. */ - old_pa = M88K_PTOB(pte->pfn); + old_pa = ptoa(pte->pfn); if (old_pa == pa) { if (pmap == kernel_pmap) { kflush = 1; @@ -2915,9 +2874,9 @@ Retry: pmap->stats.wired_count--; if ((unsigned long)pa >= MAXPHYSMEM) - template.bits = DT_VALID | ap | M88K_TRUNC_PAGE(pa) | CACHE_INH; + template.bits = DT_VALID | ap | trunc_page(pa) | CACHE_INH; else - template.bits = DT_VALID | ap | M88K_TRUNC_PAGE(pa) | CACHE_GLOBAL; + template.bits = DT_VALID | ap | trunc_page(pa) | CACHE_GLOBAL; if (wired) template.pte.wired = 1; @@ -2927,21 +2886,16 @@ Retry: if ( !PDT_VALID(pte) || (pte->wired != template.pte.wired) || (pte->prot != template.pte.prot)) { - for (i = ptes_per_vm_page; i>0; i--) { - - /* - * Invalidate pte temporarily to avoid being written back - * the modified bit and/or the reference bit by other cpu. - */ - spl_sav = splimp(); - opte.bits = invalidate_pte(pte); - template.pte.modified = opte.pte.modified; - *pte++ = template.pte; - flush_atc_entry(users, va, kflush); - splx(spl_sav); - template.bits += M88K_PGBYTES; - va += M88K_PGBYTES; - } + /* + * Invalidate pte temporarily to avoid being written back + * the modified bit and/or the reference bit by other cpu. + */ + spl_sav = splimp(); + opte.bits = invalidate_pte(pte); + template.pte.modified = opte.pte.modified; + *pte++ = template.pte; + flush_atc_entry(users, va, kflush); + splx(spl_sav); } } else { /* if ( pa == old_pa) */ @@ -3040,14 +2994,14 @@ Retry: pmap->stats.wired_count++; if ((unsigned long)pa >= MAXPHYSMEM) - template.bits = DT_VALID | ap | M88K_TRUNC_PAGE(pa) | CACHE_INH; + template.bits = DT_VALID | ap | trunc_page(pa) | CACHE_INH; else - template.bits = DT_VALID | ap | M88K_TRUNC_PAGE(pa) | CACHE_GLOBAL; + template.bits = DT_VALID | ap | trunc_page(pa) | CACHE_GLOBAL; if (wired) template.pte.wired = 1; - DO_PTES (pte, template.bits); + *(int *)pte = template.bits; } /* if ( pa == old_pa ) ... else */ @@ -3084,7 +3038,6 @@ void pmap_unwire(pmap_t map, vm_offset_t v) { pt_entry_t *pte; - int i; int spl; PMAP_LOCK(map, spl); @@ -3092,12 +3045,11 @@ pmap_unwire(pmap_t map, vm_offset_t v) if ((pte = pmap_pte(map, v)) == PT_ENTRY_NULL) panic ("pmap_unwire: pte missing"); - if (pte->wired) + if (pte->wired) { /* unwired mapping */ map->stats.wired_count--; - - for (i = ptes_per_vm_page; i>0; i--) - (pte++)->wired = 0; + pte->wired = 0; + } PMAP_UNLOCK(map, spl); @@ -3159,12 +3111,12 @@ pmap_extract(pmap_t pmap, vm_offset_t va, paddr_t *pap) goto fail; } else { if (PDT_VALID(pte)) - pa = M88K_PTOB(pte->pfn); + pa = ptoa(pte->pfn); else goto fail; } - pa |= (va & M88K_PGOFSET); /* offset within page */ + pa |= (va & PAGE_MASK); /* offset within page */ *pap = pa; PMAP_UNLOCK(pmap, spl); @@ -3203,13 +3155,13 @@ pmap_extract_unlocked(pmap_t pmap, vm_offset_t va) pa = (vm_offset_t) 0; else { if (PDT_VALID(pte)) - pa = M88K_PTOB(pte->pfn); + pa = ptoa(pte->pfn); else pa = (vm_offset_t) 0; } if (pa) - pa |= (va & M88K_PGOFSET); /* offset within page */ + pa |= (va & PAGE_MASK); /* offset within page */ return (pa); @@ -3479,7 +3431,7 @@ pmap_activate(struct proc *p) simple_lock(&pmap->lock); apr_data.bits = 0; - apr_data.field.st_base = M88K_BTOP(pmap->sdt_paddr); + apr_data.field.st_base = atop(pmap->sdt_paddr); apr_data.field.wt = 0; apr_data.field.g = 1; apr_data.field.ci = 0; @@ -3574,9 +3526,8 @@ pmap_deactivate(struct proc *p) * * Calls: * m88kprotection - * M88K_TRUNC_PAGE + * trunc_page * cmmu_sflush_page - * DO_PTES * bcopy * * Special Assumptions: @@ -3591,7 +3542,6 @@ pmap_copy_page(vm_offset_t src, vm_offset_t dst) { vm_offset_t dstva, srcva; unsigned int spl_sav; - int i; int aprot; pte_template_t template; pt_entry_t *dstpte, *srcpte; @@ -3608,30 +3558,27 @@ pmap_copy_page(vm_offset_t src, vm_offset_t dst) srcpte = pmap_pte(kernel_pmap, srcva); dstpte = pmap_pte(kernel_pmap, dstva); - for (i=0; i < ptes_per_vm_page; i++, - src += M88K_PGBYTES, dst += M88K_PGBYTES) { - template.bits = M88K_TRUNC_PAGE(src) | aprot | - DT_VALID | CACHE_GLOBAL; + template.bits = trunc_page(src) | aprot | + DT_VALID | CACHE_GLOBAL; - /* do we need to write back dirty bits */ - spl_sav = splimp(); - cmmu_flush_tlb(1, srcva, M88K_PGBYTES); - *srcpte = template.pte; + /* do we need to write back dirty bits */ + spl_sav = splimp(); + cmmu_flush_tlb(1, srcva, PAGE_SIZE); + *srcpte = template.pte; - /* - * Map destination physical address. - */ - template.bits = M88K_TRUNC_PAGE(dst) | aprot | - CACHE_GLOBAL | DT_VALID; - cmmu_flush_tlb(1, dstva, M88K_PGBYTES); - *dstpte = template.pte; - splx(spl_sav); + /* + * Map destination physical address. + */ + template.bits = trunc_page(dst) | aprot | + CACHE_GLOBAL | DT_VALID; + cmmu_flush_tlb(1, dstva, PAGE_SIZE); + *dstpte = template.pte; + splx(spl_sav); - bcopy((void*)srcva, (void*)dstva, M88K_PGBYTES); - /* flush source, dest out of cache? */ - cmmu_flush_remote_data_cache(my_cpu, src, M88K_PGBYTES); - cmmu_flush_remote_data_cache(my_cpu, dst, M88K_PGBYTES); - } + bcopy((void*)srcva, (void*)dstva, PAGE_SIZE); + /* flush source, dest out of cache? */ + cmmu_flush_remote_data_cache(my_cpu, src, PAGE_SIZE); + cmmu_flush_remote_data_cache(my_cpu, dst, PAGE_SIZE); } /* pmap_copy_page() */ @@ -3652,9 +3599,8 @@ pmap_copy_page(vm_offset_t src, vm_offset_t dst) * * Calls: * m88kprotection - * M88K_TRUNC_PAGE + * trunc_page * cmmu_sflush_page - * DO_PTES * bcopy * */ @@ -3666,36 +3612,33 @@ copy_to_phys(vm_offset_t srcva, vm_offset_t dstpa, int bytecount) int copy_size, offset, aprot; - unsigned int i; pte_template_t template; dstva = (vm_offset_t)(phys_map_vaddr2 + (cpu_number() * PAGE_SIZE)); dstpte = pmap_pte(kernel_pmap, dstva); - copy_size = M88K_PGBYTES; - offset = dstpa - M88K_TRUNC_PAGE(dstpa); + copy_size = PAGE_SIZE; + offset = dstpa - trunc_page(dstpa); dstpa -= offset; aprot = m88k_protection(kernel_pmap, VM_PROT_READ | VM_PROT_WRITE); while (bytecount > 0) { - copy_size = M88K_PGBYTES - offset; + copy_size = PAGE_SIZE - offset; if (copy_size > bytecount) copy_size = bytecount; /* * Map destination physical address. */ - for (i = 0; i < ptes_per_vm_page; i++) { - template.bits = M88K_TRUNC_PAGE(dstpa) | aprot | CACHE_WT | DT_VALID; - cmmu_flush_tlb(1, dstva, M88K_PGBYTES); - *dstpte = template.pte; - - dstva += offset; - bcopy((void*)srcva, (void*)dstva, copy_size); - srcva += copy_size; - dstva += copy_size; - dstpa += M88K_PGBYTES; - bytecount -= copy_size; - offset = 0; - } + template.bits = trunc_page(dstpa) | aprot | CACHE_WT | DT_VALID; + cmmu_flush_tlb(1, dstva, PAGE_SIZE); + *dstpte = template.pte; + + dstva += offset; + bcopy((void*)srcva, (void*)dstva, copy_size); + srcva += copy_size; + dstva += copy_size; + dstpa += PAGE_SIZE; + bytecount -= copy_size; + offset = 0; } } @@ -3716,9 +3659,8 @@ copy_to_phys(vm_offset_t srcva, vm_offset_t dstpa, int bytecount) * * Calls: * m88kprotection - * M88K_TRUNC_PAGE + * trunc_page * cmmu_sflush_page - * DO_PTES * bcopy * */ @@ -3729,37 +3671,34 @@ copy_from_phys(vm_offset_t srcpa, vm_offset_t dstva, int bytecount) register pt_entry_t *srcpte; register int copy_size, offset; int aprot; - unsigned int i; pte_template_t template; srcva = (vm_offset_t)(phys_map_vaddr2 + (cpu_number() * PAGE_SIZE)); srcpte = pmap_pte(kernel_pmap, srcva); - copy_size = M88K_PGBYTES; - offset = srcpa - M88K_TRUNC_PAGE(srcpa); + copy_size = PAGE_SIZE; + offset = srcpa - trunc_page(srcpa); srcpa -= offset; aprot = m88k_protection(kernel_pmap, VM_PROT_READ | VM_PROT_WRITE); while (bytecount > 0) { - copy_size = M88K_PGBYTES - offset; + copy_size = PAGE_SIZE - offset; if (copy_size > bytecount) copy_size = bytecount; /* * Map destination physical address. */ - for (i=0; i < ptes_per_vm_page; i++) { - template.bits = M88K_TRUNC_PAGE(srcpa) | aprot | CACHE_WT | DT_VALID; - cmmu_flush_tlb(1, srcva, M88K_PGBYTES); - *srcpte = template.pte; - - srcva += offset; - bcopy((void*)srcva, (void*)dstva, copy_size); - srcpa += M88K_PGBYTES; - dstva += copy_size; - srcva += copy_size; - bytecount -= copy_size; - offset = 0; - /* cache flush source? */ - } + template.bits = trunc_page(srcpa) | aprot | CACHE_WT | DT_VALID; + cmmu_flush_tlb(1, srcva, PAGE_SIZE); + *srcpte = template.pte; + + srcva += offset; + bcopy((void*)srcva, (void*)dstva, copy_size); + srcpa += PAGE_SIZE; + dstva += copy_size; + srcva += copy_size; + bytecount -= copy_size; + offset = 0; + /* cache flush source? */ } } @@ -3778,7 +3717,7 @@ copy_from_phys(vm_offset_t srcpa, vm_offset_t dstva, int bytecount) * be restricted to read-only * * Calls: - * M88K_ROUND_PAGE + * round_page * PMAP_LOCK * pmap_pte * PDT_VALID @@ -3792,12 +3731,11 @@ pmap_redzone(pmap_t pmap, vm_offset_t va) { pt_entry_t *pte; int spl, spl_sav; - int i; unsigned users; pte_template_t opte; int kflush; - va = M88K_ROUND_PAGE(va); + va = round_page(va); PMAP_LOCK(pmap, spl); users = pmap->cpus_using; @@ -3807,22 +3745,18 @@ pmap_redzone(pmap_t pmap, vm_offset_t va) kflush = 0; } - if ((pte = pmap_pte(pmap, va)) != PT_ENTRY_NULL && PDT_VALID(pte)) - for (i = ptes_per_vm_page; i > 0; i--) { - - /* - * Invalidate pte temporarily to avoid being written back - * the modified bit and/or the reference bit by other cpu. - */ - spl_sav = splimp(); - opte.bits = invalidate_pte(pte); - opte.pte.prot = M88K_RO; - ((pte_template_t *)pte)->bits = opte.bits; - flush_atc_entry(users, va, kflush); - splx(spl_sav); - pte++; - va +=M88K_PGBYTES; - } + if ((pte = pmap_pte(pmap, va)) != PT_ENTRY_NULL && PDT_VALID(pte)) { + /* + * Invalidate pte temporarily to avoid being written back + * the modified bit and/or the reference bit by other cpu. + */ + spl_sav = splimp(); + opte.bits = invalidate_pte(pte); + opte.pte.prot = M88K_RO; + ((pte_template_t *)pte)->bits = opte.bits; + flush_atc_entry(users, va, kflush); + splx(spl_sav); + } PMAP_UNLOCK(pmap, spl); @@ -3865,7 +3799,6 @@ pmap_clear_modify(vm_offset_t phys) pmap_t pmap; int spl, spl_sav; vm_offset_t va; - int i; unsigned users; pte_template_t opte; int kflush; @@ -3918,21 +3851,18 @@ clear_modify_Retry: if (pte == PT_ENTRY_NULL) panic("pmap_clear_modify: bad pv list entry."); - for (i = ptes_per_vm_page; i > 0; i--) { - /* - * Invalidate pte temporarily to avoid the modified bit - * and/or the reference being written back by other cpu. - */ - spl_sav = splimp(); - opte.bits = invalidate_pte(pte); - /* clear modified bit */ - opte.pte.modified = 0; - ((pte_template_t *)pte)->bits = opte.bits; - flush_atc_entry(users, va, kflush); - splx(spl_sav); - pte++; - va += M88K_PGBYTES; - } + /* + * Invalidate pte temporarily to avoid the modified bit + * and/or the reference being written back by other cpu. + */ + spl_sav = splimp(); + opte.bits = invalidate_pte(pte); + /* clear modified bit */ + opte.pte.modified = 0; + ((pte_template_t *)pte)->bits = opte.bits; + flush_atc_entry(users, va, kflush); + splx(spl_sav); + simple_unlock(&pmap->lock); pvep = pvep->next; } @@ -3982,7 +3912,6 @@ pmap_is_modified(vm_offset_t phys) pv_entry_t pvep; pt_entry_t *ptep; int spl; - int i; boolean_t modified_flag; if (!PMAP_MANAGED(phys)) { @@ -4037,18 +3966,15 @@ pmap_is_modified(vm_offset_t phys) printf("pmap_is_modified: pte from pv_list not in map virt = 0x%x\n", pvep->va); panic("pmap_is_modified: bad pv list entry"); } - for (i = ptes_per_vm_page; i > 0; i--) { - if (ptep->modified) { - simple_unlock(&pvep->pmap->lock); + if (ptep->modified) { + simple_unlock(&pvep->pmap->lock); #ifdef DEBUG - if ((pmap_con_dbg & (CD_IMOD | CD_FULL)) == (CD_IMOD | CD_FULL)) - printf("(pmap_is_modified :%x) modified page pte@0x%x\n", curproc, (unsigned)ptep); + if ((pmap_con_dbg & (CD_IMOD | CD_FULL)) == (CD_IMOD | CD_FULL)) + printf("(pmap_is_modified :%x) modified page pte@0x%x\n", curproc, (unsigned)ptep); #endif - UNLOCK_PVH(phys); - SPLX(spl); - return (TRUE); - } - ptep++; + UNLOCK_PVH(phys); + SPLX(spl); + return (TRUE); } simple_unlock(&pvep->pmap->lock); pvep = pvep->next; @@ -4101,7 +4027,6 @@ pmap_clear_reference(vm_offset_t phys) pmap_t pmap; int spl, spl_sav; vm_offset_t va; - int i; unsigned users; pte_template_t opte; int kflush; @@ -4153,21 +4078,17 @@ pmap_clear_reference(vm_offset_t phys) if (pte == PT_ENTRY_NULL) panic("pmap_clear_reference: bad pv list entry."); - for (i = ptes_per_vm_page; i > 0; i--) { - /* - * Invalidate pte temporarily to avoid the modified bit - * and/or the reference being written back by other cpu. - */ - spl_sav = splimp(); - opte.bits = invalidate_pte(pte); - /* clear reference bit */ - opte.pte.pg_used = 0; - ((pte_template_t *)pte)->bits = opte.bits; - flush_atc_entry(users, va, kflush); - splx(spl_sav); - pte++; - va += M88K_PGBYTES; - } + /* + * Invalidate pte temporarily to avoid the modified bit + * and/or the reference being written back by other cpu. + */ + spl_sav = splimp(); + opte.bits = invalidate_pte(pte); + /* clear reference bit */ + opte.pte.pg_used = 0; + ((pte_template_t *)pte)->bits = opte.bits; + flush_atc_entry(users, va, kflush); + splx(spl_sav); simple_unlock(&pmap->lock); pvep = pvep->next; @@ -4217,7 +4138,6 @@ pmap_is_referenced(vm_offset_t phys) pv_entry_t pvep; pt_entry_t *ptep; int spl; - int i; if (!PMAP_MANAGED(phys)) return (FALSE); @@ -4246,14 +4166,11 @@ pmap_is_referenced(vm_offset_t phys) ptep = pmap_pte(pvep->pmap, pvep->va); if (ptep == PT_ENTRY_NULL) panic("pmap_is_referenced: bad pv list entry."); - for (i = ptes_per_vm_page; i > 0; i--) { - if (ptep->pg_used) { - simple_unlock(&pvep->pmap->lock); - UNLOCK_PVH(phys); - SPLX(spl); - return (TRUE); - } - ptep++; + if (ptep->pg_used) { + simple_unlock(&pvep->pmap->lock); + UNLOCK_PVH(phys); + SPLX(spl); + return (TRUE); } simple_unlock(&pvep->pmap->lock); pvep = pvep->next; @@ -4265,72 +4182,6 @@ pmap_is_referenced(vm_offset_t phys) } /* pmap_is referenced() */ /* - * Routine: PMAP_VERIFY_FREE - * - * History: - * '90. 7.17 Fuzzy This routine extract vax's pmap.c. - * This do not exit in m68k's pmap.c. - * vm_page_alloc calls this. - * Variables changed below, - * vm_first_phys --> pmap_phys_start - * vm_last_phys --> pmap_phys_end - * - * Calls: - * SPLVM, SPLX - * PA_TO_PVH - * - * Global/Extern: - * pmap_initialized - * pmap_phys_start - * pmap_phys_end - * TRUE, FALSE - * PMAP_NULL - * - * This routine check physical address if that have pmap modules. - * It returns TRUE/FALSE. - */ - -boolean_t -pmap_verify_free(vm_offset_t phys) -{ - pv_entry_t pv_h; - int spl; - boolean_t result; - - if (!pmap_initialized) - return (TRUE); - - if (!PMAP_MANAGED(phys)) - return (FALSE); - - SPLVM(spl); - - pv_h = PA_TO_PVH(phys); - LOCK_PVH(phys); - - result = (pv_h->pmap == PMAP_NULL); - UNLOCK_PVH(phys); - SPLX(spl); - - return (result); -} /* pmap_verify_free */ - -/* - * Routine: PMAP_VALID_PAGE - * - * The physical address space is dense... there are no holes. - * All addresses provided to vm_page_startup() are valid. - */ -boolean_t -pmap_valid_page(vm_offset_t p) -{ -#ifdef lint - p++; -#endif - return (TRUE); -} /* pmap_valid_page() */ - -/* * Routine: PMAP_PAGE_PROTECT * * Calls: @@ -4387,7 +4238,6 @@ pagemove(vm_offset_t from, vm_offset_t to, int size) pt_entry_t *srcpte, *dstpte; pv_entry_t pvl; int spl; - int i; unsigned users; pte_template_t opte; @@ -4431,7 +4281,7 @@ pagemove(vm_offset_t from, vm_offset_t to, int size) /* * Update pv_list */ - pa = M88K_PTOB(srcpte->pfn); + pa = ptoa(srcpte->pfn); if (PMAP_MANAGED(pa)) { LOCK_PVH(pa); pvl = PA_TO_PVH(pa); @@ -4442,19 +4292,16 @@ pagemove(vm_offset_t from, vm_offset_t to, int size) /* * copy pte + * + * Invalidate pte temporarily to avoid the modified bit + * and/or the reference being written back by other cpu. */ - for (i = ptes_per_vm_page; i > 0; i--) { - /* - * Invalidate pte temporarily to avoid the modified bit - * and/or the reference being written back by other cpu. - */ - opte.bits = invalidate_pte(srcpte); - flush_atc_entry(users, from, 1); - ((pte_template_t *)dstpte)->bits = opte.bits; - from += M88K_PGBYTES; - to += M88K_PGBYTES; - srcpte++; dstpte++; - } + opte.bits = invalidate_pte(srcpte); + flush_atc_entry(users, from, 1); + ((pte_template_t *)dstpte)->bits = opte.bits; + from += PAGE_SIZE; + to += PAGE_SIZE; + size -= PAGE_SIZE; } PMAP_UNLOCK(kernel_pmap, spl); @@ -4474,9 +4321,6 @@ pagemove(vm_offset_t from, vm_offset_t to, int size) * Parameters: * pa physical address of the (vm) page * - * Extern/globals: - * ptes_per_vm_page - * * Calls: * cachefall * @@ -4487,15 +4331,12 @@ pagemove(vm_offset_t from, vm_offset_t to, int size) void icache_flush(vm_offset_t pa) { - int i; int cpu = 0; - for (i = ptes_per_vm_page; i > 0; i--, pa += M88K_PGBYTES) { - for (cpu=0; cpu<max_cpus; cpu++) { - if (cpu_sets[cpu]) { - cmmu_flush_remote_inst_cache(cpu, pa, - M88K_PGBYTES); - } + for (cpu=0; cpu<max_cpus; cpu++) { + if (cpu_sets[cpu]) { + cmmu_flush_remote_inst_cache(cpu, pa, + PAGE_SIZE); } } } /* icache_flush */ @@ -4512,7 +4353,6 @@ icache_flush(vm_offset_t pa) * * Extern/globals: * pmap_pte - * ptes_per_vm_page * * Calls: * dcacheflush @@ -4522,7 +4362,6 @@ void pmap_dcache_flush(pmap_t pmap, vm_offset_t va) { vm_offset_t pa; - int i; int spl; if (pmap == PMAP_NULL) @@ -4530,10 +4369,8 @@ pmap_dcache_flush(pmap_t pmap, vm_offset_t va) PMAP_LOCK(pmap, spl); - pa = M88K_PTOB((pmap_pte(pmap, va))->pfn); - for (i = ptes_per_vm_page; i > 0; i--, pa += M88K_PGBYTES) { - cmmu_flush_data_cache(pa, M88K_PGBYTES); - } + pa = ptoa((pmap_pte(pmap, va))->pfn); + cmmu_flush_data_cache(pa, PAGE_SIZE); PMAP_UNLOCK(pmap, spl); @@ -4603,7 +4440,6 @@ pmap_cache_flush(pmap_t pmap, vm_offset_t virt, int bytes, int mode) { vm_offset_t pa; vm_offset_t va; - int i; int spl; if (pmap == PMAP_NULL) @@ -4613,17 +4449,15 @@ pmap_cache_flush(pmap_t pmap, vm_offset_t virt, int bytes, int mode) * If it is more than a couple of pages, just blow the whole cache * because of the number of cycles involved. */ - if (bytes > 2*M88K_PGBYTES) { + if (bytes > 2*PAGE_SIZE) { cache_flush_loop(mode, 0, -1); return; } PMAP_LOCK(pmap, spl); - for (va = virt; bytes > 0; bytes -= M88K_PGBYTES,va += M88K_PGBYTES) { - pa = M88K_PTOB((pmap_pte(pmap, va))->pfn); - for (i = ptes_per_vm_page; i > 0; i--, pa += M88K_PGBYTES) { - cache_flush_loop(mode, pa, M88K_PGBYTES); - } + for (va = virt; bytes > 0; bytes -= PAGE_SIZE,va += PAGE_SIZE) { + pa = ptoa((pmap_pte(pmap, va))->pfn); + cache_flush_loop(mode, pa, PAGE_SIZE); } PMAP_UNLOCK(pmap, spl); } /* pmap_cache_flush */ @@ -4702,7 +4536,7 @@ check_pv_list(vm_offset_t phys, pv_entry_t pv_h, char *who) if ((pte = pmap_pte(pv_e->pmap, pv_e->va)) == PT_ENTRY_NULL) pa = (vm_offset_t)0; else - pa = M88K_PTOB(pte->pfn) | (pv_e->va & M88K_PGOFSET); + pa = ptoa(pte->pfn) | (pv_e->va & PAGE_MASK); if (pa != phys) { printf("check_pv_list: phys addr diff in entry at 0x%x.\n", pv_e); @@ -4793,7 +4627,7 @@ check_map(pmap_t map, vm_offset_t s, vm_offset_t e, char *who) if (!PDT_VALID(ptep)) continue; /* no page mapping */ - phys = M88K_PTOB(ptep->pfn); /* pick up phys addr */ + phys = ptoa(ptep->pfn); /* pick up phys addr */ if (!PMAP_MANAGED(phys)) continue; /* no PV list */ @@ -4958,7 +4792,7 @@ check_pmap_consistency(char *who) printf("%08x : ", \ ((sdt_entry_template_t *)p)-> bits); \ printf("table adress=0x%x, prot=%d, dtype=%d\n", \ - M88K_PTOB(p->table_addr), \ + ptoa(p->table_addr), \ p->prot, \ p->dtype); @@ -5147,7 +4981,7 @@ pmap_print_trace (pmap_t pmap, vm_offset_t va, boolean_t long_format) PRINT_SDT(sdtp); #endif sdtv = sdtp + SDT_ENTRIES; - ptep = (pt_entry_t *)(M88K_PTOB(sdtv->table_addr)); + ptep = (pt_entry_t *)(ptoa(sdtv->table_addr)); if (sdtp->dtype != DT_VALID) { printf(" segment table entry invlid, trace stops.\n"); return; @@ -5184,57 +5018,6 @@ pmap_print_trace (pmap_t pmap, vm_offset_t va, boolean_t long_format) } } /* pmap_print_trace() */ -/* - * Check whether the current transaction being looked at by dodexc() - * could have been the one that caused a fault. Given the virtual - * address, map, and transaction type, checks whether the page at that - * address is valid, and, for write transactions, whether it has write - * permission. - */ -boolean_t -pmap_check_transaction(pmap_t pmap, vm_offset_t va, vm_prot_t type) -{ - pt_entry_t *pte; - sdt_entry_t *sdt; - int spl; - - PMAP_LOCK(pmap, spl); - - if ((pte = pmap_pte(pmap, va)) == PT_ENTRY_NULL) { - PMAP_UNLOCK(pmap, spl); - return FALSE; - } - - if (!PDT_VALID(pte)) { - PMAP_UNLOCK(pmap, spl); - return FALSE; - } - - /* - * Valid pte. If the transaction was a read, there is no way it - * could have been a fault, so return true. For now, assume - * that a write transaction could have caused a fault. We need - * to check pte and sdt entries for write permission to really - * tell. - */ - - if (type == VM_PROT_READ) { - PMAP_UNLOCK(pmap, spl); - return TRUE; - } else { - sdt = SDTENT(pmap,va); - if (sdt->prot || pte->prot) { - PMAP_UNLOCK(pmap, spl); - return FALSE; - } else { - PMAP_UNLOCK(pmap, spl); - return TRUE; - } - } -} - -/* New functions to satisfy rpd - contributed by danner */ - void pmap_virtual_space(vm_offset_t *startp, vm_offset_t *endp) { diff --git a/sys/arch/mvme88k/mvme88k/pmap_table.c b/sys/arch/mvme88k/mvme88k/pmap_table.c index 20896e731d5..5ddec0c896d 100644 --- a/sys/arch/mvme88k/mvme88k/pmap_table.c +++ b/sys/arch/mvme88k/mvme88k/pmap_table.c @@ -36,12 +36,9 @@ #define R VM_PROT_READ #define RW VM_PROT_READ|VM_PROT_WRITE -#define C CACHE_DFL #define CW CACHE_WT #define CI CACHE_INH #define CG CACHE_GLOBAL -#define PAGE M88K_PGBYTES -#define SEG M88K_SGBYTES #undef VEQR_ADDR #define VEQR_ADDR 0 @@ -103,7 +100,7 @@ pmap_table_build(endoftext) pbt = bt; for (i = 0; pbt->size != 0xffffffff; i++) { if (pbt->size>0) - pbt->size = (pbt->size + M88K_PGBYTES-1) & ~(M88K_PGBYTES-1); + pbt->size = (pbt->size + PAGE_MASK) & ~PAGE_MASK; pbt++; } return bt; |