Annotation of sys/arch/solbourne/include/pte.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: pte.h,v 1.1 2005/04/19 21:30:18 miod Exp $ */
2: /*
3: * Copyright (c) 2005, Miodrag Vallat
4: *
5: * Redistribution and use in source and binary forms, with or without
6: * modification, are permitted provided that the following conditions
7: * are met:
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: *
14: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17: * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
18: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
23: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24: * POSSIBILITY OF SUCH DAMAGE.
25: */
26:
27: /*
28: * KAP page table entries.
29: *
30: * Ref/Mod bits are handled in software.
31: */
32:
33: /*
34: * First-level : Page Directory Tables (topmost 9 bits of a va)
35: *
36: * Page directory entries contain both the pa and the va of the page
37: * tables they point to.
38: */
39:
40: #define PDT_INDEX_SIZE 9
41: #define PDT_INDEX_SHIFT 23
42: #define PDT_INDEX_MASK 0xff800000
43:
44: /*
45: * Second-level: Page Table Entries (middle 10 bits of a va)
46: */
47:
48: #define PT_INDEX_SIZE 10
49: #define PT_INDEX_SHIFT 13
50: #define PT_INDEX_MASK 0x007fe000
51:
52: #define PG_V 0x00000001
53: #define PG_NV 0x00000000
54: #define PG_RO 0x00000002 /* read only */
55: #define PG_RW 0x00000000
56: #define PG_PROT (PG_RO | PG_S)
57: #define PG_S 0x00000004 /* supervisor only */
58: #define PG_MA 0x00000018 /* memory attributes mask */
59: #define PG_G 0x00000020 /* global */
60: /* software bits from now on... */
61: #define PG_W 0x00000040 /* wired */
62: #define PG_M 0x00000080 /* modified */
63: #define PG_U 0x00000100 /* referenced */
64: /* 0x00001e00 unused */
65: #define PG_FRAME 0xffffe000 /* PFN mask */
66:
67: /* memory attributes */
68: #define PG_IO 0x00000000 /* not cached */
69: #define PG_CACHE 0x00000008 /* cached */
70: #define PG_BYTE_SHARED 0x00000010 /* byte-writeable shared */
71: #define PG_SHARED 0x00000018 /* non byte-writeable shared */
72:
73: /*
74: * Page directory constants
75: */
76:
77: #define PDT_SIZE 4096 /* size of a page directory table */
78: #define PT_SIZE 4096 /* size of a page table */
79:
80: #define NBR_PDE (PDT_SIZE / 8)
81: #define NBR_PTE (PT_SIZE / 4)
82:
83: #define NBSEG (1 << PDT_INDEX_SHIFT)
84:
85: #if !defined(_LOCORE)
86:
87: typedef u_int32_t pt_entry_t;
88:
89: typedef struct {
90: u_int32_t pde_pa;
91: pt_entry_t* pde_va;
92: } pd_entry_t;
93:
94: #endif
CVSweb