debuggers.hg

view xen/include/asm-x86/x86_32/page.h @ 3765:4dfebfdc7933

bitkeeper revision 1.1159.252.1 (4208e2a42Fwe83QQfJdFQI8V302tYg)

Reorganise mm.h to split out 32-bit and 64-bit definitions. Fix x86_64
definitions to mask out the bits that we don't care about.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Tue Feb 08 16:02:44 2005 +0000 (2005-02-08)
parents
children 89e86842952a
line source
1 /* -*- Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
3 #ifndef __X86_32_PAGE_H__
4 #define __X86_32_PAGE_H__
6 #define L1_PAGETABLE_SHIFT 12
7 #define L2_PAGETABLE_SHIFT 22
8 #define PAGE_SHIFT L1_PAGETABLE_SHIFT
10 #define ENTRIES_PER_L1_PAGETABLE 1024
11 #define ENTRIES_PER_L2_PAGETABLE 1024
13 #define __PAGE_OFFSET (0xFC400000)
15 #ifndef __ASSEMBLY__
16 #include <xen/config.h>
17 typedef struct { unsigned long l1_lo; } l1_pgentry_t;
18 typedef struct { unsigned long l2_lo; } l2_pgentry_t;
19 #endif /* !__ASSEMBLY__ */
21 /* Strip type from a table entry. */
22 #define l1_pgentry_val(_x) ((_x).l1_lo)
23 #define l2_pgentry_val(_x) ((_x).l2_lo)
25 /* Add type to a table entry. */
26 #define mk_l1_pgentry(_x) ( (l1_pgentry_t) { (_x) } )
27 #define mk_l2_pgentry(_x) ( (l2_pgentry_t) { (_x) } )
29 /* Turn a typed table entry into a physical address. */
30 #define l1_pgentry_to_phys(_x) (l1_pgentry_val(_x) & PAGE_MASK)
31 #define l2_pgentry_to_phys(_x) (l2_pgentry_val(_x) & PAGE_MASK)
33 /* Turn a typed table entry into a page index. */
34 #define l1_pgentry_to_pfn(_x) (l1_pgentry_val(_x) >> PAGE_SHIFT)
35 #define l2_pgentry_to_pfn(_x) (l2_pgentry_val(_x) >> PAGE_SHIFT)
37 /* Pagetable walking. */
38 #define l2_pgentry_to_l1(_x) \
39 ((l1_pgentry_t *)__va(l2_pgentry_to_phys(_x)))
41 /* Given a virtual address, get an entry offset into a page table. */
42 #define l1_table_offset(_a) \
43 (((_a) >> L1_PAGETABLE_SHIFT) & (ENTRIES_PER_L1_PAGETABLE - 1))
44 #define l2_table_offset(_a) \
45 ((_a) >> L2_PAGETABLE_SHIFT)
47 /* Given a virtual address, get an entry offset into a linear page table. */
48 #define l1_linear_offset(_a) ((_a) >> PAGE_SHIFT)
50 /* Root page-table definitions. */
51 #define pagetable_t l2_pgentry_t
52 #define pagetable_val(_x) ((_x).l2_lo)
53 #define mk_pagetable(_x) ( (l2_pgentry_t) { (_x) } )
54 #define ENTRIES_PER_PAGETABLE ENTRIES_PER_L2_PAGETABLE
56 #endif /* __X86_32_PAGE_H__ */