diff options
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/conf/Makefile.i386 | 4 | ||||
-rw-r--r-- | sys/i386/i386/autoconf.c | 3 | ||||
-rw-r--r-- | sys/i386/i386/genassym.c | 13 | ||||
-rw-r--r-- | sys/i386/i386/locore.s | 44 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 16 | ||||
-rw-r--r-- | sys/i386/i386/pmap.c | 12 | ||||
-rw-r--r-- | sys/i386/i386/support.s | 4 | ||||
-rw-r--r-- | sys/i386/i386/symbols.raw | 3 | ||||
-rw-r--r-- | sys/i386/i386/vm_machdep.c | 4 | ||||
-rw-r--r-- | sys/i386/include/param.h | 46 | ||||
-rw-r--r-- | sys/i386/include/pmap.h | 57 | ||||
-rw-r--r-- | sys/i386/include/vmparam.h | 6 |
12 files changed, 106 insertions, 106 deletions
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) |