ia64/xen-unstable

view extras/mini-os/include/mm.h @ 16838:945820bfedb6

minios: POSIX fixes
Fixes some functions which are POSIX. Also make them ifndef HAVE_LIBC.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jan 22 14:20:22 2008 +0000 (2008-01-22)
parents 2d6a0ee25f2a
children a905c582a406
line source
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 */
25 #ifndef _MM_H_
26 #define _MM_H_
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
38 #include <lib.h>
39 #include <arch_mm.h>
42 void init_mm(void);
43 unsigned long alloc_pages(int order);
44 #define alloc_page() alloc_pages(0)
45 void free_pages(void *pointer, int order);
47 static __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 }
56 void arch_init_demand_mapping_area(unsigned long max_pfn);
57 void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p);
58 void arch_init_p2m(unsigned long max_pfn_p);
60 /* map f[i*stride]+i*increment for i in 0..n-1, aligned on alignment pages */
61 void *map_frames_ex(unsigned long *f, unsigned long n, unsigned long stride,
62 unsigned long increment, unsigned long alignment, domid_t id,
63 int may_fail, unsigned long prot);
65 #endif /* _MM_H_ */