diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-11-10 21:05:07 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-11-10 21:05:07 +0000 |
commit | 8eb95dbc559008de0a791633109476d4cbd840e4 (patch) | |
tree | 627197d52f30e641201d75393af1726f3c018702 | |
parent | 958872a868e1d3b880930ae4d3daf3e60c550244 (diff) |
Get rid of the "struct pte" bitfield, and use straight integers.
Makes the code slightly more readble, removes casts, and makes some
specific constants defined for the bitfields disappear in pmap.c...
No functional change.
-rw-r--r-- | sys/arch/vax/if/if_uba.c | 18 | ||||
-rw-r--r-- | sys/arch/vax/if/if_uba.h | 8 | ||||
-rw-r--r-- | sys/arch/vax/include/cpu.h | 5 | ||||
-rw-r--r-- | sys/arch/vax/include/pcb.h | 7 | ||||
-rw-r--r-- | sys/arch/vax/include/pmap.h | 10 | ||||
-rw-r--r-- | sys/arch/vax/include/pte.h | 20 | ||||
-rw-r--r-- | sys/arch/vax/include/sgmap.h | 6 | ||||
-rw-r--r-- | sys/arch/vax/qbus/qd.c | 6 | ||||
-rw-r--r-- | sys/arch/vax/uba/qv.c | 4 | ||||
-rw-r--r-- | sys/arch/vax/uba/uba.c | 4 | ||||
-rw-r--r-- | sys/arch/vax/uba/uba_common.h | 4 | ||||
-rw-r--r-- | sys/arch/vax/uba/uba_dma.c | 8 | ||||
-rw-r--r-- | sys/arch/vax/uba/ubareg.h | 4 | ||||
-rw-r--r-- | sys/arch/vax/uba/ubavar.h | 4 | ||||
-rw-r--r-- | sys/arch/vax/vax/disksubr.c | 8 | ||||
-rw-r--r-- | sys/arch/vax/vax/ka820.c | 6 | ||||
-rw-r--r-- | sys/arch/vax/vax/locore.c | 6 | ||||
-rw-r--r-- | sys/arch/vax/vax/pmap.c | 227 | ||||
-rw-r--r-- | sys/arch/vax/vax/sgmap.c | 8 | ||||
-rw-r--r-- | sys/arch/vax/vax/vm_machdep.c | 12 | ||||
-rw-r--r-- | sys/arch/vax/vsa/vsbus.c | 16 | ||||
-rw-r--r-- | sys/arch/vax/vsa/vsbus_dma.c | 8 |
22 files changed, 207 insertions, 192 deletions
diff --git a/sys/arch/vax/if/if_uba.c b/sys/arch/vax/if/if_uba.c index 025cd5df187..33a8e1ce022 100644 --- a/sys/arch/vax/if/if_uba.c +++ b/sys/arch/vax/if/if_uba.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_uba.c,v 1.10 2003/06/02 23:27:57 millert Exp $ */ +/* $OpenBSD: if_uba.c,v 1.11 2003/11/10 21:05:04 miod Exp $ */ /* $NetBSD: if_uba.c,v 1.15 1999/01/01 21:43:18 ragge Exp $ */ /* @@ -214,7 +214,7 @@ if_ubaget(ifu, ifr, totlen, ifp) } len = totlen; if (len >= MINCLSIZE) { - struct pte *cpte, *ppte; + pt_entry_t *cpte, *ppte; int x, *ip, i; MCLGET(m, M_DONTWAIT); @@ -231,14 +231,14 @@ if_ubaget(ifu, ifr, totlen, ifp) * as quick form of copy. Remap UNIBUS and invalidate. */ pp = mtod(m, char *); - cpte = (struct pte *)kvtopte(cp); - ppte = (struct pte *)kvtopte(pp); + cpte = kvtopte(cp); + ppte = kvtopte(pp); x = vax_btop(cp - ifr->ifrw_addr); ip = (int *)&ifr->ifrw_mr[x]; for (i = 0; i < MCLBYTES/VAX_NBPG; i++) { - struct pte t; + pt_entry_t t; t = *ppte; *ppte++ = *cpte; *cpte = t; - *ip++ = cpte++->pg_pfn|ifr->ifrw_proto; + *ip++ = (*cpte++ & PG_FRAME) | ifr->ifrw_proto; mtpr(cp,PR_TBIS); cp += VAX_NBPG; mtpr((caddr_t)pp,PR_TBIS); @@ -345,14 +345,14 @@ if_ubaput(ifu, ifw, m) if (((vaddr_t)cp & PAGE_MASK) == 0 && ((vaddr_t)dp & PAGE_MASK) == 0 && (m->m_len == MCLBYTES || m->m_next == (struct mbuf *)0)) { - struct pte *pte; + pt_entry_t *pte; int *ip; - pte = (struct pte *)kvtopte(dp); + pte = kvtopte(dp); x = vax_btop(cp - ifw->ifw_addr); ip = (int *)&ifw->ifw_mr[x]; for (i = 0; i < MCLBYTES/VAX_NBPG; i++) - *ip++ = ifw->ifw_proto | pte++->pg_pfn; + *ip++ = ifw->ifw_proto | (*pte++ & PG_FRAME); xswapd |= 1 << (x>>(MCLSHIFT-VAX_PGSHIFT)); mp = m->m_next; m->m_next = ifw->ifw_xtofree; diff --git a/sys/arch/vax/if/if_uba.h b/sys/arch/vax/if/if_uba.h index a481a902f4e..5bf80ddd34b 100644 --- a/sys/arch/vax/if/if_uba.h +++ b/sys/arch/vax/if/if_uba.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_uba.h,v 1.6 2003/06/02 23:27:57 millert Exp $ */ +/* $OpenBSD: if_uba.h,v 1.7 2003/11/10 21:05:04 miod Exp $ */ /* $NetBSD: if_uba.h,v 1.6 1996/08/20 14:07:50 ragge Exp $ */ /* @@ -68,7 +68,7 @@ struct ifubinfo { short iff_flags; /* used during uballoc's */ short iff_hlen; /* local net header length */ struct uba_regs *iff_uba; /* uba adaptor regs, in vm */ - struct pte *iff_ubamr; /* uba map regs, in vm */ + pt_entry_t *iff_ubamr; /* uba map regs, in vm */ struct uba_softc *iff_softc; /* uba */ }; @@ -82,7 +82,7 @@ struct ifrw { #define IFRW_W 0x01 /* is a transmit buffer */ int ifrw_info; /* value from ubaalloc */ int ifrw_proto; /* map register prototype */ - struct pte *ifrw_mr; /* base of map registers */ + pt_entry_t *ifrw_mr; /* base of map registers */ }; /* @@ -91,7 +91,7 @@ struct ifrw { struct ifxmt { struct ifrw ifrw; caddr_t ifw_base; /* virt addr of buffer */ - struct pte ifw_wmap[IF_MAXNUBAMR]; /* base pages for output */ + pt_entry_t ifw_wmap[IF_MAXNUBAMR]; /* base pages for output */ struct mbuf *ifw_xtofree; /* pages being dma'd out */ short ifw_xswapd; /* mask of clusters swapped */ short ifw_nmr; /* number of entries in wmap */ diff --git a/sys/arch/vax/include/cpu.h b/sys/arch/vax/include/cpu.h index 24f3111826a..03bd14a720d 100644 --- a/sys/arch/vax/include/cpu.h +++ b/sys/arch/vax/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.14 2003/05/11 19:41:12 deraadt Exp $ */ +/* $OpenBSD: cpu.h,v 1.15 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: cpu.h,v 1.41 1999/10/21 20:01:36 ragge Exp $ */ /* @@ -39,6 +39,7 @@ #include <sys/device.h> #include <machine/mtpr.h> +#include <machine/pte.h> #include <machine/pcb.h> #include <machine/uvax.h> #include <machine/psl.h> @@ -124,7 +125,7 @@ void dumpconf(void); void dumpsys(void); void swapconf(void); void disk_printtype(int, int); -void disk_reallymapin(struct buf *, struct pte *, int, int); +void disk_reallymapin(struct buf *, pt_entry_t *, int, int); vaddr_t vax_map_physmem(paddr_t, int); void vax_unmap_physmem(vaddr_t, int); void ioaccess(vaddr_t, paddr_t, int); diff --git a/sys/arch/vax/include/pcb.h b/sys/arch/vax/include/pcb.h index da4b0e1de2d..4f1f787aa42 100644 --- a/sys/arch/vax/include/pcb.h +++ b/sys/arch/vax/include/pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcb.h,v 1.5 2000/10/09 22:57:42 bjc Exp $ */ +/* $OpenBSD: pcb.h,v 1.6 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: pcb.h,v 1.10 1996/02/02 18:08:26 mycroft Exp $ */ /* @@ -37,6 +37,7 @@ #define _VAX_PCB_H_ #include <machine/reg.h> +#include <machine/pte.h> struct pcb { @@ -51,9 +52,9 @@ struct pcb { long FP; /* Frame Pointer */ long PC; /* Program Counter */ long PSL; /* Program Status Longword */ - struct pte *P0BR; /* Page 0 Base Register */ + pt_entry_t *P0BR; /* Page 0 Base Register */ long P0LR; /* Page 0 Length Register */ - struct pte *P1BR; /* Page 1 Base Register */ + pt_entry_t *P1BR; /* Page 1 Base Register */ long P1LR; /* Page 1 Length Register */ /* Software registers, only used by kernel software */ diff --git a/sys/arch/vax/include/pmap.h b/sys/arch/vax/include/pmap.h index e0e3e1114a6..512f10b6c80 100644 --- a/sys/arch/vax/include/pmap.h +++ b/sys/arch/vax/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.19 2003/06/02 23:27:57 millert Exp $ */ +/* $OpenBSD: pmap.h,v 1.20 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: pmap.h,v 1.37 1999/08/01 13:48:07 ragge Exp $ */ /* @@ -54,7 +54,7 @@ #define LTOHPS (PGSHIFT - VAX_PGSHIFT) #define LTOHPN (1 << LTOHPS) #define USRPTSIZE ((MAXTSIZ + MAXDSIZ + MAXSSIZ + MMAPSPACE) / VAX_NBPG) -#define NPTEPGS (USRPTSIZE / (sizeof(struct pte) * LTOHPN)) +#define NPTEPGS (USRPTSIZE / (sizeof(pt_entry_t) * LTOHPN)) /* * Pmap structure @@ -64,9 +64,9 @@ typedef struct pmap { vaddr_t pm_stack; /* Base of alloced p1 pte space */ int ref_count; /* reference count */ - struct pte *pm_p0br; /* page 0 base register */ + pt_entry_t *pm_p0br; /* page 0 base register */ long pm_p0lr; /* page 0 length register */ - struct pte *pm_p1br; /* page 1 base register */ + pt_entry_t *pm_p1br; /* page 1 base register */ long pm_p1lr; /* page 1 length register */ int pm_lock; /* Lock entry in MP environment */ struct pmap_statistics pm_stats; /* Some statistics */ @@ -80,7 +80,7 @@ typedef struct pmap { struct pv_entry { struct pv_entry *pv_next; /* next pv_entry */ - struct pte *pv_pte; /* pte for this physical page */ + pt_entry_t *pv_pte; /* pte for this physical page */ struct pmap *pv_pmap; /* pmap this entry belongs to */ int pv_attr; /* write/modified bits */ }; diff --git a/sys/arch/vax/include/pte.h b/sys/arch/vax/include/pte.h index 3a746725810..e586d11cd1c 100644 --- a/sys/arch/vax/include/pte.h +++ b/sys/arch/vax/include/pte.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pte.h,v 1.8 2003/11/06 22:54:29 miod Exp $ */ +/* $OpenBSD: pte.h,v 1.9 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: pte.h,v 1.13 1999/08/03 19:53:23 ragge Exp $ */ /* @@ -35,22 +35,8 @@ #define _VAX_PTE_H_ #ifndef _LOCORE -/* - * VAX page table entries - */ -struct pte { - unsigned int pg_pfn:21; /* Page Frame Number or 0 */ - unsigned int pg_illegal:2; /* Don't use these bits */ - unsigned int pg_sref:1; /* Help for ref simulation */ - unsigned int pg_w:1; /* Wired bit */ - unsigned int pg_z:1; /* Zero DIGITAL = 0 */ - unsigned int pg_m:1; /* Modify DIGITAL */ - unsigned int pg_prot:4; /* reserved at zero */ - unsigned int pg_v:1; /* valid bit */ -}; - -typedef struct pte pt_entry_t; /* Mach page table entry */ +typedef u_int32_t pt_entry_t; /* Mach page table entry */ #endif /* _LOCORE */ @@ -83,7 +69,7 @@ extern pt_entry_t *Sysmap; #define ptetokv(pt) \ ((((pt_entry_t *)(pt) - Sysmap) << VAX_PGSHIFT) + 0x80000000) #define kvtophys(va) \ - (((kvtopte(va))->pg_pfn << VAX_PGSHIFT) | ((int)(va) & VAX_PGOFSET)) + (((*kvtopte(va) & PG_FRAME) << VAX_PGSHIFT) | ((int)(va) & VAX_PGOFSET)) #define uvtopte(va, pcb) \ (((unsigned)va < 0x40000000) ? \ &((pcb->P0BR)[PG_PFNUM(va)]) : \ diff --git a/sys/arch/vax/include/sgmap.h b/sys/arch/vax/include/sgmap.h index 52d1f68cd57..74e7d750bd0 100644 --- a/sys/arch/vax/include/sgmap.h +++ b/sys/arch/vax/include/sgmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sgmap.h,v 1.5 2002/03/14 01:26:48 millert Exp $ */ +/* $OpenBSD: sgmap.h,v 1.6 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: sgmap.h,v 1.3 2000/05/17 21:22:18 matt Exp $ */ /*- @@ -56,7 +56,7 @@ */ struct vax_sgmap { struct extent *aps_ex; /* extent map to manage sgva space */ - struct pte *aps_pt; /* page table */ + pt_entry_t *aps_pt; /* page table */ bus_addr_t aps_sgvabase; /* base of the sgva space */ bus_size_t aps_sgvasize; /* size of the sgva space */ bus_addr_t aps_pa; /* Address in region */ @@ -64,7 +64,7 @@ struct vax_sgmap { }; void vax_sgmap_init(bus_dma_tag_t, struct vax_sgmap *, - const char *, bus_addr_t, bus_size_t, struct pte *, bus_size_t); + const char *, bus_addr_t, bus_size_t, pt_entry_t *, bus_size_t); int vax_sgmap_alloc(bus_dmamap_t, bus_size_t, struct vax_sgmap *, int); diff --git a/sys/arch/vax/qbus/qd.c b/sys/arch/vax/qbus/qd.c index 20abf8f6a02..3a366171bd5 100644 --- a/sys/arch/vax/qbus/qd.c +++ b/sys/arch/vax/qbus/qd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qd.c,v 1.9 2003/11/03 07:06:17 david Exp $ */ +/* $OpenBSD: qd.c,v 1.10 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: qd.c,v 1.17 2000/01/24 02:40:29 matt Exp $ */ /*- @@ -156,7 +156,7 @@ struct qd_softc { struct uba_device *qdinfo[NQD]; /* array of pntrs to each QDSS's */ struct tty *qd_tty[NQD*4]; /* teletype structures for each.. */ volatile char *qvmem[NQD]; -volatile struct pte *QVmap[NQD]; +volatile pt_entry_t *QVmap[NQD]; #define CHUNK (64 * 1024) #define QMEMSIZE (1024 * 1024 * 4) /* 4 meg */ @@ -477,7 +477,7 @@ qdcninit(cndev) * Set QVmap to point to page table entries for what we just * mapped. */ - QVmap[0] = (struct pte *)kvtopte(qvmem[0]); + QVmap[0] = kvtopte(qvmem[0]); /* * tell QDSS which Q memory address base to decode diff --git a/sys/arch/vax/uba/qv.c b/sys/arch/vax/uba/qv.c index e24a65bf29a..aea17b53a29 100644 --- a/sys/arch/vax/uba/qv.c +++ b/sys/arch/vax/uba/qv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qv.c,v 1.7 2003/09/23 16:51:11 millert Exp $ */ +/* $OpenBSD: qv.c,v 1.8 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: qv.c,v 1.2 1996/09/02 06:44:28 mycroft Exp $ */ /*- @@ -166,7 +166,7 @@ struct uba_driver qvdriver = { qvprobe, 0, qvattach, 0, qvstd, "qv", qvinfo }; extern char qvmem[][512*NBPG]; -extern struct pte QVmap[][512]; +extern pt_entry_t QVmap[][512]; /* * Local variables for the driver. Initialized for 15' screen diff --git a/sys/arch/vax/uba/uba.c b/sys/arch/vax/uba/uba.c index 36fbdf3d862..f2787d336ae 100644 --- a/sys/arch/vax/uba/uba.c +++ b/sys/arch/vax/uba/uba.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uba.c,v 1.17 2003/06/02 23:27:58 millert Exp $ */ +/* $OpenBSD: uba.c,v 1.18 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: uba.c,v 1.43 2000/01/24 02:40:36 matt Exp $ */ /* * Copyright (c) 1996 Jonathan Stone. @@ -421,7 +421,7 @@ qba_attach(parent, self, aux) * the map registers are in the bus IO space. */ sc->uh_mr = (void *)vax_map_physmem(QBAMAP, - (QBAPAGES * sizeof(struct pte)) / VAX_NBPG); + (QBAPAGES * sizeof(pt_entry_t)) / VAX_NBPG); uba_attach(sc, QIOPAGE); } diff --git a/sys/arch/vax/uba/uba_common.h b/sys/arch/vax/uba/uba_common.h index 89e5be58fdc..46154e09822 100644 --- a/sys/arch/vax/uba/uba_common.h +++ b/sys/arch/vax/uba/uba_common.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uba_common.h,v 1.3 2003/06/02 23:27:58 millert Exp $ */ +/* $OpenBSD: uba_common.h,v 1.4 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: uba_common.h,v 1.2 1999/06/21 16:23:01 ragge Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. @@ -77,7 +77,7 @@ struct uba_regs { int uba_brrvr[4]; /* receive vector registers */ int uba_dpr[16]; /* buffered data path register */ int pad2[480]; - struct pte uba_map[UBAPAGES]; /* unibus map register */ + pt_entry_t uba_map[UBAPAGES]; /* unibus map register */ int pad3[UBAIOPAGES]; /* no maps for device address space */ }; diff --git a/sys/arch/vax/uba/uba_dma.c b/sys/arch/vax/uba/uba_dma.c index b188e78f1fb..4f9403a4e24 100644 --- a/sys/arch/vax/uba/uba_dma.c +++ b/sys/arch/vax/uba/uba_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uba_dma.c,v 1.3 2002/03/14 01:26:48 millert Exp $ */ +/* $OpenBSD: uba_dma.c,v 1.4 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: uba_dma.c,v 1.2 1999/06/20 00:59:55 ragge Exp $ */ /*- @@ -82,7 +82,7 @@ uba_dma_init(sc) struct uba_vsoftc *sc; { bus_dma_tag_t t; - struct pte *pte; + pt_entry_t *pte; /* * Initialize the DMA tag used for sgmap-mapped DMA. @@ -111,8 +111,8 @@ uba_dma_init(sc) /* * Map in Unibus map registers. */ - pte = (struct pte *)vax_map_physmem(sc->uv_addr, sc->uv_size/VAX_NBPG); - if (pte == 0) + pte = (pt_entry_t *)vax_map_physmem(sc->uv_addr, sc->uv_size/VAX_NBPG); + if (pte == NULL) panic("uba_dma_init"); /* * Initialize the SGMAP. diff --git a/sys/arch/vax/uba/ubareg.h b/sys/arch/vax/uba/ubareg.h index fd2f979f99a..f7a9a0e3936 100644 --- a/sys/arch/vax/uba/ubareg.h +++ b/sys/arch/vax/uba/ubareg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ubareg.h,v 1.10 2003/06/02 23:27:58 millert Exp $ */ +/* $OpenBSD: ubareg.h,v 1.11 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: ubareg.h,v 1.11 2000/01/24 02:40:36 matt Exp $ */ /*- @@ -100,7 +100,7 @@ struct uba_regs { int uba_brrvr[4]; /* receive vector registers */ int uba_dpr[16]; /* buffered data path register */ int pad2[480]; - struct pte uba_map[UBAPAGES]; /* unibus map register */ + pt_entry_t uba_map[UBAPAGES]; /* unibus map register */ int pad3[UBAIOPAGES]; /* no maps for device address space */ }; #endif diff --git a/sys/arch/vax/uba/ubavar.h b/sys/arch/vax/uba/ubavar.h index fc250d03450..18006778322 100644 --- a/sys/arch/vax/uba/ubavar.h +++ b/sys/arch/vax/uba/ubavar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ubavar.h,v 1.13 2003/06/02 23:27:58 millert Exp $ */ +/* $OpenBSD: ubavar.h,v 1.14 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: ubavar.h,v 1.21 1999/01/19 21:04:48 ragge Exp $ */ /* @@ -72,7 +72,7 @@ struct uba_softc { SIMPLEQ_HEAD(, uba_unit) uh_resq; /* resource wait chain */ int uh_type; /* type of adaptor */ struct uba_regs *uh_uba; /* virt addr of uba adaptor regs */ - struct pte *uh_mr; /* start of page map */ + pt_entry_t *uh_mr; /* start of page map */ int uh_memsize; /* size of uba memory, pages */ caddr_t uh_iopage; /* start of uba io page */ void (**uh_reset)(int); /* UBA reset function array */ diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c index bad32205d8a..590c7c900cd 100644 --- a/sys/arch/vax/vax/disksubr.c +++ b/sys/arch/vax/vax/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.20 2003/06/26 13:06:26 miod Exp $ */ +/* $OpenBSD: disksubr.c,v 1.21 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */ /* @@ -292,7 +292,7 @@ disk_printtype(unit, type) void disk_reallymapin(bp, map, reg, flag) struct buf *bp; - struct pte *map; + pt_entry_t *map; int reg, flag; { struct proc *p; @@ -326,7 +326,7 @@ disk_reallymapin(bp, map, reg, flag) * SHOULDN'T THEY ALWAYS BE MAPPED WHEN DOING THIS??? */ for (i = 0; i < (npf - 1); i++) { - if ((pte + i)->pg_pfn == 0) { + if ((pte[i] & PG_FRAME) == 0) { int rv; rv = uvm_fault(&p->p_vmspace->vm_map, (unsigned)addr + i * VAX_NBPG, 0, @@ -338,7 +338,7 @@ disk_reallymapin(bp, map, reg, flag) if (map) { io = &map[reg]; while (--npf > 0) { - pfnum = pte->pg_pfn; + pfnum = (*pte & PG_FRAME); if (pfnum == 0) panic("mapin zero entry"); pte++; diff --git a/sys/arch/vax/vax/ka820.c b/sys/arch/vax/vax/ka820.c index 8092225d8f1..4ad8cd24b2c 100644 --- a/sys/arch/vax/vax/ka820.c +++ b/sys/arch/vax/vax/ka820.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka820.c,v 1.11 2003/06/02 23:27:59 millert Exp $ */ +/* $OpenBSD: ka820.c,v 1.12 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: ka820.c,v 1.22 2000/06/04 02:19:27 matt Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. @@ -90,8 +90,8 @@ struct cfattach cpu_bi_ca = { }; #ifdef notyet -extern struct pte BRAMmap[]; -extern struct pte EEPROMmap[]; +extern pt_entry_t BRAMmap[]; +extern pt_entry_t EEPROMmap[]; char bootram[KA820_BRPAGES * VAX_NBPG]; char eeprom[KA820_EEPAGES * VAX_NBPG]; #endif diff --git a/sys/arch/vax/vax/locore.c b/sys/arch/vax/vax/locore.c index 809fc0ce449..8df5af36832 100644 --- a/sys/arch/vax/vax/locore.c +++ b/sys/arch/vax/vax/locore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.c,v 1.28 2003/04/08 14:53:11 hugh Exp $ */ +/* $OpenBSD: locore.c,v 1.29 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: locore.c,v 1.43 2000/03/26 11:39:45 ragge Exp $ */ /* * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. @@ -89,7 +89,6 @@ void start(struct rpb *prpb) { extern void *scratch; - struct pte *pt; mtpr(AST_NO, PR_ASTLVL); /* Turn off ASTs */ @@ -329,8 +328,7 @@ start(struct rpb *prpb) pmap_bootstrap(); /* Now running virtual. set red zone for proc0 */ - pt = kvtopte((u_int)proc0.p_addr + REDZONEADDR); - pt->pg_v = 0; + *kvtopte((u_int)proc0.p_addr + REDZONEADDR) &= ~PG_V; ((struct pcb *)proc0paddr)->framep = scratch; diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c index 21a3136c7fd..5254ec6a724 100644 --- a/sys/arch/vax/vax/pmap.c +++ b/sys/arch/vax/vax/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.32 2002/09/17 13:36:23 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.33 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: pmap.c,v 1.74 1999/11/13 21:32:25 matt Exp $ */ /* * Copyright (c) 1994, 1998, 1999 Ludd, University of Lule}, Sweden. @@ -64,19 +64,10 @@ void qdearly(void); #define ISTACK_SIZE NBPG vaddr_t istack; -/* - * This code uses bitfield operators for most page table entries. - */ -#define PROTSHIFT 27 -#define PROT_KW (PG_KW >> PROTSHIFT) -#define PROT_KR (PG_KR >> PROTSHIFT) -#define PROT_RW (PG_RW >> PROTSHIFT) -#define PROT_RO (PG_RO >> PROTSHIFT) -#define PROT_URKW (PG_URKW >> PROTSHIFT) struct pmap kernel_pmap_store; -struct pte *Sysmap; /* System page table */ +pt_entry_t *Sysmap; /* System page table */ struct pv_entry *pv_table; /* array of entries, one per LOGICAL page */ int pventries; void *scratch; @@ -107,12 +98,12 @@ int startpmapdebug = 0; #ifndef DEBUG static inline #endif -void pmap_decpteref(struct pmap *, struct pte *); +void pmap_decpteref(struct pmap *, pt_entry_t *); #ifndef PMAPDEBUG static inline #endif -void rensa(int, struct pte *); +void rensa(int, pt_entry_t *); vaddr_t avail_start, avail_end; vaddr_t virtual_avail, virtual_end; /* Available virtual memory */ @@ -176,12 +167,12 @@ pmap_bootstrap() /* * Kernel code is always readable for user, it must be because * of the emulation code that is somewhere in there. - * And it doesn't hurt, /netbsd is also public readable. + * And it doesn't hurt, the kernel file is also public readable. * There are also a couple of other things that must be in * physical memory and that isn't managed by the vm system. */ for (i = 0; i < ((unsigned)&etext - KERNBASE) >> VAX_PGSHIFT; i++) - Sysmap[i].pg_prot = PROT_URKW; + Sysmap[i] = (Sysmap[i] & ~PG_PROT) | PG_URKW; /* Map System Page Table and zero it, Sysmap already set. */ mtpr((unsigned)Sysmap - KERNBASE, PR_SBR); @@ -189,7 +180,7 @@ pmap_bootstrap() /* Map Interrupt stack and set red zone */ istack = (unsigned)Sysmap + ROUND_PAGE(sysptsize * 4); mtpr(istack + ISTACK_SIZE, PR_ISP); - kvtopte(istack)->pg_v = 0; + *kvtopte(istack) &= ~PG_V; /* Some scratch pages */ scratch = (void *)((u_int)istack + ISTACK_SIZE); @@ -348,7 +339,7 @@ pmap_init() void pmap_decpteref(pmap, pte) struct pmap *pmap; - struct pte *pte; + pt_entry_t *pte; { paddr_t paddr; int index; @@ -357,7 +348,7 @@ pmap_decpteref(pmap, pte) return; index = ((vaddr_t)pte - (vaddr_t)pmap->pm_p0br) >> PGSHIFT; - pte = (struct pte *)trunc_page((vaddr_t)pte); + pte = (pt_entry_t *)trunc_page((vaddr_t)pte); #ifdef PMAPDEBUG if (startpmapdebug) printf("pmap_decpteref: pmap %p pte %p index %d refcnt %d\n", @@ -370,13 +361,13 @@ pmap_decpteref(pmap, pte) #endif pmap->pm_refcnt[index]--; #ifdef DEBUG - if (pmap->pm_refcnt[index] >= VAX_NBPG/sizeof(struct pte)) + if (pmap->pm_refcnt[index] >= VAX_NBPG/sizeof(pt_entry_t)) panic("pmap_decpteref"); #endif if (pmap->pm_refcnt[index] == 0) { - paddr = kvtopte(pte)->pg_pfn << VAX_PGSHIFT; + paddr = (*kvtopte(pte) & PG_FRAME) << VAX_PGSHIFT; uvm_pagefree(PHYS_TO_VM_PAGE(paddr)); - bzero(kvtopte(pte), sizeof(struct pte) * LTOHPN); + bzero(kvtopte(pte), sizeof(pt_entry_t) * LTOHPN); } } @@ -408,7 +399,7 @@ pmap_pinit(pmap) * Allocate PTEs and stash them away in the pmap. * XXX Ok to use kmem_alloc_wait() here? */ - bytesiz = USRPTSIZE * sizeof(struct pte); + bytesiz = USRPTSIZE * sizeof(pt_entry_t); res = extent_alloc(ptemap, bytesiz, 4, 0, 0, EX_WAITSPACE|EX_WAITOK, (u_long *)&pmap->pm_p0br); if (res) @@ -456,13 +447,13 @@ if(startpmapdebug)printf("pmap_release: pmap %p\n",pmap); pmap->pm_refcnt[i], i); saddr = (vaddr_t)pmap->pm_p0br; - eaddr = saddr + USRPTSIZE * sizeof(struct pte); + eaddr = saddr + USRPTSIZE * sizeof(pt_entry_t); for (; saddr < eaddr; saddr += NBPG) - if (kvtopte(saddr)->pg_pfn) + if ((*kvtopte(saddr) & PG_FRAME) != 0) panic("pmap_release: page mapped"); #endif extent_free(ptemap, (u_long)pmap->pm_p0br, - USRPTSIZE * sizeof(struct pte), EX_WAITOK); + USRPTSIZE * sizeof(pt_entry_t), EX_WAITOK); } void @@ -525,7 +516,7 @@ if(startpmapdebug)printf("pmap_destroy: pmap %p\n",pmap); void rensa(clp, ptp) int clp; - struct pte *ptp; + pt_entry_t *ptp; { struct pv_entry *pf, *pl, *pv = pv_table + clp; int s, *g; @@ -575,9 +566,9 @@ pmap_kenter_pa(va, pa, prot) paddr_t pa; vm_prot_t prot; { - int *ptp; + pt_entry_t *ptp; - ptp = (int *)kvtopte(va); + ptp = kvtopte(va); #ifdef PMAPDEBUG if(startpmapdebug) printf("pmap_kenter_pa: va: %lx, pa %lx, prot %x ptp %p\n", va, pa, prot, ptp); @@ -598,7 +589,7 @@ pmap_kremove(va, len) vaddr_t va; vsize_t len; { - struct pte *pte; + pt_entry_t *pte; int i; #ifdef PMAPDEBUG @@ -613,11 +604,11 @@ if(startpmapdebug) len >>= PGSHIFT; for (i = 0; i < len; i++) { - if (pte->pg_pfn == 0) + if ((*pte & PG_FRAME) == 0) continue; - if (pte->pg_sref == 0) - rensa(pte->pg_pfn >> LTOHPS, pte); - bzero(pte, LTOHPN * sizeof(struct pte)); + if ((*pte & PG_SREF) == 0) + rensa((*pte & PG_FRAME) >> LTOHPS, pte); + bzero(pte, LTOHPN * sizeof(pt_entry_t)); pte += LTOHPN; } mtpr(0, PR_TBIA); @@ -696,7 +687,7 @@ if (startpmapdebug) paddr_t phys; struct vm_page *pg; #ifdef DEBUG - if (kvtopte(&patch[i])->pg_pfn) + if ((*kvtopte(&patch[i]) & PG_FRAME) != 0) panic("pmap_enter: refcnt == 0"); #endif /* @@ -751,18 +742,18 @@ if (startpmapdebug) */ if (oldpte) { RECURSEEND; - rensa(oldpte >> LTOHPS, (struct pte *)&patch[i]); + rensa(oldpte >> LTOHPS, (pt_entry_t *)&patch[i]); RECURSESTART; } else if (pmap != pmap_kernel()) pmap->pm_refcnt[index]++; /* New mapping */ s = splimp(); if (pv->pv_pte == 0) { - pv->pv_pte = (struct pte *) & patch[i]; + pv->pv_pte = (pt_entry_t *) & patch[i]; pv->pv_pmap = pmap; } else { tmp = get_pventry(); - tmp->pv_pte = (struct pte *)&patch[i]; + tmp->pv_pte = (pt_entry_t *)&patch[i]; tmp->pv_pmap = pmap; tmp->pv_next = pv->pv_next; pv->pv_next = tmp; @@ -795,7 +786,7 @@ if (startpmapdebug) RECURSEEND; #ifdef DEBUG if (pmap != pmap_kernel()) - if (pmap->pm_refcnt[index] > VAX_NBPG/sizeof(struct pte)) + if (pmap->pm_refcnt[index] > VAX_NBPG/sizeof(pt_entry_t)) panic("pmap_enter: refcnt %d", pmap->pm_refcnt[index]); #endif if (pventries < 10) @@ -877,7 +868,7 @@ if(startpmapdebug)printf("pmap_extract: pmap %p, va %lx\n",pmap, va); return (FALSE); pte = (int *)pmap->pm_p1br; } - if (kvtopte(&pte[sva])->pg_pfn) { + if ((*kvtopte(&pte[sva]) & PG_FRAME) != 0) { *pap = ((pte[sva] & PG_FRAME) << VAX_PGSHIFT); return (TRUE); } @@ -896,8 +887,8 @@ pmap_protect(pmap, start, end, prot) vaddr_t start, end; vm_prot_t prot; { - struct pte *pt, *pts, *ptd; - int pr; + pt_entry_t *pt, *pts, *ptd; + pt_entry_t pr; #ifdef PMAPDEBUG if(startpmapdebug) printf("pmap_protect: pmap %p, start %lx, end %lx, prot %x\n", @@ -916,7 +907,7 @@ if(startpmapdebug) printf("pmap_protect: pmap %p, start %lx, end %lx, prot %x\n" #endif start &= ~KERNBASE; end &= ~KERNBASE; - pr = (prot & VM_PROT_WRITE ? PROT_KW : PROT_KR); + pr = (prot & VM_PROT_WRITE ? PG_KW : PG_KR); } else { if (start & 0x40000000) { /* P1 space */ if (end <= pmap->pm_stack) { @@ -949,7 +940,7 @@ if(startpmapdebug) printf("pmap_protect: pmap %p, start %lx, end %lx, prot %x\n" #endif } } - pr = (prot & VM_PROT_WRITE ? PROT_RW : PROT_RO); + pr = (prot & VM_PROT_WRITE ? PG_RW : PG_RO); } pts = &pt[start >> VAX_PGSHIFT]; ptd = &pt[end >> VAX_PGSHIFT]; @@ -961,23 +952,23 @@ if(startpmapdebug) printf("pmap_protect: pmap %p, start %lx, end %lx, prot %x\n" #endif while (pts < ptd) { - if (kvtopte(pts)->pg_pfn && *(int *)pts) { + if ((*kvtopte(pts) & PG_FRAME) != 0 && *(int *)pts) { if (prot == VM_PROT_NONE) { RECURSEEND; if ((*(int *)pts & PG_SREF) == 0) - rensa(pts->pg_pfn >> LTOHPS, pts); + rensa((*pts & PG_FRAME) >> LTOHPS, pts); RECURSESTART; - bzero(pts, sizeof(struct pte) * LTOHPN); + bzero(pts, sizeof(pt_entry_t) * LTOHPN); pmap_decpteref(pmap, pts); } else { - pts[0].pg_prot = pr; - pts[1].pg_prot = pr; - pts[2].pg_prot = pr; - pts[3].pg_prot = pr; - pts[4].pg_prot = pr; - pts[5].pg_prot = pr; - pts[6].pg_prot = pr; - pts[7].pg_prot = pr; + pts[0] = (pts[0] & ~PG_PROT) | pr; + pts[1] = (pts[1] & ~PG_PROT) | pr; + pts[2] = (pts[2] & ~PG_PROT) | pr; + pts[3] = (pts[3] & ~PG_PROT) | pr; + pts[4] = (pts[4] & ~PG_PROT) | pr; + pts[5] = (pts[5] & ~PG_PROT) | pr; + pts[6] = (pts[6] & ~PG_PROT) | pr; + pts[7] = (pts[7] & ~PG_PROT) | pr; } } pts += LTOHPN; @@ -995,7 +986,7 @@ int pmap_simulref(int bits, int addr); int pmap_simulref(int bits, int addr) { - u_int *pte; + pt_entry_t *pte; struct pv_entry *pv; paddr_t pa; @@ -1012,21 +1003,21 @@ if (startpmapdebug) /* First decode userspace addr */ if (addr >= 0) { if ((addr << 1) < 0) - pte = (u_int *)mfpr(PR_P1BR); + pte = (pt_entry_t *)mfpr(PR_P1BR); else - pte = (u_int *)mfpr(PR_P0BR); + pte = (pt_entry_t *)mfpr(PR_P0BR); pte += PG_PFNUM(addr); if (bits & 2) { /* PTE reference */ - pte = (u_int *)TRUNC_PAGE(pte); - pte = (u_int *)kvtopte(pte); + pte = (pt_entry_t *)TRUNC_PAGE(pte); + pte = kvtopte(pte); if (pte[0] == 0) /* Check for CVAX bug */ return 1; - pa = (u_int)pte & ~KERNBASE; + pa = (paddr_t)pte & ~KERNBASE; } else - pa = Sysmap[PG_PFNUM(pte)].pg_pfn << VAX_PGSHIFT; + pa = (Sysmap[PG_PFNUM(pte)] & PG_FRAME) << VAX_PGSHIFT; } else { - pte = (u_int *)kvtopte(addr); - pa = (u_int)pte & ~KERNBASE; + pte = kvtopte(addr); + pa = (paddr_t)pte & ~KERNBASE; } pte[0] |= PG_V; pte[1] |= PG_V; @@ -1088,18 +1079,28 @@ pmap_clear_reference(pg) pv->pv_attr &= ~PG_V; RECURSESTART; - if (pv->pv_pte && (pv->pv_pte[0].pg_w == 0)) - pv->pv_pte[0].pg_v = pv->pv_pte[1].pg_v = - pv->pv_pte[2].pg_v = pv->pv_pte[3].pg_v = - pv->pv_pte[4].pg_v = pv->pv_pte[5].pg_v = - pv->pv_pte[6].pg_v = pv->pv_pte[7].pg_v = 0; + if (pv->pv_pte && (pv->pv_pte[0] & PG_W) == 0) { + pv->pv_pte[0] &= ~PG_V; + pv->pv_pte[1] &= ~PG_V; + pv->pv_pte[2] &= ~PG_V; + pv->pv_pte[3] &= ~PG_V; + pv->pv_pte[4] &= ~PG_V; + pv->pv_pte[5] &= ~PG_V; + pv->pv_pte[6] &= ~PG_V; + pv->pv_pte[7] &= ~PG_V; + } while ((pv = pv->pv_next)) - if (pv->pv_pte[0].pg_w == 0) - pv->pv_pte[0].pg_v = pv->pv_pte[1].pg_v = - pv->pv_pte[2].pg_v = pv->pv_pte[3].pg_v = - pv->pv_pte[4].pg_v = pv->pv_pte[5].pg_v = - pv->pv_pte[6].pg_v = pv->pv_pte[7].pg_v = 0; + if ((pv->pv_pte[0] & PG_W) == 0) { + pv->pv_pte[0] &= ~PG_V; + pv->pv_pte[1] &= ~PG_V; + pv->pv_pte[2] &= ~PG_V; + pv->pv_pte[3] &= ~PG_V; + pv->pv_pte[4] &= ~PG_V; + pv->pv_pte[5] &= ~PG_V; + pv->pv_pte[6] &= ~PG_V; + pv->pv_pte[7] &= ~PG_V; + } RECURSEEND; return ref; } @@ -1129,10 +1130,14 @@ pmap_is_modified(pg) } if (pv->pv_pte) - if ((pv->pv_pte[0].pg_m | pv->pv_pte[1].pg_m - | pv->pv_pte[2].pg_m | pv->pv_pte[3].pg_m - | pv->pv_pte[4].pg_m | pv->pv_pte[5].pg_m - | pv->pv_pte[6].pg_m | pv->pv_pte[7].pg_m)) { + if ((pv->pv_pte[0] & PG_M) != 0 || + (pv->pv_pte[1] & PG_M) != 0 || + (pv->pv_pte[2] & PG_M) != 0 || + (pv->pv_pte[3] & PG_M) != 0 || + (pv->pv_pte[4] & PG_M) != 0 || + (pv->pv_pte[5] & PG_M) != 0 || + (pv->pv_pte[6] & PG_M) != 0 || + (pv->pv_pte[7] & PG_M) != 0) { #ifdef PMAPDEBUG if (startpmapdebug) printf("Yes: (1)\n"); #endif @@ -1140,10 +1145,14 @@ pmap_is_modified(pg) } while ((pv = pv->pv_next)) { - if ((pv->pv_pte[0].pg_m | pv->pv_pte[1].pg_m - | pv->pv_pte[2].pg_m | pv->pv_pte[3].pg_m - | pv->pv_pte[4].pg_m | pv->pv_pte[5].pg_m - | pv->pv_pte[6].pg_m | pv->pv_pte[7].pg_m)) { + if ((pv->pv_pte[0] & PG_M) != 0 || + (pv->pv_pte[1] & PG_M) != 0 || + (pv->pv_pte[2] & PG_M) != 0 || + (pv->pv_pte[3] & PG_M) != 0 || + (pv->pv_pte[4] & PG_M) != 0 || + (pv->pv_pte[5] & PG_M) != 0 || + (pv->pv_pte[6] & PG_M) != 0 || + (pv->pv_pte[7] & PG_M) != 0) { #ifdef PMAPDEBUG if (startpmapdebug) printf("Yes: (2)\n"); #endif @@ -1174,17 +1183,27 @@ pmap_clear_modify(pg) #endif pv->pv_attr &= ~PG_M; - if (pv->pv_pte) - pv->pv_pte[0].pg_m = pv->pv_pte[1].pg_m = - pv->pv_pte[2].pg_m = pv->pv_pte[3].pg_m = - pv->pv_pte[4].pg_m = pv->pv_pte[5].pg_m = - pv->pv_pte[6].pg_m = pv->pv_pte[7].pg_m = 0; + if (pv->pv_pte) { + pv->pv_pte[0] &= ~PG_M; + pv->pv_pte[1] &= ~PG_M; + pv->pv_pte[2] &= ~PG_M; + pv->pv_pte[3] &= ~PG_M; + pv->pv_pte[4] &= ~PG_M; + pv->pv_pte[5] &= ~PG_M; + pv->pv_pte[6] &= ~PG_M; + pv->pv_pte[7] &= ~PG_M; + } - while ((pv = pv->pv_next)) - pv->pv_pte[0].pg_m = pv->pv_pte[1].pg_m = - pv->pv_pte[2].pg_m = pv->pv_pte[3].pg_m = - pv->pv_pte[4].pg_m = pv->pv_pte[5].pg_m = - pv->pv_pte[6].pg_m = pv->pv_pte[7].pg_m = 0; + while ((pv = pv->pv_next)) { + pv->pv_pte[0] &= ~PG_M; + pv->pv_pte[1] &= ~PG_M; + pv->pv_pte[2] &= ~PG_M; + pv->pv_pte[3] &= ~PG_M; + pv->pv_pte[4] &= ~PG_M; + pv->pv_pte[5] &= ~PG_M; + pv->pv_pte[6] &= ~PG_M; + pv->pv_pte[7] &= ~PG_M; + } return TRUE; /* XXX */ } @@ -1198,7 +1217,7 @@ pmap_page_protect(pg, prot) struct vm_page *pg; vm_prot_t prot; { - struct pte *pt; + pt_entry_t *pt; struct pv_entry *pv, *opv, *pl; int s, *g; paddr_t pa; @@ -1225,7 +1244,7 @@ if(startpmapdebug) printf("pa %lx\n",pa); if ((pv->pv_attr & (PG_V|PG_M)) != (PG_V|PG_M)) pv->pv_attr |= g[0]|g[1]|g[2]|g[3]|g[4]|g[5]|g[6]|g[7]; - bzero(g, sizeof(struct pte) * LTOHPN); + bzero(g, sizeof(pt_entry_t) * LTOHPN); pv->pv_pmap->pm_stats.resident_count--; pmap_decpteref(pv->pv_pmap, pv->pv_pte); pv->pv_pte = 0; @@ -1238,7 +1257,7 @@ if(startpmapdebug) printf("pa %lx\n",pa); if ((pv->pv_attr & (PG_V|PG_M)) != (PG_V|PG_M)) pv->pv_attr |= g[0]|g[1]|g[2]|g[3]|g[4]|g[5]|g[6]|g[7]; - bzero(g, sizeof(struct pte) * LTOHPN); + bzero(g, sizeof(pt_entry_t) * LTOHPN); pl->pv_pmap->pm_stats.resident_count--; pmap_decpteref(pl->pv_pmap, pl->pv_pte); opv = pl; @@ -1248,15 +1267,23 @@ if(startpmapdebug) printf("pa %lx\n",pa); splx(s); } else { /* read-only */ do { + pt_entry_t pr; + pt = pv->pv_pte; if (pt == 0) continue; - pt[0].pg_prot = pt[1].pg_prot = - pt[2].pg_prot = pt[3].pg_prot = - pt[4].pg_prot = pt[5].pg_prot = - pt[6].pg_prot = pt[7].pg_prot = - ((vaddr_t)pv->pv_pte < ptemapstart ? - PROT_KR : PROT_RO); + + pr = (vaddr_t)pv->pv_pte < ptemapstart ? + PG_KR : PG_RO; + + pt[0] = (pt[0] & ~PG_PROT) | pr; + pt[1] = (pt[1] & ~PG_PROT) | pr; + pt[2] = (pt[2] & ~PG_PROT) | pr; + pt[3] = (pt[3] & ~PG_PROT) | pr; + pt[4] = (pt[4] & ~PG_PROT) | pr; + pt[5] = (pt[5] & ~PG_PROT) | pr; + pt[6] = (pt[6] & ~PG_PROT) | pr; + pt[7] = (pt[7] & ~PG_PROT) | pr; } while ((pv = pv->pv_next)); } RECURSEEND; diff --git a/sys/arch/vax/vax/sgmap.c b/sys/arch/vax/vax/sgmap.c index be3ea70f93d..d9ffbdc3c55 100644 --- a/sys/arch/vax/vax/sgmap.c +++ b/sys/arch/vax/vax/sgmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sgmap.c,v 1.7 2002/10/12 01:09:44 krw Exp $ */ +/* $OpenBSD: sgmap.c,v 1.8 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: sgmap.c,v 1.8 2000/06/29 07:14:34 mrg Exp $ */ /*- @@ -56,7 +56,7 @@ vax_sgmap_init(t, sgmap, name, sgvabase, sgvasize, ptva, minptalign) const char *name; bus_addr_t sgvabase; bus_size_t sgvasize; - struct pte *ptva; + pt_entry_t *ptva; bus_size_t minptalign; { bus_dma_segment_t seg; @@ -83,7 +83,7 @@ vax_sgmap_init(t, sgmap, name, sgvabase, sgvasize, ptva, minptalign) * this must be aligned to the page table size. However, * some platforms have more strict alignment reqirements. */ - ptsize = (sgvasize / VAX_NBPG) * sizeof(struct pte); + ptsize = (sgvasize / VAX_NBPG) * sizeof(pt_entry_t); if (minptalign != 0) { if (minptalign < ptsize) minptalign = ptsize; @@ -95,7 +95,7 @@ vax_sgmap_init(t, sgmap, name, sgvabase, sgvasize, ptva, minptalign) name); goto die; } - sgmap->aps_pt = (struct pte *)(seg.ds_addr | KERNBASE); + sgmap->aps_pt = (pt_entry_t *)(seg.ds_addr | KERNBASE); } /* diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c index e5b51c57db8..3be06fd45e3 100644 --- a/sys/arch/vax/vax/vm_machdep.c +++ b/sys/arch/vax/vax/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.29 2001/12/08 02:24:07 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.30 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: vm_machdep.c,v 1.67 2000/06/29 07:14:34 mrg Exp $ */ /* @@ -75,7 +75,7 @@ pagemove(from, to, size) fpte = kvtopte(from); tpte = kvtopte(to); - stor = (size >> VAX_PGSHIFT) * sizeof(struct pte); + stor = (size >> VAX_PGSHIFT) * sizeof(pt_entry_t); bcopy(fpte, tpte, stor); bzero(fpte, stor); mtpr(0, PR_TBIA); @@ -141,7 +141,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) pmap_activate(p2); /* Mark guard page invalid in kernel stack */ - kvtopte((u_int)p2->p_addr + REDZONEADDR)->pg_v = 0; + *kvtopte((u_int)p2->p_addr + REDZONEADDR) &= ~PG_V; /* * Set up the calls frame above (below) the trapframe @@ -255,13 +255,13 @@ void cpu_swapin(p) struct proc *p; { - struct pte *pte; + pt_entry_t *pte; int i; pte = kvtopte((vaddr_t)p->p_addr); for (i = 0; i < (USPACE/VAX_NBPG); i ++) - pte[i].pg_v = 1; - kvtopte((vaddr_t)p->p_addr + REDZONEADDR)->pg_v = 0; + pte[i] |= PG_V; + *kvtopte((vaddr_t)p->p_addr + REDZONEADDR) &= ~PG_V; } /* diff --git a/sys/arch/vax/vsa/vsbus.c b/sys/arch/vax/vsa/vsbus.c index 3afabb0b0d4..71f184cd487 100644 --- a/sys/arch/vax/vsa/vsbus.c +++ b/sys/arch/vax/vsa/vsbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vsbus.c,v 1.12 2003/06/26 13:06:26 miod Exp $ */ +/* $OpenBSD: vsbus.c,v 1.13 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: vsbus.c,v 1.29 2000/06/29 07:14:37 mrg Exp $ */ /* * Copyright (c) 1996, 1999 Ludd, University of Lule}, Sweden. @@ -321,7 +321,7 @@ vsbus_clrintr(mask) void vsbus_copytoproc(struct proc *p, caddr_t from, caddr_t to, int len) { - struct pte *pte; + pt_entry_t *pte; paddr_t pa; if ((vaddr_t)to & KERNBASE) { /* In kernel space */ @@ -332,7 +332,8 @@ vsbus_copytoproc(struct proc *p, caddr_t from, caddr_t to, int len) if ((vaddr_t)to & PGOFSET) { int cz = ROUND_PAGE(to) - (vaddr_t)to; - pa = (pte->pg_pfn << VAX_PGSHIFT) | (NBPG - cz) | KERNBASE; + pa = ((*pte & PG_FRAME) << VAX_PGSHIFT) | + (NBPG - cz) | KERNBASE; bcopy(from, (caddr_t)pa, min(cz, len)); from += cz; to += cz; @@ -340,7 +341,7 @@ vsbus_copytoproc(struct proc *p, caddr_t from, caddr_t to, int len) pte += 8; /* XXX */ } while (len > 0) { - pa = (pte->pg_pfn << VAX_PGSHIFT) | KERNBASE; + pa = ((*pte & PG_FRAME) << VAX_PGSHIFT) | KERNBASE; bcopy(from, (caddr_t)pa, min(NBPG, len)); from += NBPG; to += NBPG; @@ -352,7 +353,7 @@ vsbus_copytoproc(struct proc *p, caddr_t from, caddr_t to, int len) void vsbus_copyfromproc(struct proc *p, caddr_t from, caddr_t to, int len) { - struct pte *pte; + pt_entry_t *pte; paddr_t pa; if ((vaddr_t)from & KERNBASE) { /* In kernel space */ @@ -363,7 +364,8 @@ vsbus_copyfromproc(struct proc *p, caddr_t from, caddr_t to, int len) if ((vaddr_t)from & PGOFSET) { int cz = ROUND_PAGE(from) - (vaddr_t)from; - pa = (pte->pg_pfn << VAX_PGSHIFT) | (NBPG - cz) | KERNBASE; + pa = ((*pte & PG_FRAME) << VAX_PGSHIFT) | + (NBPG - cz) | KERNBASE; bcopy((caddr_t)pa, to, min(cz, len)); from += cz; to += cz; @@ -371,7 +373,7 @@ vsbus_copyfromproc(struct proc *p, caddr_t from, caddr_t to, int len) pte += 8; /* XXX */ } while (len > 0) { - pa = (pte->pg_pfn << VAX_PGSHIFT) | KERNBASE; + pa = ((*pte & PG_FRAME) << VAX_PGSHIFT) | KERNBASE; bcopy((caddr_t)pa, to, min(NBPG, len)); from += NBPG; to += NBPG; diff --git a/sys/arch/vax/vsa/vsbus_dma.c b/sys/arch/vax/vsa/vsbus_dma.c index 225df0ea3a7..bf1b31b3f71 100644 --- a/sys/arch/vax/vsa/vsbus_dma.c +++ b/sys/arch/vax/vsa/vsbus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vsbus_dma.c,v 1.3 2001/11/06 19:53:17 miod Exp $ */ +/* $OpenBSD: vsbus_dma.c,v 1.4 2003/11/10 21:05:06 miod Exp $ */ /* $NetBSD: vsbus_dma.c,v 1.7 2000/07/26 21:50:49 matt Exp $ */ /*- @@ -83,9 +83,9 @@ vsbus_dma_init(sc, ptecnt) { bus_dma_tag_t t; bus_dma_segment_t segs[1]; - struct pte *pte; + pt_entry_t *pte; int nsegs, error; - unsigned mapsize = ptecnt * sizeof(struct pte); + unsigned mapsize = ptecnt * sizeof(pt_entry_t); /* * Initialize the DMA tag used for sgmap-mapped DMA. @@ -131,7 +131,7 @@ vsbus_dma_init(sc, ptecnt) memset(pte, 0, mapsize); *(int *) (sc->sc_vsregs + 8) = segs->ds_addr; /* set MAP BASE 0x2008008 */ } else { - pte = (struct pte *) vax_map_physmem(KA49_SCSIMAP, mapsize / VAX_NBPG); + pte = (pt_entry_t *) vax_map_physmem(KA49_SCSIMAP, mapsize / VAX_NBPG); for (nsegs = ptecnt; nsegs > 0; ) { ((u_int32_t *) pte)[--nsegs] = 0; } |