ia64/xen-unstable

view xen-2.4.16/include/xeno/mm.h @ 86:4a10fe9b20ec

bitkeeper revision 1.15 (3e24a984iRiWWcgfKCxu2p5q3YbxXw)

Many files:
First half of support for per-domain GDTs and LDTs
author kaf24@labyrinth.cl.cam.ac.uk
date Wed Jan 15 00:21:24 2003 +0000 (2003-01-15)
parents c3e6a52cd801
children 0ce34da1b61d cb2688ed1a23 11615a0ad0f1 2c1ef70cc49f
line source
2 #ifndef __XENO_MM_H__
3 #define __XENO_MM_H__
5 #include <xeno/config.h>
6 #include <asm/atomic.h>
7 #include <asm/desc.h>
8 #include <xeno/list.h>
9 #include <hypervisor-ifs/hypervisor-if.h>
11 /* XXX KAF: These may die eventually, but so many refs in slab.c :((( */
13 /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low four bits) */
14 #define __GFP_DMA 0x01
16 /* Action modifiers - doesn't change the zoning */
17 #define __GFP_WAIT 0x10 /* Can wait and reschedule? */
18 #define __GFP_HIGH 0x20 /* Should access emergency pools? */
19 #define __GFP_IO 0x40 /* Can start low memory physical IO? */
20 #define __GFP_HIGHIO 0x80 /* Can start high mem physical IO? */
21 #define __GFP_FS 0x100 /* Can call down to low-level FS? */
23 #define GFP_ATOMIC (__GFP_HIGH)
24 #define GFP_KERNEL (__GFP_HIGH | __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS)
26 /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some
27 platforms, used as appropriate on others */
29 #define GFP_DMA __GFP_DMA
32 /******************************************************************************
33 * The following is for page_alloc.c.
34 */
36 void init_page_allocator(unsigned long min, unsigned long max);
37 unsigned long __get_free_pages(int mask, int order);
38 void __free_pages(unsigned long p, int order);
39 #define get_free_page(_m) (__get_free_pages((_m),0))
40 #define __get_free_page(_m) (__get_free_pages((_m),0))
41 #define free_pages(_p,_o) (__free_pages(_p,_o))
42 #define free_page(_p) (__free_pages(_p,0))
45 /******************************************************************************
46 * The following is the array of page info. One entry per page owned
47 * by the hypervisor, indexed from `mem_map', just like Linux.
48 *
49 * 12.11.02. We no longer use struct page or mem_map, these are replaced
50 * with struct pfn_info and frame_table respectively. Boris Dragovic
51 */
53 /*
54 * This is still fatter than I'd like. Do we need the count?
55 * Do we need the flags? The list at least seems req'd by slab.c.
56 */
57 typedef struct pfn_info {
58 struct list_head list; /* ->mapping has some page lists. */
59 unsigned long next; /* used for threading pages belonging */
60 unsigned long prev; /* to same domain */
61 unsigned long flags; /* atomic flags. */
62 unsigned long tot_count; /* Total domain usage count. */
63 unsigned long type_count; /* pagetable/dir, or domain-writeable refs. */
64 } frame_table_t;
66 /*
67 * We use a high bit to indicate that a page is pinned.
68 * We do not use the top bit as that would mean that we'd get confused with
69 * -ve error numbers in some places in common/memory.c.
70 */
71 #define REFCNT_PIN_BIT 0x40000000UL
73 #define get_page_tot(p) ((p)->tot_count++)
74 #define put_page_tot(p) (--(p)->tot_count)
75 #define page_tot_count(p) ((p)->tot_count)
76 #define set_page_tot_count(p,v) ((p)->tot_count = v)
78 #define get_page_type(p) ((p)->type_count++)
79 #define put_page_type(p) (--(p)->type_count)
80 #define page_type_count(p) ((p)->type_count)
81 #define set_page_type_count(p,v) ((p)->type_count = v)
83 #define PG_domain_mask 0x00ffffff /* owning domain (24 bits) */
84 /* hypervisor flags (domain == 0) */
85 #define PG_slab 24
86 /* domain flags (domain != 0) */
87 /*
88 * NB. The following three flags are MUTUALLY EXCLUSIVE!
89 * At most one can be true at any point, and 'type_count' counts how many
90 * references exist of teh current type. A change in type can only occur
91 * when type_count == 0.
92 */
93 #define PG_type_mask (7<<24) /* bits 24-26 */
94 #define PGT_none (0<<24) /* no special uses of this page */
95 #define PGT_l1_page_table (1<<24) /* using this page as an L1 page table? */
96 #define PGT_l2_page_table (2<<24) /* using this page as an L2 page table? */
97 #define PGT_l3_page_table (3<<24) /* using this page as an L3 page table? */
98 #define PGT_l4_page_table (4<<24) /* using this page as an L4 page table? */
99 #define PGT_gdt_page (5<<24) /* using this page in a GDT? */
100 #define PGT_ldt_page (6<<24) /* using this page in an LDT? */
101 #define PGT_writeable_page (7<<24) /* has writable mappings of this page? */
103 #define PageSlab(page) test_bit(PG_slab, &(page)->flags)
104 #define PageSetSlab(page) set_bit(PG_slab, &(page)->flags)
105 #define PageClearSlab(page) clear_bit(PG_slab, &(page)->flags)
107 /* The array of struct pfn_info,
108 * free pfn list and number of free pfns in the free list
109 */
110 extern frame_table_t * frame_table;
111 extern unsigned long frame_table_size;
112 extern struct list_head free_list;
113 extern unsigned int free_pfns;
114 extern unsigned long max_page;
115 void init_frametable(unsigned long nr_pages);
117 /* Part of the domain API. */
118 int do_process_page_updates(page_update_request_t *updates, int count);
120 #define DEFAULT_GDT_ENTRIES ((FIRST_DOMAIN_GDT_ENTRY*8)-1)
121 #define DEFAULT_GDT_ADDRESS ((unsigned long)gdt_table)
123 #endif /* __XENO_MM_H__ */