ia64/xen-unstable

view xen-2.4.16/include/xeno/mm.h @ 123:946e29624b77

bitkeeper revision 1.22.2.1 (3e428abeBVF1J00dtGMWKqQjaRgvkA)

mm.h, memory.c:
Fix compiler warning.
author kaf24@labyrinth.cl.cam.ac.uk
date Thu Feb 06 16:18:06 2003 +0000 (2003-02-06)
parents 659cfa9656db
children 2f78322be16a 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 flags; /* atomic flags. */
60 unsigned long tot_count; /* Total domain usage count. */
61 unsigned long type_count; /* pagetable/dir, or domain-writeable refs. */
62 } frame_table_t;
64 /*
65 * We use a high bit to indicate that a page is pinned.
66 * We do not use the top bit as that would mean that we'd get confused with
67 * -ve error numbers in some places in common/memory.c.
68 */
69 #define REFCNT_PIN_BIT 0x40000000UL
71 #define get_page_tot(p) ((p)->tot_count++)
72 #define put_page_tot(p) (--(p)->tot_count)
73 #define page_tot_count(p) ((p)->tot_count)
74 #define set_page_tot_count(p,v) ((p)->tot_count = v)
76 #define get_page_type(p) ((p)->type_count++)
77 #define put_page_type(p) (--(p)->type_count)
78 #define page_type_count(p) ((p)->type_count)
79 #define set_page_type_count(p,v) ((p)->type_count = v)
81 #define PG_domain_mask 0x00ffffff /* owning domain (24 bits) */
82 /* hypervisor flags (domain == 0) */
83 #define PG_slab 24
84 /* domain flags (domain != 0) */
85 /*
86 * NB. The following three flags are MUTUALLY EXCLUSIVE!
87 * At most one can be true at any point, and 'type_count' counts how many
88 * references exist of teh current type. A change in type can only occur
89 * when type_count == 0.
90 */
91 #define PG_type_mask (7<<24) /* bits 24-26 */
92 #define PGT_none (0<<24) /* no special uses of this page */
93 #define PGT_l1_page_table (1<<24) /* using this page as an L1 page table? */
94 #define PGT_l2_page_table (2<<24) /* using this page as an L2 page table? */
95 #define PGT_l3_page_table (3<<24) /* using this page as an L3 page table? */
96 #define PGT_l4_page_table (4<<24) /* using this page as an L4 page table? */
97 #define PGT_gdt_page (5<<24) /* using this page in a GDT? */
98 #define PGT_ldt_page (6<<24) /* using this page in an LDT? */
99 #define PGT_writeable_page (7<<24) /* has writable mappings of this page? */
101 #define PageSlab(page) test_bit(PG_slab, &(page)->flags)
102 #define PageSetSlab(page) set_bit(PG_slab, &(page)->flags)
103 #define PageClearSlab(page) clear_bit(PG_slab, &(page)->flags)
105 /* The array of struct pfn_info,
106 * free pfn list and number of free pfns in the free list
107 */
108 extern frame_table_t * frame_table;
109 extern unsigned long frame_table_size;
110 extern struct list_head free_list;
111 extern unsigned int free_pfns;
112 extern unsigned long max_page;
113 void init_frametable(unsigned long nr_pages);
115 /*
116 * The MPT (machine->physical mapping table) is an array of word-sized
117 * values, indexed on machine frame number. It is expected that guest OSes
118 * will use it to store a "physical" frame number to give the appearance of
119 * contiguous (or near contiguous) physical memory.
120 */
121 #undef machine_to_phys_mapping
122 #define machine_to_phys_mapping ((unsigned long *)RDWR_MPT_VIRT_START)
124 /* Part of the domain API. */
125 int do_process_page_updates(page_update_request_t *updates, int count);
127 #define DEFAULT_GDT_ENTRIES ((FIRST_DOMAIN_GDT_ENTRY*8)-1)
128 #define DEFAULT_GDT_ADDRESS ((unsigned long)gdt_table)
130 #endif /* __XENO_MM_H__ */