UNIX xv6 (rev8, 9/1/15)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Macros | Typedefs
mmu.h File Reference

Go to the source code of this file.

Data Structures

struct  segdesc
 
struct  taskstate
 
struct  gatedesc
 

Macros

#define FL_CF   0x00000001
 
#define FL_PF   0x00000004
 
#define FL_AF   0x00000010
 
#define FL_ZF   0x00000040
 
#define FL_SF   0x00000080
 
#define FL_TF   0x00000100
 
#define FL_IF   0x00000200
 
#define FL_DF   0x00000400
 
#define FL_OF   0x00000800
 
#define FL_IOPL_MASK   0x00003000
 
#define FL_IOPL_0   0x00000000
 
#define FL_IOPL_1   0x00001000
 
#define FL_IOPL_2   0x00002000
 
#define FL_IOPL_3   0x00003000
 
#define FL_NT   0x00004000
 
#define FL_RF   0x00010000
 
#define FL_VM   0x00020000
 
#define FL_AC   0x00040000
 
#define FL_VIF   0x00080000
 
#define FL_VIP   0x00100000
 
#define FL_ID   0x00200000
 
#define CR0_PE   0x00000001
 
#define CR0_MP   0x00000002
 
#define CR0_EM   0x00000004
 
#define CR0_TS   0x00000008
 
#define CR0_ET   0x00000010
 
#define CR0_NE   0x00000020
 
#define CR0_WP   0x00010000
 
#define CR0_AM   0x00040000
 
#define CR0_NW   0x20000000
 
#define CR0_CD   0x40000000
 
#define CR0_PG   0x80000000
 
#define CR4_PSE   0x00000010
 
#define SEG_KCODE   1
 
#define SEG_KDATA   2
 
#define SEG_KCPU   3
 
#define SEG_UCODE   4
 
#define SEG_UDATA   5
 
#define SEG_TSS   6
 
#define SEG(type, base, lim, dpl)
 
#define SEG16(type, base, lim, dpl)
 
#define DPL_USER   0x3
 
#define STA_X   0x8
 
#define STA_E   0x4
 
#define STA_C   0x4
 
#define STA_W   0x2
 
#define STA_R   0x2
 
#define STA_A   0x1
 
#define STS_T16A   0x1
 
#define STS_LDT   0x2
 
#define STS_T16B   0x3
 
#define STS_CG16   0x4
 
#define STS_TG   0x5
 
#define STS_IG16   0x6
 
#define STS_TG16   0x7
 
#define STS_T32A   0x9
 
#define STS_T32B   0xB
 
#define STS_CG32   0xC
 
#define STS_IG32   0xE
 
#define STS_TG32   0xF
 
#define PDX(va)   (((uint)(va) >> PDXSHIFT) & 0x3FF)
 
#define PTX(va)   (((uint)(va) >> PTXSHIFT) & 0x3FF)
 
#define PGADDR(d, t, o)   ((uint)((d) << PDXSHIFT | (t) << PTXSHIFT | (o)))
 
#define NPDENTRIES   1024
 
#define NPTENTRIES   1024
 
#define PGSIZE   4096
 
#define PGSHIFT   12
 
#define PTXSHIFT   12
 
#define PDXSHIFT   22
 
#define PGROUNDUP(sz)   (((sz)+PGSIZE-1) & ~(PGSIZE-1))
 
#define PGROUNDDOWN(a)   (((a)) & ~(PGSIZE-1))
 
#define PTE_P   0x001
 
#define PTE_W   0x002
 
#define PTE_U   0x004
 
#define PTE_PWT   0x008
 
#define PTE_PCD   0x010
 
#define PTE_A   0x020
 
#define PTE_D   0x040
 
#define PTE_PS   0x080
 
#define PTE_MBZ   0x180
 
#define PTE_ADDR(pte)   ((uint)(pte) & ~0xFFF)
 
#define PTE_FLAGS(pte)   ((uint)(pte) & 0xFFF)
 
#define SETGATE(gate, istrap, sel, off, d)
 

Typedefs

typedef uint pte_t
 

Macro Definition Documentation

#define CR0_AM   0x00040000

Definition at line 35 of file mmu.h.

#define CR0_CD   0x40000000

Definition at line 37 of file mmu.h.

#define CR0_EM   0x00000004

Definition at line 30 of file mmu.h.

#define CR0_ET   0x00000010

Definition at line 32 of file mmu.h.

#define CR0_MP   0x00000002

Definition at line 29 of file mmu.h.

#define CR0_NE   0x00000020

Definition at line 33 of file mmu.h.

#define CR0_NW   0x20000000

Definition at line 36 of file mmu.h.

#define CR0_PE   0x00000001

Definition at line 28 of file mmu.h.

#define CR0_PG   0x80000000

Definition at line 38 of file mmu.h.

#define CR0_TS   0x00000008

Definition at line 31 of file mmu.h.

#define CR0_WP   0x00010000

Definition at line 34 of file mmu.h.

#define CR4_PSE   0x00000010

Definition at line 40 of file mmu.h.

#define DPL_USER   0x3

Definition at line 79 of file mmu.h.

#define FL_AC   0x00040000

Definition at line 22 of file mmu.h.

#define FL_AF   0x00000010

Definition at line 7 of file mmu.h.

#define FL_CF   0x00000001

Definition at line 5 of file mmu.h.

#define FL_DF   0x00000400

Definition at line 12 of file mmu.h.

#define FL_ID   0x00200000

Definition at line 25 of file mmu.h.

#define FL_IF   0x00000200

Definition at line 11 of file mmu.h.

#define FL_IOPL_0   0x00000000

Definition at line 15 of file mmu.h.

#define FL_IOPL_1   0x00001000

Definition at line 16 of file mmu.h.

#define FL_IOPL_2   0x00002000

Definition at line 17 of file mmu.h.

#define FL_IOPL_3   0x00003000

Definition at line 18 of file mmu.h.

#define FL_IOPL_MASK   0x00003000

Definition at line 14 of file mmu.h.

#define FL_NT   0x00004000

Definition at line 19 of file mmu.h.

#define FL_OF   0x00000800

Definition at line 13 of file mmu.h.

#define FL_PF   0x00000004

Definition at line 6 of file mmu.h.

#define FL_RF   0x00010000

Definition at line 20 of file mmu.h.

#define FL_SF   0x00000080

Definition at line 9 of file mmu.h.

#define FL_TF   0x00000100

Definition at line 10 of file mmu.h.

#define FL_VIF   0x00080000

Definition at line 23 of file mmu.h.

#define FL_VIP   0x00100000

Definition at line 24 of file mmu.h.

#define FL_VM   0x00020000

Definition at line 21 of file mmu.h.

#define FL_ZF   0x00000040

Definition at line 8 of file mmu.h.

#define NPDENTRIES   1024

Definition at line 121 of file mmu.h.

#define NPTENTRIES   1024

Definition at line 122 of file mmu.h.

#define PDX (   va)    (((uint)(va) >> PDXSHIFT) & 0x3FF)

Definition at line 112 of file mmu.h.

#define PDXSHIFT   22

Definition at line 127 of file mmu.h.

#define PGADDR (   d,
  t,
 
)    ((uint)((d) << PDXSHIFT | (t) << PTXSHIFT | (o)))

Definition at line 118 of file mmu.h.

#define PGROUNDDOWN (   a)    (((a)) & ~(PGSIZE-1))

Definition at line 130 of file mmu.h.

#define PGROUNDUP (   sz)    (((sz)+PGSIZE-1) & ~(PGSIZE-1))

Definition at line 129 of file mmu.h.

#define PGSHIFT   12

Definition at line 125 of file mmu.h.

#define PGSIZE   4096

Definition at line 123 of file mmu.h.

#define PTE_A   0x020

Definition at line 138 of file mmu.h.

#define PTE_ADDR (   pte)    ((uint)(pte) & ~0xFFF)

Definition at line 144 of file mmu.h.

#define PTE_D   0x040

Definition at line 139 of file mmu.h.

#define PTE_FLAGS (   pte)    ((uint)(pte) & 0xFFF)

Definition at line 145 of file mmu.h.

#define PTE_MBZ   0x180

Definition at line 141 of file mmu.h.

#define PTE_P   0x001

Definition at line 133 of file mmu.h.

#define PTE_PCD   0x010

Definition at line 137 of file mmu.h.

#define PTE_PS   0x080

Definition at line 140 of file mmu.h.

#define PTE_PWT   0x008

Definition at line 136 of file mmu.h.

#define PTE_U   0x004

Definition at line 135 of file mmu.h.

#define PTE_W   0x002

Definition at line 134 of file mmu.h.

#define PTX (   va)    (((uint)(va) >> PTXSHIFT) & 0x3FF)

Definition at line 115 of file mmu.h.

#define PTXSHIFT   12

Definition at line 126 of file mmu.h.

#define SEG (   type,
  base,
  lim,
  dpl 
)
Value:
(struct segdesc) \
{ ((lim) >> 12) & 0xffff, (uint)(base) & 0xffff, \
((uint)(base) >> 16) & 0xff, type, 1, dpl, 1, \
(uint)(lim) >> 28, 0, 0, 1, 1, (uint)(base) >> 24 }

Definition at line 69 of file mmu.h.

#define SEG16 (   type,
  base,
  lim,
  dpl 
)
Value:
(struct segdesc) \
{ (lim) & 0xffff, (uint)(base) & 0xffff, \
((uint)(base) >> 16) & 0xff, type, 1, dpl, 1, \
(uint)(lim) >> 16, 0, 0, 1, 0, (uint)(base) >> 24 }

Definition at line 73 of file mmu.h.

#define SEG_KCODE   1

Definition at line 42 of file mmu.h.

#define SEG_KCPU   3

Definition at line 44 of file mmu.h.

#define SEG_KDATA   2

Definition at line 43 of file mmu.h.

#define SEG_TSS   6

Definition at line 47 of file mmu.h.

#define SEG_UCODE   4

Definition at line 45 of file mmu.h.

#define SEG_UDATA   5

Definition at line 46 of file mmu.h.

#define SETGATE (   gate,
  istrap,
  sel,
  off,
 
)
Value:
{ \
(gate).off_15_0 = (uint)(off) & 0xffff; \
(gate).cs = (sel); \
(gate).args = 0; \
(gate).rsv1 = 0; \
(gate).type = (istrap) ? STS_TG32 : STS_IG32; \
(gate).s = 0; \
(gate).dpl = (d); \
(gate).p = 1; \
(gate).off_31_16 = (uint)(off) >> 16; \
}

Definition at line 213 of file mmu.h.

#define STA_A   0x1

Definition at line 87 of file mmu.h.

#define STA_C   0x4

Definition at line 84 of file mmu.h.

#define STA_E   0x4

Definition at line 83 of file mmu.h.

#define STA_R   0x2

Definition at line 86 of file mmu.h.

#define STA_W   0x2

Definition at line 85 of file mmu.h.

#define STA_X   0x8

Definition at line 82 of file mmu.h.

#define STS_CG16   0x4

Definition at line 93 of file mmu.h.

#define STS_CG32   0xC

Definition at line 99 of file mmu.h.

#define STS_IG16   0x6

Definition at line 95 of file mmu.h.

#define STS_IG32   0xE

Definition at line 100 of file mmu.h.

#define STS_LDT   0x2

Definition at line 91 of file mmu.h.

#define STS_T16A   0x1

Definition at line 90 of file mmu.h.

#define STS_T16B   0x3

Definition at line 92 of file mmu.h.

#define STS_T32A   0x9

Definition at line 97 of file mmu.h.

#define STS_T32B   0xB

Definition at line 98 of file mmu.h.

#define STS_TG   0x5

Definition at line 94 of file mmu.h.

#define STS_TG16   0x7

Definition at line 96 of file mmu.h.

#define STS_TG32   0xF

Definition at line 101 of file mmu.h.

Typedef Documentation

typedef uint pte_t

Definition at line 148 of file mmu.h.