summaryrefslogtreecommitdiffstats
path: root/sys/i386/include
diff options
context:
space:
mode:
Diffstat (limited to 'sys/i386/include')
-rw-r--r--sys/i386/include/param.h46
-rw-r--r--sys/i386/include/pmap.h57
-rw-r--r--sys/i386/include/vmparam.h6
3 files changed, 61 insertions, 48 deletions
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)
OpenPOWER on IntegriCloud