diff options
47 files changed, 286 insertions, 293 deletions
diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c index aec1b54..25d84f0 100644 --- a/sys/amd64/amd64/autoconf.c +++ b/sys/amd64/amd64/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.51 1995/12/16 18:52:05 peter Exp $ + * $Id: autoconf.c,v 1.52 1996/05/02 10:43:04 phk Exp $ */ /* @@ -58,7 +58,6 @@ #include <machine/cons.h> #include <machine/md_var.h> -#include <machine/pte.h> #include <i386/isa/icu.h> /* For interrupts */ #include "isa.h" diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c index b56ebc8..7f98c17 100644 --- a/sys/amd64/amd64/genassym.c +++ b/sys/amd64/amd64/genassym.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 - * $Id: genassym.c,v 1.33 1996/03/27 17:21:57 bde Exp $ + * $Id: genassym.c,v 1.34 1996/04/13 11:22:57 bde Exp $ */ #include <stdio.h> @@ -103,19 +103,14 @@ main() printf("#define\tV_SYSCALL %p\n", &vm->v_syscall); printf("#define\tV_INTR %p\n", &vm->v_intr); printf("#define\tUPAGES %d\n", UPAGES); - printf("#define\tCLSIZE %d\n", CLSIZE); - printf("#define\tNBPG %d\n", NBPG); + printf("#define\tPAGE_SIZE %d\n", PAGE_SIZE); printf("#define\tNPTEPG %d\n", NPTEPG); + printf("#define\tNPDEPG %d\n", NPDEPG); printf("#define\tPDESIZE %d\n", PDESIZE); printf("#define\tPTESIZE %d\n", PTESIZE); printf("#define\tNKPDE %d\n", NKPDE); printf("#define\tNKPT %d\n", NKPT); - printf("#define\tKPTDI 0x%x\n", KPTDI); - printf("#define\tKSTKPTDI 0x%x\n", KSTKPTDI); - printf("#define\tKSTKPTEOFF 0x%x\n", KSTKPTEOFF); - printf("#define\tPTDPTDI 0x%x\n", PTDPTDI); - printf("#define\tAPTDPTDI 0x%x\n", APTDPTDI); - printf("#define\tPGSHIFT %d\n", PGSHIFT); + printf("#define\tPAGE_SHIFT %d\n", PAGE_SHIFT); printf("#define\tPDRSHIFT %d\n", PDRSHIFT); printf("#define\tUSRSTACK 0x%lx\n", USRSTACK); printf("#define\tVM_MAXUSER_ADDRESS 0x%lx\n", VM_MAXUSER_ADDRESS); diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index 0c21925..0ea4875 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 - * $Id: locore.s,v 1.67 1996/04/28 07:14:05 phk Exp $ + * $Id: locore.s,v 1.68 1996/04/30 11:58:56 phk Exp $ * * originally from: locore.s, by William F. Jolitz * @@ -53,7 +53,7 @@ #include <machine/asmacros.h> #include <machine/cputypes.h> #include <machine/psl.h> -#include <machine/pte.h> +#include <machine/pmap.h> #include <machine/specialreg.h> #include "assym.s" @@ -71,23 +71,17 @@ * Within PTmap, the page directory can be found (third indirection). */ .globl _PTmap,_PTD,_PTDpde - .set _PTmap,PTDPTDI << PDRSHIFT - .set _PTD,_PTmap + (PTDPTDI * NBPG) + .set _PTmap,(PTDPTDI << PDRSHIFT) + .set _PTD,_PTmap + (PTDPTDI * PAGE_SIZE) .set _PTDpde,_PTD + (PTDPTDI * PDESIZE) /* - * Sysmap is the base address of the kernel page tables. - * It is a bogus interface for kgdb and isn't used by the kernel itself. - */ - .set _Sysmap,_PTmap + (KPTDI * NBPG) - -/* * APTmap, APTD is the alternate recursive pagemap. * It's used when modifying another process's page tables. */ .globl _APTmap,_APTD,_APTDpde .set _APTmap,APTDPTDI << PDRSHIFT - .set _APTD,_APTmap + (APTDPTDI * NBPG) + .set _APTD,_APTmap + (APTDPTDI * PAGE_SIZE) .set _APTDpde,_PTD + (APTDPTDI * PDESIZE) /* @@ -150,11 +144,11 @@ _bdb_exists: .long 0 #define ALLOCPAGES(foo) \ movl R(physfree), %esi ; \ - movl $((foo)*NBPG), %eax ; \ + movl $((foo)*PAGE_SIZE), %eax ; \ addl %esi, %eax ; \ movl %eax, R(physfree) ; \ movl %esi, %edi ; \ - movl $((foo)*NBPG),%ecx ; \ + movl $((foo)*PAGE_SIZE),%ecx ; \ xorl %eax,%eax ; \ cld ; \ rep ; \ @@ -168,7 +162,7 @@ _bdb_exists: .long 0 */ #define fillkpt \ 1: movl %eax,(%ebx) ; \ - addl $NBPG,%eax ; /* increment physical address */ \ + addl $PAGE_SIZE,%eax ; /* increment physical address */ \ addl $4,%ebx ; /* next pte */ \ loop 1b @@ -286,7 +280,7 @@ NON_GPROF_ENTRY(btext) /* now running relocated at KERNBASE where the system is linked to run */ begin: /* set up bootstrap stack */ - movl $_kstack+UPAGES*NBPG,%esp /* bootstrap stack end location */ + movl $_kstack+UPAGES*PAGE_SIZE,%esp /* bootstrap stack end location */ xorl %eax,%eax /* mark end of frames */ movl %eax,%ebp movl _proc0paddr,%eax @@ -694,8 +688,8 @@ create_pagetables: over_symalloc: #endif - addl $NBPG-1,%esi - andl $~(NBPG-1),%esi + addl $PAGE_SIZE-1,%esi + andl $~(PAGE_SIZE-1),%esi movl %esi,R(_KERNend) /* save end of kernel */ movl %esi,R(physfree) /* next free page is at end of kernel */ @@ -720,8 +714,8 @@ over_symalloc: /* Map read-only from zero to the end of the kernel text section */ movl R(_KPTphys), %esi movl $R(_etext),%ecx - addl $NBPG-1,%ecx - shrl $PGSHIFT,%ecx + addl $PAGE_SIZE-1,%ecx + shrl $PAGE_SHIFT,%ecx movl $PG_V|PG_KR,%eax movl %esi, %ebx #ifdef BDE_DEBUGGER @@ -736,7 +730,7 @@ map_read_write: andl $PG_FRAME,%eax movl R(_KERNend),%ecx subl %eax,%ecx - shrl $PGSHIFT,%ecx + shrl $PAGE_SHIFT,%ecx orl $PG_V|PG_KW,%eax fillkpt @@ -744,7 +738,7 @@ map_read_write: movl R(_IdlePTD), %eax movl $1, %ecx movl %eax, %ebx - shrl $PGSHIFT-2, %ebx + shrl $PAGE_SHIFT-2, %ebx addl R(_KPTphys), %ebx orl $PG_V|PG_KW, %eax fillkpt @@ -753,7 +747,7 @@ map_read_write: movl R(p0upt), %eax movl $1, %ecx movl %eax, %ebx - shrl $PGSHIFT-2, %ebx + shrl $PAGE_SHIFT-2, %ebx addl R(_KPTphys), %ebx orl $PG_V|PG_KW, %eax fillkpt @@ -762,7 +756,7 @@ map_read_write: movl R(upa), %eax movl $UPAGES, %ecx movl %eax, %ebx - shrl $PGSHIFT-2, %ebx + shrl $PAGE_SHIFT-2, %ebx addl R(_KPTphys), %ebx orl $PG_V|PG_KW, %eax fillkpt @@ -784,11 +778,11 @@ map_read_write: /* Map ISA hole */ #define ISA_HOLE_START 0xa0000 #define ISA_HOLE_LENGTH (0x100000-ISA_HOLE_START) - movl $ISA_HOLE_LENGTH>>PGSHIFT, %ecx + movl $ISA_HOLE_LENGTH>>PAGE_SHIFT, %ecx movl $ISA_HOLE_START, %eax movl %eax, %ebx /* XXX 2 is magic for log2(PTESIZE). */ - shrl $PGSHIFT-2, %ebx + shrl $PAGE_SHIFT-2, %ebx addl R(_KPTphys), %ebx /* XXX could load %eax directly with $ISA_HOLE_START|PG_V|PG_KW_PG_N. */ orl $PG_V|PG_KW|PG_N, %eax diff --git a/sys/amd64/amd64/locore.s b/sys/amd64/amd64/locore.s index 0c21925..0ea4875 100644 --- a/sys/amd64/amd64/locore.s +++ b/sys/amd64/amd64/locore.s @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 - * $Id: locore.s,v 1.67 1996/04/28 07:14:05 phk Exp $ + * $Id: locore.s,v 1.68 1996/04/30 11:58:56 phk Exp $ * * originally from: locore.s, by William F. Jolitz * @@ -53,7 +53,7 @@ #include <machine/asmacros.h> #include <machine/cputypes.h> #include <machine/psl.h> -#include <machine/pte.h> +#include <machine/pmap.h> #include <machine/specialreg.h> #include "assym.s" @@ -71,23 +71,17 @@ * Within PTmap, the page directory can be found (third indirection). */ .globl _PTmap,_PTD,_PTDpde - .set _PTmap,PTDPTDI << PDRSHIFT - .set _PTD,_PTmap + (PTDPTDI * NBPG) + .set _PTmap,(PTDPTDI << PDRSHIFT) + .set _PTD,_PTmap + (PTDPTDI * PAGE_SIZE) .set _PTDpde,_PTD + (PTDPTDI * PDESIZE) /* - * Sysmap is the base address of the kernel page tables. - * It is a bogus interface for kgdb and isn't used by the kernel itself. - */ - .set _Sysmap,_PTmap + (KPTDI * NBPG) - -/* * APTmap, APTD is the alternate recursive pagemap. * It's used when modifying another process's page tables. */ .globl _APTmap,_APTD,_APTDpde .set _APTmap,APTDPTDI << PDRSHIFT - .set _APTD,_APTmap + (APTDPTDI * NBPG) + .set _APTD,_APTmap + (APTDPTDI * PAGE_SIZE) .set _APTDpde,_PTD + (APTDPTDI * PDESIZE) /* @@ -150,11 +144,11 @@ _bdb_exists: .long 0 #define ALLOCPAGES(foo) \ movl R(physfree), %esi ; \ - movl $((foo)*NBPG), %eax ; \ + movl $((foo)*PAGE_SIZE), %eax ; \ addl %esi, %eax ; \ movl %eax, R(physfree) ; \ movl %esi, %edi ; \ - movl $((foo)*NBPG),%ecx ; \ + movl $((foo)*PAGE_SIZE),%ecx ; \ xorl %eax,%eax ; \ cld ; \ rep ; \ @@ -168,7 +162,7 @@ _bdb_exists: .long 0 */ #define fillkpt \ 1: movl %eax,(%ebx) ; \ - addl $NBPG,%eax ; /* increment physical address */ \ + addl $PAGE_SIZE,%eax ; /* increment physical address */ \ addl $4,%ebx ; /* next pte */ \ loop 1b @@ -286,7 +280,7 @@ NON_GPROF_ENTRY(btext) /* now running relocated at KERNBASE where the system is linked to run */ begin: /* set up bootstrap stack */ - movl $_kstack+UPAGES*NBPG,%esp /* bootstrap stack end location */ + movl $_kstack+UPAGES*PAGE_SIZE,%esp /* bootstrap stack end location */ xorl %eax,%eax /* mark end of frames */ movl %eax,%ebp movl _proc0paddr,%eax @@ -694,8 +688,8 @@ create_pagetables: over_symalloc: #endif - addl $NBPG-1,%esi - andl $~(NBPG-1),%esi + addl $PAGE_SIZE-1,%esi + andl $~(PAGE_SIZE-1),%esi movl %esi,R(_KERNend) /* save end of kernel */ movl %esi,R(physfree) /* next free page is at end of kernel */ @@ -720,8 +714,8 @@ over_symalloc: /* Map read-only from zero to the end of the kernel text section */ movl R(_KPTphys), %esi movl $R(_etext),%ecx - addl $NBPG-1,%ecx - shrl $PGSHIFT,%ecx + addl $PAGE_SIZE-1,%ecx + shrl $PAGE_SHIFT,%ecx movl $PG_V|PG_KR,%eax movl %esi, %ebx #ifdef BDE_DEBUGGER @@ -736,7 +730,7 @@ map_read_write: andl $PG_FRAME,%eax movl R(_KERNend),%ecx subl %eax,%ecx - shrl $PGSHIFT,%ecx + shrl $PAGE_SHIFT,%ecx orl $PG_V|PG_KW,%eax fillkpt @@ -744,7 +738,7 @@ map_read_write: movl R(_IdlePTD), %eax movl $1, %ecx movl %eax, %ebx - shrl $PGSHIFT-2, %ebx + shrl $PAGE_SHIFT-2, %ebx addl R(_KPTphys), %ebx orl $PG_V|PG_KW, %eax fillkpt @@ -753,7 +747,7 @@ map_read_write: movl R(p0upt), %eax movl $1, %ecx movl %eax, %ebx - shrl $PGSHIFT-2, %ebx + shrl $PAGE_SHIFT-2, %ebx addl R(_KPTphys), %ebx orl $PG_V|PG_KW, %eax fillkpt @@ -762,7 +756,7 @@ map_read_write: movl R(upa), %eax movl $UPAGES, %ecx movl %eax, %ebx - shrl $PGSHIFT-2, %ebx + shrl $PAGE_SHIFT-2, %ebx addl R(_KPTphys), %ebx orl $PG_V|PG_KW, %eax fillkpt @@ -784,11 +778,11 @@ map_read_write: /* Map ISA hole */ #define ISA_HOLE_START 0xa0000 #define ISA_HOLE_LENGTH (0x100000-ISA_HOLE_START) - movl $ISA_HOLE_LENGTH>>PGSHIFT, %ecx + movl $ISA_HOLE_LENGTH>>PAGE_SHIFT, %ecx movl $ISA_HOLE_START, %eax movl %eax, %ebx /* XXX 2 is magic for log2(PTESIZE). */ - shrl $PGSHIFT-2, %ebx + shrl $PAGE_SHIFT-2, %ebx addl R(_KPTphys), %ebx /* XXX could load %eax directly with $ISA_HOLE_START|PG_V|PG_KW_PG_N. */ orl $PG_V|PG_KW|PG_N, %eax diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index b20ad93..5298dc2 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.185 1996/05/01 08:31:21 bde Exp $ + * $Id: machdep.c,v 1.186 1996/05/01 08:38:36 bde Exp $ */ #include "npx.h" @@ -237,7 +237,7 @@ cpu_startup(dummy) /* avail_end was pre-decremented in init386() to compensate */ for (i = 0; i < btoc(sizeof (struct msgbuf)); i++) pmap_enter(pmap_kernel(), (vm_offset_t)msgbufp, - avail_end + i * NBPG, + avail_end + i * PAGE_SIZE, VM_PROT_ALL, TRUE); msgbufmapped = 1; @@ -384,9 +384,9 @@ again: * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(nmbclusters+CLBYTES/MCLBYTES, + mclrefcnt = (char *)malloc(nmbclusters+PAGE_SIZE/MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, nmbclusters+CLBYTES/MCLBYTES); + bzero(mclrefcnt, nmbclusters+PAGE_SIZE/MCLBYTES); mb_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl, &maxaddr, nmbclusters * MCLBYTES, FALSE); /* @@ -1350,7 +1350,7 @@ init386(first) * the signal trampoline out of the user area. This is safe because * the code segment cannot be written to directly. */ -#define VM_END_USER_R_ADDRESS (VM_END_USER_RW_ADDRESS + UPAGES * NBPG) +#define VM_END_USER_R_ADDRESS (VM_END_USER_RW_ADDRESS + UPAGES * PAGE_SIZE) ldt_segs[LUCODE_SEL].ssd_limit = i386_btop(VM_END_USER_R_ADDRESS) - 1; ldt_segs[LUDATA_SEL].ssd_limit = i386_btop(VM_END_USER_RW_ADDRESS) - 1; /* Note. eventually want private ldts per process */ @@ -1443,8 +1443,8 @@ init386(first) } #endif - pagesinbase = biosbasemem * 1024 / NBPG; - pagesinext = biosextmem * 1024 / NBPG; + pagesinbase = biosbasemem * 1024 / PAGE_SIZE; + pagesinext = biosextmem * 1024 / PAGE_SIZE; /* * Special hack for chipsets that still remap the 384k hole when @@ -1594,7 +1594,7 @@ init386(first) /* now running on new page tables, configured,and u/iom is accessible */ /* make a initial tss so microp can get interrupt stack on syscall! */ - proc0.p_addr->u_pcb.pcb_tss.tss_esp0 = (int) kstack + UPAGES*NBPG; + proc0.p_addr->u_pcb.pcb_tss.tss_esp0 = (int) kstack + UPAGES*PAGE_SIZE; proc0.p_addr->u_pcb.pcb_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL) ; gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index c3e1724..a82269c 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * $Id: pmap.c,v 1.85 1996/04/07 02:23:05 dyson Exp $ + * $Id: pmap.c,v 1.86 1996/04/22 05:23:08 dyson Exp $ */ /* @@ -113,8 +113,8 @@ static void init_pv_entries __P((int)); /* * Get PDEs and PTEs for user/kernel address space */ -#define pmap_pde(m, v) (&((m)->pm_pdir[((vm_offset_t)(v) >> PD_SHIFT)&1023])) -#define pdir_pde(m, v) (m[((vm_offset_t)(v) >> PD_SHIFT)&1023]) +#define pmap_pde(m, v) (&((m)->pm_pdir[((vm_offset_t)(v) >> PDRSHIFT)&(NPDEPG-1)])) +#define pdir_pde(m, v) (m[((vm_offset_t)(v) >> PDRSHIFT)&(NPDEPG-1)]) #define pmap_pte_pa(pte) (*(int *)(pte) & PG_FRAME) @@ -1663,7 +1663,7 @@ pmap_object_init_pt(pmap, addr, object, pindex, size) #define PAGEORDER_SIZE (PFBAK+PFFOR) static int pmap_prefault_pageorder[] = { - -NBPG, NBPG, -2 * NBPG, 2 * NBPG + -PAGE_SIZE, PAGE_SIZE, -2 * PAGE_SIZE, 2 * PAGE_SIZE }; void @@ -2180,7 +2180,7 @@ pmap_pid_dump(int pid) { pde = &pmap->pm_pdir[i]; if (pde && pmap_pde_v(pde)) { for(j=0;j<1024;j++) { - unsigned va = base + (j << PG_SHIFT); + unsigned va = base + (j << PAGE_SHIFT); if (va >= (vm_offset_t) VM_MIN_KERNEL_ADDRESS) { if (index) { index = 0; @@ -2232,7 +2232,7 @@ pads(pm) for (i = 0; i < 1024; i++) if (pm->pm_pdir[i]) for (j = 0; j < 1024; j++) { - va = (i << PD_SHIFT) + (j << PG_SHIFT); + va = (i << PDRSHIFT) + (j << PAGE_SHIFT); if (pm == kernel_pmap && va < KERNBASE) continue; if (pm != kernel_pmap && va > UPT_MAX_ADDRESS) diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index 91a3b96..32bfb37 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: support.s,v 1.32 1996/03/31 04:05:03 bde Exp $ + * $Id: support.s,v 1.33 1996/04/06 01:06:06 davidg Exp $ */ #include "assym.s" /* system definitions */ @@ -414,7 +414,7 @@ ENTRY(copyout) /* copyout(from_kernel, to_user, len) */ */ /* compute number of pages */ movl %edi,%ecx - andl $NBPG-1,%ecx + andl $PAGE_SIZE-1,%ecx addl %ebx,%ecx decl %ecx shrl $IDXSHIFT+2,%ecx diff --git a/sys/amd64/amd64/support.s b/sys/amd64/amd64/support.s index 91a3b96..32bfb37 100644 --- a/sys/amd64/amd64/support.s +++ b/sys/amd64/amd64/support.s @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: support.s,v 1.32 1996/03/31 04:05:03 bde Exp $ + * $Id: support.s,v 1.33 1996/04/06 01:06:06 davidg Exp $ */ #include "assym.s" /* system definitions */ @@ -414,7 +414,7 @@ ENTRY(copyout) /* copyout(from_kernel, to_user, len) */ */ /* compute number of pages */ movl %edi,%ecx - andl $NBPG-1,%ecx + andl $PAGE_SIZE-1,%ecx addl %ebx,%ecx decl %ecx shrl $IDXSHIFT+2,%ecx diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index eb2a919..4c1823e 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.60 1996/04/25 06:20:06 phk Exp $ + * $Id: vm_machdep.c,v 1.61 1996/05/02 10:43:06 phk Exp $ */ #include "npx.h" @@ -724,7 +724,7 @@ vmapbuf(bp) } addr = bp->b_saveaddr = bp->b_data; - off = (int)addr & PGOFSET; + off = (int)addr & PAGE_MASK; npf = btoc(round_page(bp->b_bufsize + off)); bp->b_data = (caddr_t) (kva + off); while (npf--) { diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index 87e483f..73798ad 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -42,17 +42,41 @@ * * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 - * $Id: pmap.h,v 1.35 1996/04/03 05:23:44 dyson Exp $ + * $Id: pmap.h,v 1.36 1996/04/30 12:02:11 phk Exp $ */ #ifndef _MACHINE_PMAP_H_ #define _MACHINE_PMAP_H_ -#include <machine/pte.h> +#define PG_V 0x00000001 +#define PG_RW 0x00000002 +#define PG_u 0x00000004 +#define PG_PROT 0x00000006 /* all protection bits . */ +#define PG_NC_PWT 0x00000008 /* page cache write through */ +#define PG_NC_PCD 0x00000010 /* page cache disable */ +#define PG_N 0x00000018 /* Non-cacheable */ +#define PG_U 0x00000020 /* page was accessed */ +#define PG_M 0x00000040 /* page was modified */ +#define PG_PS 0x00000080 /* page is big size */ +#define PG_G 0x00000100 /* page is global */ +#define PG_W 0x00000200 /* "Wired" pseudoflag */ +#define PG_FRAME 0xfffff000 + +#define PG_KR 0x00000000 +#define PG_KW 0x00000002 -typedef unsigned int *pd_entry_t; -typedef unsigned int *pt_entry_t; -struct vm_map; +/* + * Page Protection Exception bits + */ + +#define PGEX_P 0x01 /* Protection violation vs. not present */ +#define PGEX_W 0x02 /* during a Write cycle */ +#define PGEX_U 0x04 /* access from User mode (UPL) */ + +/* + * Pte related macros + */ +#define VADDR(pdi, pti) ((vm_offset_t)(((pdi)<<PDRSHIFT)|((pti)<<PAGE_SHIFT))) /* * NKPDE controls the virtual space of the kernel, what ever is left, minus @@ -79,12 +103,17 @@ struct vm_map; * XXX This works for now, but I am not real happy with it, I'll fix it * right after I fix locore.s and the magic 28K hole */ -#define APTDPTDI (NPTEPG-1) /* alt ptd entry that points to APTD */ +#define APTDPTDI (NPDEPG-1) /* alt ptd entry that points to APTD */ #define KPTDI (APTDPTDI-NKPDE)/* start of kernel virtual pde's */ #define PTDPTDI (KPTDI-1) /* ptd entry that points to ptd! */ #define KSTKPTDI (PTDPTDI-1) /* ptd entry for u./kernel&user stack */ #define KSTKPTEOFF (NPTEPG-UPAGES) /* pte entry for kernel stack */ +#ifndef LOCORE +typedef unsigned int *pd_entry_t; +typedef unsigned int *pt_entry_t; +struct vm_map; + #define PDESIZE sizeof(pd_entry_t) /* for assembly files */ #define PTESIZE sizeof(pt_entry_t) /* for assembly files */ @@ -106,14 +135,10 @@ extern int IdlePTD; /* physical address of "Idle" state directory */ * the corresponding pde that in turn maps it. */ #define vtopte(va) (PTmap + i386_btop(va)) -#define kvtopte(va) vtopte(va) -#define ptetov(pt) (i386_ptob(pt - PTmap)) -#define vtophys(va) (((int) (*vtopte(va))&PG_FRAME) | ((int)(va) & PGOFSET)) -#define ispt(va) ((va) >= UPT_MIN_ADDRESS && (va) <= KPT_MAX_ADDRESS) +#define vtophys(va) (((int) (*vtopte(va))&PG_FRAME) | ((int)(va) & PAGE_MASK)) #define avtopte(va) (APTmap + i386_btop(va)) -#define ptetoav(pt) (i386_ptob(pt - APTmap)) -#define avtophys(va) (((int) (*avtopte(va))&PG_FRAME) | ((int)(va) & PGOFSET)) +#define avtophys(va) (((int) (*avtopte(va))&PG_FRAME) | ((int)(va) & PAGE_MASK)) #ifdef KERNEL /* @@ -132,13 +157,6 @@ pmap_kextract(vm_offset_t va) #endif /* - * macros to generate page directory/table indices - */ - -#define pdei(va) (((va)&PD_MASK)>>PD_SHIFT) -#define ptei(va) (((va)&PT_MASK)>>PG_SHIFT) - -/* * Pmap stuff */ @@ -198,5 +216,6 @@ void pmap_unuse_pt __P((pmap_t, vm_offset_t, vm_page_t)); vm_page_t pmap_use_pt __P((pmap_t, vm_offset_t)); #endif /* KERNEL */ +#endif /* !LOCORE */ #endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/amd64/include/vmparam.h b/sys/amd64/include/vmparam.h index 7212da9..48b570d 100644 --- a/sys/amd64/include/vmparam.h +++ b/sys/amd64/include/vmparam.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 - * $Id: vmparam.h,v 1.19 1996/03/12 15:37:58 davidg Exp $ + * $Id: vmparam.h,v 1.20 1996/04/30 12:02:12 phk Exp $ */ @@ -67,7 +67,7 @@ #define SGROWSIZ (128UL*1024) /* amount to grow stack */ #endif -#define USRTEXT (1*NBPG) /* base of user text XXX bogus */ +#define USRTEXT (1*PAGE_SIZE) /* base of user text XXX bogus */ /* * Size of the Shared Memory Pages page table. @@ -100,7 +100,7 @@ #define KERNBASE VADDR(KPTDI, 0) -#define KPT_MAX_ADDRESS VADDR(PTDPTDI, APTDPTDI) +#define KPT_MAX_ADDRESS VADDR(PTDPTDI, KPTDI+NKPT) #define KPT_MIN_ADDRESS VADDR(PTDPTDI, KPTDI) #define UPT_MAX_ADDRESS VADDR(PTDPTDI, PTDPTDI) diff --git a/sys/conf/Makefile.i386 b/sys/conf/Makefile.i386 index 8cef5fa..6fcdbfc 100644 --- a/sys/conf/Makefile.i386 +++ b/sys/conf/Makefile.i386 @@ -1,6 +1,6 @@ # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $Id: Makefile.i386,v 1.78 1996/03/30 14:57:02 peter Exp $ +# $Id: Makefile.i386,v 1.79 1996/04/27 07:30:49 joerg Exp $ # # Makefile for FreeBSD # @@ -164,7 +164,7 @@ install: kernel fi install -c -m 555 -o root -g wheel -fschg kernel / -ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \ +ioconf.o: ioconf.c $S/sys/param.h $S/sys/buf.h \ ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h ${CC} -c ${CFLAGS} ioconf.c diff --git a/sys/conf/Makefile.powerpc b/sys/conf/Makefile.powerpc index 8cef5fa..6fcdbfc 100644 --- a/sys/conf/Makefile.powerpc +++ b/sys/conf/Makefile.powerpc @@ -1,6 +1,6 @@ # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $Id: Makefile.i386,v 1.78 1996/03/30 14:57:02 peter Exp $ +# $Id: Makefile.i386,v 1.79 1996/04/27 07:30:49 joerg Exp $ # # Makefile for FreeBSD # @@ -164,7 +164,7 @@ install: kernel fi install -c -m 555 -o root -g wheel -fschg kernel / -ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \ +ioconf.o: ioconf.c $S/sys/param.h $S/sys/buf.h \ ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h ${CC} -c ${CFLAGS} ioconf.c diff --git a/sys/conf/param.c b/sys/conf/param.c index a49c1d0..da221c8 100644 --- a/sys/conf/param.c +++ b/sys/conf/param.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)param.c 8.3 (Berkeley) 8/20/94 - * $Id: param.c,v 1.16 1996/03/11 05:52:50 hsu Exp $ + * $Id: param.c,v 1.17 1996/05/02 10:42:51 phk Exp $ */ #include "opt_sysvipc.h" @@ -115,7 +115,7 @@ int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ #define SHMSEG 8 #endif #ifndef SHMALL -#define SHMALL (SHMMAXPGS/CLSIZE) +#define SHMALL (SHMMAXPGS) #endif struct shminfo shminfo = { diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index 072e184..73832f2 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -21,7 +21,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_de.c,v 1.43 1996/02/06 18:51:23 wollman Exp $ + * $Id: if_de.c,v 1.44 1996/03/23 19:29:09 fenner Exp $ * */ @@ -1301,7 +1301,7 @@ tulip_start( do { int len = m0->m_len; caddr_t addr = mtod(m0, caddr_t); - unsigned clsize = CLBYTES - (((u_long) addr) & (CLBYTES-1)); + unsigned clsize = PAGE_SIZE - (((u_long) addr) & (PAGE_SIZE-1)); next_m0 = m0->m_next; while (len > 0) { @@ -1340,7 +1340,7 @@ tulip_start( d_status = TULIP_DSTS_OWNER; len -= slen; addr += slen; - clsize = CLBYTES; + clsize = PAGE_SIZE; } } while ((m0 = next_m0) != NULL); diff --git a/sys/i386/conf/Makefile.i386 b/sys/i386/conf/Makefile.i386 index 8cef5fa..6fcdbfc 100644 --- a/sys/i386/conf/Makefile.i386 +++ b/sys/i386/conf/Makefile.i386 @@ -1,6 +1,6 @@ # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $Id: Makefile.i386,v 1.78 1996/03/30 14:57:02 peter Exp $ +# $Id: Makefile.i386,v 1.79 1996/04/27 07:30:49 joerg Exp $ # # Makefile for FreeBSD # @@ -164,7 +164,7 @@ install: kernel fi install -c -m 555 -o root -g wheel -fschg kernel / -ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \ +ioconf.o: ioconf.c $S/sys/param.h $S/sys/buf.h \ ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h ${CC} -c ${CFLAGS} ioconf.c diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c index aec1b54..25d84f0 100644 --- a/sys/i386/i386/autoconf.c +++ b/sys/i386/i386/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.51 1995/12/16 18:52:05 peter Exp $ + * $Id: autoconf.c,v 1.52 1996/05/02 10:43:04 phk Exp $ */ /* @@ -58,7 +58,6 @@ #include <machine/cons.h> #include <machine/md_var.h> -#include <machine/pte.h> #include <i386/isa/icu.h> /* For interrupts */ #include "isa.h" diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c index b56ebc8..7f98c17 100644 --- a/sys/i386/i386/genassym.c +++ b/sys/i386/i386/genassym.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 - * $Id: genassym.c,v 1.33 1996/03/27 17:21:57 bde Exp $ + * $Id: genassym.c,v 1.34 1996/04/13 11:22:57 bde Exp $ */ #include <stdio.h> @@ -103,19 +103,14 @@ main() printf("#define\tV_SYSCALL %p\n", &vm->v_syscall); printf("#define\tV_INTR %p\n", &vm->v_intr); printf("#define\tUPAGES %d\n", UPAGES); - printf("#define\tCLSIZE %d\n", CLSIZE); - printf("#define\tNBPG %d\n", NBPG); + printf("#define\tPAGE_SIZE %d\n", PAGE_SIZE); printf("#define\tNPTEPG %d\n", NPTEPG); + printf("#define\tNPDEPG %d\n", NPDEPG); printf("#define\tPDESIZE %d\n", PDESIZE); printf("#define\tPTESIZE %d\n", PTESIZE); printf("#define\tNKPDE %d\n", NKPDE); printf("#define\tNKPT %d\n", NKPT); - printf("#define\tKPTDI 0x%x\n", KPTDI); - printf("#define\tKSTKPTDI 0x%x\n", KSTKPTDI); - printf("#define\tKSTKPTEOFF 0x%x\n", KSTKPTEOFF); - printf("#define\tPTDPTDI 0x%x\n", PTDPTDI); - printf("#define\tAPTDPTDI 0x%x\n", APTDPTDI); - printf("#define\tPGSHIFT %d\n", PGSHIFT); + printf("#define\tPAGE_SHIFT %d\n", PAGE_SHIFT); printf("#define\tPDRSHIFT %d\n", PDRSHIFT); printf("#define\tUSRSTACK 0x%lx\n", USRSTACK); printf("#define\tVM_MAXUSER_ADDRESS 0x%lx\n", VM_MAXUSER_ADDRESS); diff --git a/sys/i386/i386/locore.s b/sys/i386/i386/locore.s index 0c21925..0ea4875 100644 --- a/sys/i386/i386/locore.s +++ b/sys/i386/i386/locore.s @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 - * $Id: locore.s,v 1.67 1996/04/28 07:14:05 phk Exp $ + * $Id: locore.s,v 1.68 1996/04/30 11:58:56 phk Exp $ * * originally from: locore.s, by William F. Jolitz * @@ -53,7 +53,7 @@ #include <machine/asmacros.h> #include <machine/cputypes.h> #include <machine/psl.h> -#include <machine/pte.h> +#include <machine/pmap.h> #include <machine/specialreg.h> #include "assym.s" @@ -71,23 +71,17 @@ * Within PTmap, the page directory can be found (third indirection). */ .globl _PTmap,_PTD,_PTDpde - .set _PTmap,PTDPTDI << PDRSHIFT - .set _PTD,_PTmap + (PTDPTDI * NBPG) + .set _PTmap,(PTDPTDI << PDRSHIFT) + .set _PTD,_PTmap + (PTDPTDI * PAGE_SIZE) .set _PTDpde,_PTD + (PTDPTDI * PDESIZE) /* - * Sysmap is the base address of the kernel page tables. - * It is a bogus interface for kgdb and isn't used by the kernel itself. - */ - .set _Sysmap,_PTmap + (KPTDI * NBPG) - -/* * APTmap, APTD is the alternate recursive pagemap. * It's used when modifying another process's page tables. */ .globl _APTmap,_APTD,_APTDpde .set _APTmap,APTDPTDI << PDRSHIFT - .set _APTD,_APTmap + (APTDPTDI * NBPG) + .set _APTD,_APTmap + (APTDPTDI * PAGE_SIZE) .set _APTDpde,_PTD + (APTDPTDI * PDESIZE) /* @@ -150,11 +144,11 @@ _bdb_exists: .long 0 #define ALLOCPAGES(foo) \ movl R(physfree), %esi ; \ - movl $((foo)*NBPG), %eax ; \ + movl $((foo)*PAGE_SIZE), %eax ; \ addl %esi, %eax ; \ movl %eax, R(physfree) ; \ movl %esi, %edi ; \ - movl $((foo)*NBPG),%ecx ; \ + movl $((foo)*PAGE_SIZE),%ecx ; \ xorl %eax,%eax ; \ cld ; \ rep ; \ @@ -168,7 +162,7 @@ _bdb_exists: .long 0 */ #define fillkpt \ 1: movl %eax,(%ebx) ; \ - addl $NBPG,%eax ; /* increment physical address */ \ + addl $PAGE_SIZE,%eax ; /* increment physical address */ \ addl $4,%ebx ; /* next pte */ \ loop 1b @@ -286,7 +280,7 @@ NON_GPROF_ENTRY(btext) /* now running relocated at KERNBASE where the system is linked to run */ begin: /* set up bootstrap stack */ - movl $_kstack+UPAGES*NBPG,%esp /* bootstrap stack end location */ + movl $_kstack+UPAGES*PAGE_SIZE,%esp /* bootstrap stack end location */ xorl %eax,%eax /* mark end of frames */ movl %eax,%ebp movl _proc0paddr,%eax @@ -694,8 +688,8 @@ create_pagetables: over_symalloc: #endif - addl $NBPG-1,%esi - andl $~(NBPG-1),%esi + addl $PAGE_SIZE-1,%esi + andl $~(PAGE_SIZE-1),%esi movl %esi,R(_KERNend) /* save end of kernel */ movl %esi,R(physfree) /* next free page is at end of kernel */ @@ -720,8 +714,8 @@ over_symalloc: /* Map read-only from zero to the end of the kernel text section */ movl R(_KPTphys), %esi movl $R(_etext),%ecx - addl $NBPG-1,%ecx - shrl $PGSHIFT,%ecx + addl $PAGE_SIZE-1,%ecx + shrl $PAGE_SHIFT,%ecx movl $PG_V|PG_KR,%eax movl %esi, %ebx #ifdef BDE_DEBUGGER @@ -736,7 +730,7 @@ map_read_write: andl $PG_FRAME,%eax movl R(_KERNend),%ecx subl %eax,%ecx - shrl $PGSHIFT,%ecx + shrl $PAGE_SHIFT,%ecx orl $PG_V|PG_KW,%eax fillkpt @@ -744,7 +738,7 @@ map_read_write: movl R(_IdlePTD), %eax movl $1, %ecx movl %eax, %ebx - shrl $PGSHIFT-2, %ebx + shrl $PAGE_SHIFT-2, %ebx addl R(_KPTphys), %ebx orl $PG_V|PG_KW, %eax fillkpt @@ -753,7 +747,7 @@ map_read_write: movl R(p0upt), %eax movl $1, %ecx movl %eax, %ebx - shrl $PGSHIFT-2, %ebx + shrl $PAGE_SHIFT-2, %ebx addl R(_KPTphys), %ebx orl $PG_V|PG_KW, %eax fillkpt @@ -762,7 +756,7 @@ map_read_write: movl R(upa), %eax movl $UPAGES, %ecx movl %eax, %ebx - shrl $PGSHIFT-2, %ebx + shrl $PAGE_SHIFT-2, %ebx addl R(_KPTphys), %ebx orl $PG_V|PG_KW, %eax fillkpt @@ -784,11 +778,11 @@ map_read_write: /* Map ISA hole */ #define ISA_HOLE_START 0xa0000 #define ISA_HOLE_LENGTH (0x100000-ISA_HOLE_START) - movl $ISA_HOLE_LENGTH>>PGSHIFT, %ecx + movl $ISA_HOLE_LENGTH>>PAGE_SHIFT, %ecx movl $ISA_HOLE_START, %eax movl %eax, %ebx /* XXX 2 is magic for log2(PTESIZE). */ - shrl $PGSHIFT-2, %ebx + shrl $PAGE_SHIFT-2, %ebx addl R(_KPTphys), %ebx /* XXX could load %eax directly with $ISA_HOLE_START|PG_V|PG_KW_PG_N. */ orl $PG_V|PG_KW|PG_N, %eax diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index b20ad93..5298dc2 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.185 1996/05/01 08:31:21 bde Exp $ + * $Id: machdep.c,v 1.186 1996/05/01 08:38:36 bde Exp $ */ #include "npx.h" @@ -237,7 +237,7 @@ cpu_startup(dummy) /* avail_end was pre-decremented in init386() to compensate */ for (i = 0; i < btoc(sizeof (struct msgbuf)); i++) pmap_enter(pmap_kernel(), (vm_offset_t)msgbufp, - avail_end + i * NBPG, + avail_end + i * PAGE_SIZE, VM_PROT_ALL, TRUE); msgbufmapped = 1; @@ -384,9 +384,9 @@ again: * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(nmbclusters+CLBYTES/MCLBYTES, + mclrefcnt = (char *)malloc(nmbclusters+PAGE_SIZE/MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, nmbclusters+CLBYTES/MCLBYTES); + bzero(mclrefcnt, nmbclusters+PAGE_SIZE/MCLBYTES); mb_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl, &maxaddr, nmbclusters * MCLBYTES, FALSE); /* @@ -1350,7 +1350,7 @@ init386(first) * the signal trampoline out of the user area. This is safe because * the code segment cannot be written to directly. */ -#define VM_END_USER_R_ADDRESS (VM_END_USER_RW_ADDRESS + UPAGES * NBPG) +#define VM_END_USER_R_ADDRESS (VM_END_USER_RW_ADDRESS + UPAGES * PAGE_SIZE) ldt_segs[LUCODE_SEL].ssd_limit = i386_btop(VM_END_USER_R_ADDRESS) - 1; ldt_segs[LUDATA_SEL].ssd_limit = i386_btop(VM_END_USER_RW_ADDRESS) - 1; /* Note. eventually want private ldts per process */ @@ -1443,8 +1443,8 @@ init386(first) } #endif - pagesinbase = biosbasemem * 1024 / NBPG; - pagesinext = biosextmem * 1024 / NBPG; + pagesinbase = biosbasemem * 1024 / PAGE_SIZE; + pagesinext = biosextmem * 1024 / PAGE_SIZE; /* * Special hack for chipsets that still remap the 384k hole when @@ -1594,7 +1594,7 @@ init386(first) /* now running on new page tables, configured,and u/iom is accessible */ /* make a initial tss so microp can get interrupt stack on syscall! */ - proc0.p_addr->u_pcb.pcb_tss.tss_esp0 = (int) kstack + UPAGES*NBPG; + proc0.p_addr->u_pcb.pcb_tss.tss_esp0 = (int) kstack + UPAGES*PAGE_SIZE; proc0.p_addr->u_pcb.pcb_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL) ; gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index c3e1724..a82269c 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * $Id: pmap.c,v 1.85 1996/04/07 02:23:05 dyson Exp $ + * $Id: pmap.c,v 1.86 1996/04/22 05:23:08 dyson Exp $ */ /* @@ -113,8 +113,8 @@ static void init_pv_entries __P((int)); /* * Get PDEs and PTEs for user/kernel address space */ -#define pmap_pde(m, v) (&((m)->pm_pdir[((vm_offset_t)(v) >> PD_SHIFT)&1023])) -#define pdir_pde(m, v) (m[((vm_offset_t)(v) >> PD_SHIFT)&1023]) +#define pmap_pde(m, v) (&((m)->pm_pdir[((vm_offset_t)(v) >> PDRSHIFT)&(NPDEPG-1)])) +#define pdir_pde(m, v) (m[((vm_offset_t)(v) >> PDRSHIFT)&(NPDEPG-1)]) #define pmap_pte_pa(pte) (*(int *)(pte) & PG_FRAME) @@ -1663,7 +1663,7 @@ pmap_object_init_pt(pmap, addr, object, pindex, size) #define PAGEORDER_SIZE (PFBAK+PFFOR) static int pmap_prefault_pageorder[] = { - -NBPG, NBPG, -2 * NBPG, 2 * NBPG + -PAGE_SIZE, PAGE_SIZE, -2 * PAGE_SIZE, 2 * PAGE_SIZE }; void @@ -2180,7 +2180,7 @@ pmap_pid_dump(int pid) { pde = &pmap->pm_pdir[i]; if (pde && pmap_pde_v(pde)) { for(j=0;j<1024;j++) { - unsigned va = base + (j << PG_SHIFT); + unsigned va = base + (j << PAGE_SHIFT); if (va >= (vm_offset_t) VM_MIN_KERNEL_ADDRESS) { if (index) { index = 0; @@ -2232,7 +2232,7 @@ pads(pm) for (i = 0; i < 1024; i++) if (pm->pm_pdir[i]) for (j = 0; j < 1024; j++) { - va = (i << PD_SHIFT) + (j << PG_SHIFT); + va = (i << PDRSHIFT) + (j << PAGE_SHIFT); if (pm == kernel_pmap && va < KERNBASE) continue; if (pm != kernel_pmap && va > UPT_MAX_ADDRESS) diff --git a/sys/i386/i386/support.s b/sys/i386/i386/support.s index 91a3b96..32bfb37 100644 --- a/sys/i386/i386/support.s +++ b/sys/i386/i386/support.s @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: support.s,v 1.32 1996/03/31 04:05:03 bde Exp $ + * $Id: support.s,v 1.33 1996/04/06 01:06:06 davidg Exp $ */ #include "assym.s" /* system definitions */ @@ -414,7 +414,7 @@ ENTRY(copyout) /* copyout(from_kernel, to_user, len) */ */ /* compute number of pages */ movl %edi,%ecx - andl $NBPG-1,%ecx + andl $PAGE_SIZE-1,%ecx addl %ebx,%ecx decl %ecx shrl $IDXSHIFT+2,%ecx diff --git a/sys/i386/i386/symbols.raw b/sys/i386/i386/symbols.raw index a2193ba..707c75d 100644 --- a/sys/i386/i386/symbols.raw +++ b/sys/i386/i386/symbols.raw @@ -1,6 +1,6 @@ # @(#)symbols.raw 7.6 (Berkeley) 5/8/91 # -# $Id: symbols.raw,v 1.4 1994/10/09 07:34:30 davidg Exp $ +# $Id: symbols.raw,v 1.5 1995/07/29 10:46:09 bde Exp $ # @@ -59,7 +59,6 @@ _udb _udpstat _rawcb - _Sysmap _ifnet # _rthost # _rtnet diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index eb2a919..4c1823e 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.60 1996/04/25 06:20:06 phk Exp $ + * $Id: vm_machdep.c,v 1.61 1996/05/02 10:43:06 phk Exp $ */ #include "npx.h" @@ -724,7 +724,7 @@ vmapbuf(bp) } addr = bp->b_saveaddr = bp->b_data; - off = (int)addr & PGOFSET; + off = (int)addr & PAGE_MASK; npf = btoc(round_page(bp->b_bufsize + off)); bp->b_data = (caddr_t) (kva + off); while (npf--) { diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index 716c19b..1296e1b 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)param.h 5.8 (Berkeley) 6/28/91 - * $Id: param.h,v 1.18 1995/02/19 10:36:17 gpalmer Exp $ + * $Id: param.h,v 1.19 1995/05/25 07:41:27 davidg Exp $ */ #ifndef _MACHINE_PARAM_H_ @@ -55,14 +55,11 @@ #define ALIGNBYTES (sizeof(int) - 1) #define ALIGN(p) (((unsigned)(p) + ALIGNBYTES) & ~ALIGNBYTES) -/* XXX PGSHIFT and PG_SHIFT are two names for the same thing */ -#define PGSHIFT 12 /* LOG2(NBPG) */ -#define PAGE_SHIFT 12 -#define NBPG (1 << PAGE_SHIFT) /* bytes/page */ -#define PAGE_SIZE (1 << PAGE_SHIFT) +#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ +#define PAGE_SIZE (1 << PAGE_SHIFT) /* bytes/page */ #define PAGE_MASK (PAGE_SIZE-1) -#define PGOFSET (NBPG-1) /* byte offset into page */ -#define NPTEPG (NBPG/(sizeof (pt_entry_t))) +#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) +#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t))) /* XXX PDRSHIFT and PD_SHIFT are two names for the same thing */ #define PDRSHIFT 22 /* LOG2(NBPDR) */ @@ -74,7 +71,7 @@ * defined in pmap.h which is included after this we can't do that * (YET!) */ -#define BTOPKERNBASE (KERNBASE >> PGSHIFT) +#define BTOPKERNBASE (KERNBASE >> PAGE_SHIFT) #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ #define DEV_BSIZE (1 << DEV_BSHIFT) @@ -82,12 +79,9 @@ #define BLKDEV_IOSIZE 2048 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ -#define CLSIZELOG2 0 -#define CLSIZE (1 << CLSIZELOG2) - /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ -#define SSIZE 1 /* initial stack size/NBPG */ -#define SINCR 1 /* increment of stack/NBPG */ +#define SSIZE 1 /* initial stack size/PAGE_SIZE */ +#define SINCR 1 /* increment of stack/PAGE_SIZE */ #define UPAGES 2 /* pages of u-area */ @@ -116,15 +110,15 @@ #define stoc(x) (x) /* Core clicks (4096 bytes) to disk blocks */ -#define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT)) -#define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT)) +#define ctod(x) ((x)<<(PAGE_SHIFT-DEV_BSHIFT)) +#define dtoc(x) ((x)>>(PAGE_SHIFT-DEV_BSHIFT)) #define dtob(x) ((x)<<DEV_BSHIFT) /* clicks to bytes */ -#define ctob(x) ((x)<<PGSHIFT) +#define ctob(x) ((x)<<PAGE_SHIFT) /* bytes to clicks */ -#define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT) +#define btoc(x) (((unsigned)(x)+PAGE_MASK)>>PAGE_SHIFT) /* * This is messy and perhaps slow because `bytes' may be an off_t. We @@ -142,19 +136,19 @@ /* * Mach derived conversion macros */ -#define trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) -#define round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) +#define trunc_page(x) ((unsigned)(x) & ~PAGE_MASK) +#define round_page(x) ((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK) -#define atop(x) ((unsigned)(x) >> PG_SHIFT) -#define ptoa(x) ((unsigned)(x) << PG_SHIFT) +#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) #define i386_round_pdr(x) ((((unsigned)(x)) + NBPDR - 1) & ~(NBPDR-1)) #define i386_trunc_pdr(x) ((unsigned)(x) & ~(NBPDR-1)) -#define i386_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) -#define i386_trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) +#define i386_round_page(x) ((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK) +#define i386_trunc_page(x) ((unsigned)(x) & ~PAGE_MASK) #define i386_btod(x) ((unsigned)(x) >> PDRSHIFT) #define i386_dtob(x) ((unsigned)(x) << PDRSHIFT) -#define i386_btop(x) ((unsigned)(x) >> PGSHIFT) -#define i386_ptob(x) ((unsigned)(x) << PGSHIFT) +#define i386_btop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define i386_ptob(x) ((unsigned)(x) << PAGE_SHIFT) #endif /* !_MACHINE_PARAM_H_ */ diff --git a/sys/i386/include/pmap.h b/sys/i386/include/pmap.h index 87e483f..73798ad 100644 --- a/sys/i386/include/pmap.h +++ b/sys/i386/include/pmap.h @@ -42,17 +42,41 @@ * * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 - * $Id: pmap.h,v 1.35 1996/04/03 05:23:44 dyson Exp $ + * $Id: pmap.h,v 1.36 1996/04/30 12:02:11 phk Exp $ */ #ifndef _MACHINE_PMAP_H_ #define _MACHINE_PMAP_H_ -#include <machine/pte.h> +#define PG_V 0x00000001 +#define PG_RW 0x00000002 +#define PG_u 0x00000004 +#define PG_PROT 0x00000006 /* all protection bits . */ +#define PG_NC_PWT 0x00000008 /* page cache write through */ +#define PG_NC_PCD 0x00000010 /* page cache disable */ +#define PG_N 0x00000018 /* Non-cacheable */ +#define PG_U 0x00000020 /* page was accessed */ +#define PG_M 0x00000040 /* page was modified */ +#define PG_PS 0x00000080 /* page is big size */ +#define PG_G 0x00000100 /* page is global */ +#define PG_W 0x00000200 /* "Wired" pseudoflag */ +#define PG_FRAME 0xfffff000 + +#define PG_KR 0x00000000 +#define PG_KW 0x00000002 -typedef unsigned int *pd_entry_t; -typedef unsigned int *pt_entry_t; -struct vm_map; +/* + * Page Protection Exception bits + */ + +#define PGEX_P 0x01 /* Protection violation vs. not present */ +#define PGEX_W 0x02 /* during a Write cycle */ +#define PGEX_U 0x04 /* access from User mode (UPL) */ + +/* + * Pte related macros + */ +#define VADDR(pdi, pti) ((vm_offset_t)(((pdi)<<PDRSHIFT)|((pti)<<PAGE_SHIFT))) /* * NKPDE controls the virtual space of the kernel, what ever is left, minus @@ -79,12 +103,17 @@ struct vm_map; * XXX This works for now, but I am not real happy with it, I'll fix it * right after I fix locore.s and the magic 28K hole */ -#define APTDPTDI (NPTEPG-1) /* alt ptd entry that points to APTD */ +#define APTDPTDI (NPDEPG-1) /* alt ptd entry that points to APTD */ #define KPTDI (APTDPTDI-NKPDE)/* start of kernel virtual pde's */ #define PTDPTDI (KPTDI-1) /* ptd entry that points to ptd! */ #define KSTKPTDI (PTDPTDI-1) /* ptd entry for u./kernel&user stack */ #define KSTKPTEOFF (NPTEPG-UPAGES) /* pte entry for kernel stack */ +#ifndef LOCORE +typedef unsigned int *pd_entry_t; +typedef unsigned int *pt_entry_t; +struct vm_map; + #define PDESIZE sizeof(pd_entry_t) /* for assembly files */ #define PTESIZE sizeof(pt_entry_t) /* for assembly files */ @@ -106,14 +135,10 @@ extern int IdlePTD; /* physical address of "Idle" state directory */ * the corresponding pde that in turn maps it. */ #define vtopte(va) (PTmap + i386_btop(va)) -#define kvtopte(va) vtopte(va) -#define ptetov(pt) (i386_ptob(pt - PTmap)) -#define vtophys(va) (((int) (*vtopte(va))&PG_FRAME) | ((int)(va) & PGOFSET)) -#define ispt(va) ((va) >= UPT_MIN_ADDRESS && (va) <= KPT_MAX_ADDRESS) +#define vtophys(va) (((int) (*vtopte(va))&PG_FRAME) | ((int)(va) & PAGE_MASK)) #define avtopte(va) (APTmap + i386_btop(va)) -#define ptetoav(pt) (i386_ptob(pt - APTmap)) -#define avtophys(va) (((int) (*avtopte(va))&PG_FRAME) | ((int)(va) & PGOFSET)) +#define avtophys(va) (((int) (*avtopte(va))&PG_FRAME) | ((int)(va) & PAGE_MASK)) #ifdef KERNEL /* @@ -132,13 +157,6 @@ pmap_kextract(vm_offset_t va) #endif /* - * macros to generate page directory/table indices - */ - -#define pdei(va) (((va)&PD_MASK)>>PD_SHIFT) -#define ptei(va) (((va)&PT_MASK)>>PG_SHIFT) - -/* * Pmap stuff */ @@ -198,5 +216,6 @@ void pmap_unuse_pt __P((pmap_t, vm_offset_t, vm_page_t)); vm_page_t pmap_use_pt __P((pmap_t, vm_offset_t)); #endif /* KERNEL */ +#endif /* !LOCORE */ #endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h index 7212da9..48b570d 100644 --- a/sys/i386/include/vmparam.h +++ b/sys/i386/include/vmparam.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 - * $Id: vmparam.h,v 1.19 1996/03/12 15:37:58 davidg Exp $ + * $Id: vmparam.h,v 1.20 1996/04/30 12:02:12 phk Exp $ */ @@ -67,7 +67,7 @@ #define SGROWSIZ (128UL*1024) /* amount to grow stack */ #endif -#define USRTEXT (1*NBPG) /* base of user text XXX bogus */ +#define USRTEXT (1*PAGE_SIZE) /* base of user text XXX bogus */ /* * Size of the Shared Memory Pages page table. @@ -100,7 +100,7 @@ #define KERNBASE VADDR(KPTDI, 0) -#define KPT_MAX_ADDRESS VADDR(PTDPTDI, APTDPTDI) +#define KPT_MAX_ADDRESS VADDR(PTDPTDI, KPTDI+NKPT) #define KPT_MIN_ADDRESS VADDR(PTDPTDI, KPTDI) #define UPT_MAX_ADDRESS VADDR(PTDPTDI, PTDPTDI) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 3bd7721..bfdc4bb 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 - * $Id: kern_malloc.c,v 1.19 1996/01/29 11:12:37 davidg Exp $ + * $Id: kern_malloc.c,v 1.20 1996/05/02 10:43:17 phk Exp $ */ #include <sys/param.h> @@ -141,7 +141,7 @@ malloc(size, type, flags) allocsize = roundup(size, PAGE_SIZE); else allocsize = 1 << indx; - npg = clrnd(btoc(allocsize)); + npg = btoc(allocsize); va = (caddr_t) kmem_malloc(kmem_map, (vm_size_t)ctob(npg), flags); if (va == NULL) { splx(s); @@ -171,7 +171,7 @@ malloc(size, type, flags) * bucket, don't assume the list is still empty. */ savedlist = kbp->kb_next; - kbp->kb_next = cp = va + (npg * NBPG) - allocsize; + kbp->kb_next = cp = va + (npg * PAGE_SIZE) - allocsize; for (;;) { freep = (struct freelist *)cp; #ifdef DIAGNOSTIC @@ -298,7 +298,7 @@ free(addr, type) if (size > MAXALLOCSAVE) { kmem_free(kmem_map, (vm_offset_t)addr, ctob(kup->ku_pagecnt)); #ifdef KMEMSTATS - size = kup->ku_pagecnt << PGSHIFT; + size = kup->ku_pagecnt << PAGE_SHIFT; ksp->ks_memuse -= size; kup->ku_indx = 0; kup->ku_pagecnt = 0; diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index a49c1d0..da221c8 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)param.c 8.3 (Berkeley) 8/20/94 - * $Id: param.c,v 1.16 1996/03/11 05:52:50 hsu Exp $ + * $Id: param.c,v 1.17 1996/05/02 10:42:51 phk Exp $ */ #include "opt_sysvipc.h" @@ -115,7 +115,7 @@ int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ #define SHMSEG 8 #endif #ifndef SHMALL -#define SHMALL (SHMMAXPGS/CLSIZE) +#define SHMALL (SHMMAXPGS) #endif struct shminfo shminfo = { diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 583963c..f01629a 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sys_process.c,v 1.21 1996/01/24 18:29:00 peter Exp $ + * $Id: sys_process.c,v 1.22 1996/03/30 15:02:58 peter Exp $ */ #include <sys/param.h> @@ -413,7 +413,7 @@ ptrace(curp, uap, retval) return (error); case PT_READ_U: - if ((u_int)uap->addr > (UPAGES * NBPG - sizeof(int))) { + if ((u_int)uap->addr > (UPAGES * PAGE_SIZE - sizeof(int))) { return EFAULT; } error = 0; diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index a68f8a6..12cef8a 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $Id: sysv_shm.c,v 1.17 1996/01/05 16:38:03 wollman Exp $ */ +/* $Id: sysv_shm.c,v 1.18 1996/02/23 18:49:18 peter Exp $ */ /* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */ /* @@ -141,7 +141,7 @@ shm_deallocate_segment(shmseg) size_t size; shm_handle = shmseg->shm_internal; - size = (shmseg->shm_segsz + CLOFSET) & ~CLOFSET; + size = (shmseg->shm_segsz + PAGE_SIZE-1) & ~(PAGE_SIZE-1); (void) vm_map_remove(sysvshm_map, shm_handle->kva, shm_handle->kva + size); free((caddr_t)shm_handle, M_SHM); shmseg->shm_internal = NULL; @@ -161,7 +161,7 @@ shm_delete_mapping(p, shmmap_s) segnum = IPCID_TO_IX(shmmap_s->shmid); shmseg = &shmsegs[segnum]; - size = (shmseg->shm_segsz + CLOFSET) & ~CLOFSET; + size = (shmseg->shm_segsz + PAGE_SIZE-1) & ~(PAGE_SIZE-1); result = vm_map_remove(&p->p_vmspace->vm_map, shmmap_s->va, shmmap_s->va + size); if (result != KERN_SUCCESS) return EINVAL; @@ -246,7 +246,7 @@ shmat(p, uap, retval) } if (i >= shminfo.shmseg) return EMFILE; - size = (shmseg->shm_segsz + CLOFSET) & ~CLOFSET; + size = (shmseg->shm_segsz + PAGE_SIZE-1) & ~(PAGE_SIZE-1); prot = VM_PROT_READ; if ((uap->shmflg & SHM_RDONLY) == 0) prot |= VM_PROT_WRITE; @@ -463,7 +463,7 @@ shmget_allocate_segment(p, uap, mode, retval) return EINVAL; if (shm_nused >= shminfo.shmmni) /* any shmids left? */ return ENOSPC; - size = (uap->size + CLOFSET) & ~CLOFSET; + size = (shmseg->shm_segsz + PAGE_SIZE-1) & ~(PAGE_SIZE-1); if (shm_committed + btoc(size) > shminfo.shmall) return ENOMEM; if (shm_last_free < 0) { @@ -605,7 +605,7 @@ shminit(dummy) /* actually this *should* be pageable. SHM_{LOCK,UNLOCK} */ sysvshm_map = kmem_suballoc(kernel_map, &garbage1, &garbage2, - shminfo.shmall * NBPG, TRUE); + shminfo.shmall * PAGE_SIZE, TRUE); for (i = 0; i < shminfo.shmmni; i++) { shmsegs[i].shm_perm.mode = SHMSEG_FREE; shmsegs[i].shm_perm.seq = 0; diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 188a132..7815b6d 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)tty.c 8.8 (Berkeley) 1/21/94 - * $Id: tty.c,v 1.79 1996/03/02 18:24:06 peter Exp $ + * $Id: tty.c,v 1.80 1996/03/11 06:05:03 hsu Exp $ */ /*- @@ -2199,7 +2199,7 @@ ttyinfo(tp) ttyprintf(tp, "%d.%02ds ", stime.tv_sec, stime.tv_usec / 10000); -#define pgtok(a) (((a) * NBPG) / 1024) +#define pgtok(a) (((a) * PAGE_SIZE) / 1024) /* Print percentage cpu, resident set size. */ tmp = (pick->p_pctcpu * 10000 + FSCALE / 2) >> FSHIFT; ttyprintf(tp, "%d%% %dk\n", diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index cb79083..1272bed 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94 - * $Id: uipc_mbuf.c,v 1.16 1995/12/07 12:46:59 davidg Exp $ + * $Id: uipc_mbuf.c,v 1.17 1995/12/14 08:32:06 phk Exp $ */ #include <sys/param.h> @@ -71,8 +71,8 @@ mbinit(dummy) { int s; -#if CLBYTES < 4096 -#define NCL_INIT (4096/CLBYTES) +#if PAGE_SIZE < 4096 +#define NCL_INIT (4096/PAGE_SIZE) #else #define NCL_INIT 1 #endif @@ -108,7 +108,7 @@ m_clalloc(ncl, nowait) if (mb_map_full) return (0); - npg = ncl * CLSIZE; + npg = ncl; p = (caddr_t)kmem_malloc(mb_map, ctob(npg), nowait ? M_NOWAIT : M_WAITOK); /* @@ -118,7 +118,7 @@ m_clalloc(ncl, nowait) if (p == NULL) return (0); - ncl = ncl * CLBYTES / MCLBYTES; + ncl = ncl * PAGE_SIZE / MCLBYTES; for (i = 0; i < ncl; i++) { ((union mcluster *)p)->mcl_next = mclfree; mclfree = (union mcluster *)p; diff --git a/sys/libkern/mcount.c b/sys/libkern/mcount.c index b0c4072..726ad5a 100644 --- a/sys/libkern/mcount.c +++ b/sys/libkern/mcount.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: mcount.c,v 1.6 1995/12/30 07:24:13 bde Exp $"; #endif #include <sys/param.h> @@ -107,7 +107,7 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ */ if (frompci >= p->textsize) { if (frompci + p->lowpc - >= (fptrint_t)(VM_MAXUSER_ADDRESS + UPAGES * NBPG)) + >= (fptrint_t)(VM_MAXUSER_ADDRESS + UPAGES * PAGE_SIZE)) goto done; frompci = (fptrint_t)user - p->lowpc; if (frompci >= p->textsize) diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 421de7c..4c6c5bd 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_vfsops.c,v 1.27 1996/02/13 18:16:29 wollman Exp $ + * $Id: nfs_vfsops.c,v 1.28 1996/04/30 23:23:09 bde Exp $ */ #include <sys/param.h> @@ -145,7 +145,7 @@ static int nfs_iosize(nmp) * space. */ iosize = max(nmp->nm_rsize, nmp->nm_wsize); - if (iosize < NBPG) iosize = NBPG; + if (iosize < PAGE_SIZE) iosize = PAGE_SIZE; return iosize; } diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 421de7c..4c6c5bd 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_vfsops.c,v 1.27 1996/02/13 18:16:29 wollman Exp $ + * $Id: nfs_vfsops.c,v 1.28 1996/04/30 23:23:09 bde Exp $ */ #include <sys/param.h> @@ -145,7 +145,7 @@ static int nfs_iosize(nmp) * space. */ iosize = max(nmp->nm_rsize, nmp->nm_wsize); - if (iosize < NBPG) iosize = NBPG; + if (iosize < PAGE_SIZE) iosize = PAGE_SIZE; return iosize; } diff --git a/sys/pci/if_de.c b/sys/pci/if_de.c index 072e184..73832f2 100644 --- a/sys/pci/if_de.c +++ b/sys/pci/if_de.c @@ -21,7 +21,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_de.c,v 1.43 1996/02/06 18:51:23 wollman Exp $ + * $Id: if_de.c,v 1.44 1996/03/23 19:29:09 fenner Exp $ * */ @@ -1301,7 +1301,7 @@ tulip_start( do { int len = m0->m_len; caddr_t addr = mtod(m0, caddr_t); - unsigned clsize = CLBYTES - (((u_long) addr) & (CLBYTES-1)); + unsigned clsize = PAGE_SIZE - (((u_long) addr) & (PAGE_SIZE-1)); next_m0 = m0->m_next; while (len > 0) { @@ -1340,7 +1340,7 @@ tulip_start( d_status = TULIP_DSTS_OWNER; len -= slen; addr += slen; - clsize = CLBYTES; + clsize = PAGE_SIZE; } } while ((m0 = next_m0) != NULL); diff --git a/sys/pci/ncr.c b/sys/pci/ncr.c index f9b8257..cebdcb7 100644 --- a/sys/pci/ncr.c +++ b/sys/pci/ncr.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: ncr.c,v 1.69 1996/03/31 03:17:50 gibbs Exp $ +** $Id: ncr.c,v 1.70 1996/04/07 17:32:33 bde Exp $ ** ** Device driver for the NCR 53C810 PCI-SCSI-Controller. ** @@ -147,10 +147,10 @@ /* ** The maximum transfer length (should be >= 64k). -** MUST NOT be greater than (MAX_SCATTER-1) * NBPG. +** MUST NOT be greater than (MAX_SCATTER-1) * PAGE_SIZE. */ -#define MAX_SIZE ((MAX_SCATTER-1) * (long) NBPG) +#define MAX_SIZE ((MAX_SCATTER-1) * (long) PAGE_SIZE) /* ** other @@ -1254,7 +1254,7 @@ static void ncr_attach (pcici_t tag, int unit); static char ident[] = - "\n$Id: ncr.c,v 1.69 1996/03/31 03:17:50 gibbs Exp $\n"; + "\n$Id: ncr.c,v 1.70 1996/04/07 17:32:33 bde Exp $\n"; static u_long ncr_version = NCR_VERSION * 11 + (u_long) sizeof (struct ncb) * 7 @@ -6425,7 +6425,7 @@ static int ncr_scatter free = MAX_SCATTER - 1; - if (vaddr & (NBPG-1)) free -= datalen / NBPG; + if (vaddr & (PAGE_SIZE-1)) free -= datalen / PAGE_SIZE; if (free>1) while ((chunk * free >= 2 * datalen) && (chunk>=1024)) @@ -6454,7 +6454,7 @@ static int ncr_scatter /* ** continue this segment */ - pnext = (paddr & (~(NBPG - 1))) + NBPG; + pnext = (paddr & (~(PAGE_SIZE - 1))) + PAGE_SIZE; /* ** Compute max size diff --git a/sys/pci/pdq_os.h b/sys/pci/pdq_os.h index 6176a09..7968d0e 100644 --- a/sys/pci/pdq_os.h +++ b/sys/pci/pdq_os.h @@ -21,9 +21,13 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pdq_os.h,v 1.5 1995/12/07 12:47:43 davidg Exp $ + * $Id: pdq_os.h,v 1.6 1996/01/30 22:59:57 mpp Exp $ * * $Log: pdq_os.h,v $ + * Revision 1.6 1996/01/30 22:59:57 mpp + * Fix a bunch of spelling errors in the comment fields of + * a bunch of system include files. + * * Revision 1.5 1995/12/07 12:47:43 davidg * Untangled the vm.h include file spaghetti. * @@ -97,7 +101,7 @@ #define PDQ_OS_PREFIX "%s%d: " #define PDQ_OS_PREFIX_ARGS pdq->pdq_os_name, pdq->pdq_unit -#define PDQ_OS_PAGESIZE NBPG +#define PDQ_OS_PAGESIZE PAGE_SIZE #define PDQ_OS_USEC_DELAY(n) DELAY(n) #define PDQ_OS_MEMZERO(p, n) bzero((caddr_t)(p), (n)) #define PDQ_OS_VA_TO_PA(p) vtophys(p) diff --git a/sys/pci/wd82371.c b/sys/pci/wd82371.c index e92248c..72ceb19 100644 --- a/sys/pci/wd82371.c +++ b/sys/pci/wd82371.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: wd82371.c,v 1.2 1996/01/30 19:04:09 wollman Exp $ + * $Id: wd82371.c,v 1.3 1996/04/07 17:39:17 bde Exp $ */ #include "pci.h" @@ -189,11 +189,11 @@ piix_dmasetup(void *xcp, char *vaddr, u_long count, int dir) * Deal with transfers that don't start on a page * boundary. */ - pgresid = (u_long)vaddr % NBPG; + pgresid = (u_long)vaddr % PAGE_SIZE; if (pgresid) { prd[i].prd_base = vtophys(vaddr); - if (count >= (NBPG - pgresid)) - prd[i].prd_count = NBPG - pgresid; + if (count >= (PAGE_SIZE - pgresid)) + prd[i].prd_count = PAGE_SIZE - pgresid; else prd[i].prd_count = count; vaddr += prd[i].prd_count; @@ -210,7 +210,7 @@ piix_dmasetup(void *xcp, char *vaddr, u_long count, int dir) u_long phys, n; phys = vtophys(vaddr); - n = (count > NBPG) ? NBPG : count; + n = (count > PAGE_SIZE) ? PAGE_SIZE : count; /* * If the current page is physically contiguous with * whatever we have in the previous PRD, just tack it diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 56d0b15..66be193 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992 * - * $Id: sd.c,v 1.86 1996/03/10 07:13:12 gibbs Exp $ + * $Id: sd.c,v 1.87 1996/03/27 18:50:09 bde Exp $ */ #include "opt_bounce.h" @@ -932,7 +932,7 @@ sddump(dev_t dev) return (ENXIO); /* Convert to disk sectors */ - num = (u_int32_t) num * NBPG / sd->params.secsiz; /* XXX it must be 512 */ + num = (u_int32_t) num * PAGE_SIZE / sd->params.secsiz; /* XXX it must be 512 */ /* check if controller active */ if (sddoingadump) diff --git a/sys/sys/ioccom.h b/sys/sys/ioccom.h index 9958ac7..e2c54a54 100644 --- a/sys/sys/ioccom.h +++ b/sys/sys/ioccom.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ioccom.h 8.2 (Berkeley) 3/28/94 - * $Id$ + * $Id: ioccom.h,v 1.2 1994/08/02 07:53:03 davidg Exp $ */ #ifndef _SYS_IOCCOM_H_ @@ -47,7 +47,7 @@ #define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) #define IOCGROUP(x) (((x) >> 8) & 0xff) -#define IOCPARM_MAX NBPG /* max size of ioctl, mult. of NBPG */ +#define IOCPARM_MAX PAGE_SIZE /* max size of ioctl, mult. of PAGE_SIZE */ #define IOC_VOID 0x20000000 /* no parameters */ #define IOC_OUT 0x40000000 /* copy out parameters */ #define IOC_IN 0x80000000 /* copy in parameters */ diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index c20f2c5..9c05e61 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)malloc.h 8.5 (Berkeley) 5/3/95 - * $Id: malloc.h,v 1.12 1996/02/24 06:24:41 hsu Exp $ + * $Id: malloc.h,v 1.12 1996/03/11 02:08:50 hsu Exp $ */ #ifndef _SYS_MALLOC_H_ @@ -285,9 +285,9 @@ struct kmembuckets { /* * Turn virtual addresses into kmem map indices */ -#define kmemxtob(alloc) (kmembase + (alloc) * NBPG) -#define btokmemx(addr) (((caddr_t)(addr) - kmembase) / NBPG) -#define btokup(addr) (&kmemusage[((caddr_t)(addr) - kmembase) >> CLSHIFT]) +#define kmemxtob(alloc) (kmembase + (alloc) * PAGE_SIZE) +#define btokmemx(addr) (((caddr_t)(addr) - kmembase) / PAGE_SIZE) +#define btokup(addr) (&kmemusage[(caddr_t)(addr) - kmembase >> PAGE_SHIFT]) /* * Macro versions for the usual cases of malloc/free diff --git a/sys/sys/param.h b/sys/sys/param.h index 085a53e..1cc3979 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)param.h 8.3 (Berkeley) 4/4/95 - * $Id: param.h,v 1.14 1996/02/24 06:39:21 hsu Exp $ + * $Id: param.h,v 1.14 1996/03/11 02:09:24 hsu Exp $ */ #ifndef _SYS_PARAM_H_ @@ -124,22 +124,10 @@ /* * Clustering of hardware pages on machines with ridiculously small * page sizes is done here. The paging subsystem deals with units of - * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each. + * CLSIZE pte's describing PAGE_SIZE (from machine/machparam.h) pages each. */ -#define CLBYTES (CLSIZE*NBPG) -#define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ -#define claligned(x) ((((int)(x))&CLOFSET)==0) -#define CLOFF CLOFSET -#define CLSHIFT (PGSHIFT+CLSIZELOG2) - -#if CLSIZE==1 -#define clbase(i) (i) -#define clrnd(i) (i) -#else -/* Give the base virtual address (first of CLSIZE). */ -#define clbase(i) ((i) &~ (CLSIZE-1)) -/* Round a number of clicks up to a whole cluster. */ -#define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) +#if 0 +#define CLBYTES (CLSIZE*PAGE_SIZE) #endif #define CBLOCK 128 /* Clist block size, must be a power of 2. */ @@ -206,11 +194,11 @@ * always allocate and free physical memory; requests for these * size allocations should be done infrequently as they will be slow. * - * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and + * Constraints: PAGE_SIZE <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and * MAXALLOCSIZE must be a power of two. */ #define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ -#define MAXALLOCSAVE (2 * CLBYTES) +#define MAXALLOCSAVE (2 * PAGE_SIZE) /* * Scale factor for scaled integers used to count %cpu time and load avgs. diff --git a/sys/sys/shm.h b/sys/sys/shm.h index 8dcf9de..36c29d4 100644 --- a/sys/sys/shm.h +++ b/sys/sys/shm.h @@ -1,4 +1,4 @@ -/* $Id: shm.h,v 1.7 1996/01/30 23:01:19 mpp Exp $ */ +/* $Id: shm.h,v 1.8 1996/02/23 18:49:20 peter Exp $ */ /* $NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $ */ /* @@ -43,7 +43,7 @@ #define SHM_RDONLY 010000 /* Attach read-only (else read-write) */ #define SHM_RND 020000 /* Round attach address to SHMLBA */ -#define SHMLBA CLBYTES /* Segment low boundary address multiple */ +#define SHMLBA PAGE_SIZE /* Segment low boundary address multiple */ /* "official" access mode definitions; somewhat braindead since you have to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions */ diff --git a/sys/ufs/mfs/mfsiom.h b/sys/ufs/mfs/mfsiom.h index a420aa3..0c71c37 100644 --- a/sys/ufs/mfs/mfsiom.h +++ b/sys/ufs/mfs/mfsiom.h @@ -31,13 +31,13 @@ * SUCH DAMAGE. * * @(#)mfsiom.h 8.1 (Berkeley) 6/11/93 - * $Id: mfsiom.h,v 1.2 1994/08/02 07:54:45 davidg Exp $ + * $Id: mfsiom.h,v 1.3 1994/08/21 07:16:11 paul Exp $ */ #ifndef _UFS_MFS_MFSIOM_H_ #define _UFS_MFS_MFSIOM_H_ -#define MFS_MAPREG (MAXPHYS/NBPG + 2) /* Kernel mapping pte's */ +#define MFS_MAPREG (MAXPHYS/PAGE_SIZE + 2) /* Kernel mapping pte's */ #define MFS_MAPSIZE 10 /* Size of alloc map for pte's */ #endif diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 8cbf3b8..d548931 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -39,7 +39,7 @@ * from: Utah $Hdr: swap_pager.c 1.4 91/04/30$ * * @(#)swap_pager.c 8.9 (Berkeley) 3/21/94 - * $Id: swap_pager.c,v 1.62 1996/03/03 21:11:05 dyson Exp $ + * $Id: swap_pager.c,v 1.63 1996/03/06 04:31:46 dyson Exp $ */ /* @@ -208,7 +208,7 @@ swap_pager_init() /* * Calculate the swap allocation constants. */ - dmmin = CLBYTES / DEV_BSIZE; + dmmin = PAGE_SIZE / DEV_BSIZE; dmmax = btodb(SWB_NPAGES * PAGE_SIZE) * 2; } |