source: trunk/packages/xen-common/xen-common/extras/mini-os/include/mm.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 2.0 KB
Line 
1/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
2 *
3 * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge
4 * Copyright (c) 2005, Keir A Fraser
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef _MM_H_
26#define _MM_H_
27
28#if defined(__i386__)
29#include <xen/arch-x86_32.h>
30#elif defined(__x86_64__)
31#include <xen/arch-x86_64.h>
32#elif defined(__ia64__)
33#include <xen/arch-ia64.h>
34#else
35#error "Unsupported architecture"
36#endif
37
38#include <lib.h>
39#include <arch_mm.h>
40
41
42void init_mm(void);
43unsigned long alloc_pages(int order);
44#define alloc_page()    alloc_pages(0)
45void free_pages(void *pointer, int order);
46
47static __inline__ int get_order(unsigned long size)
48{
49    int order;
50    size = (size-1) >> PAGE_SHIFT;
51    for ( order = 0; size; order++ )
52        size >>= 1;
53    return order;
54}
55
56void arch_init_demand_mapping_area(unsigned long max_pfn);
57void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p);
58void arch_init_p2m(unsigned long max_pfn_p);
59
60void *map_frames(unsigned long *f, unsigned long n);
61
62#endif /* _MM_H_ */
Note: See TracBrowser for help on using the repository browser.