1 /******************************************************************************
2  * memory.h
3  *
4  * Memory reservation and information.
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  * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
25  */
26 
27 #ifndef __XEN_PUBLIC_MEMORY_H__
28 #define __XEN_PUBLIC_MEMORY_H__
29 
30 #include "xen.h"
31 
32 /* Source mapping space. */
33 /* ` enum phys_map_space { */
34 #define XENMAPSPACE_shared_info  0 /* shared info page */
35 #define XENMAPSPACE_grant_table  1 /* grant table page */
36 #define XENMAPSPACE_gmfn         2 /* GMFN */
37 #define XENMAPSPACE_gmfn_range   3 /* GMFN range, XENMEM_add_to_physmap only. */
38 #define XENMAPSPACE_gmfn_foreign 4 /* GMFN from another dom,
39                                     * XENMEM_add_to_physmap_batch only. */
40 /* ` } */
41 
42 /*
43  * Sets the GPFN at which a particular page appears in the specified guest's
44  * pseudophysical address space.
45  * arg == addr of xen_add_to_physmap_t.
46  */
47 #define XENMEM_add_to_physmap      7
48 struct xen_add_to_physmap {
49     /* Which domain to change the mapping for. */
50     domid_t domid;
51 
52     /* Number of pages to go through for gmfn_range */
53     UINT16    size;
54 
55     UINT32 space; /* => enum phys_map_space */
56 
57 #define XENMAPIDX_grant_table_status 0x80000000
58 
59     /* Index into space being mapped. */
60     xen_ulong_t idx;
61 
62     /* GPFN in domid where the source mapping page should appear. */
63     xen_pfn_t     gpfn;
64 };
65 typedef struct xen_add_to_physmap xen_add_to_physmap_t;
66 DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
67 
68 /*
69  * Unmaps the page appearing at a particular GPFN from the specified guest's
70  * pseudophysical address space.
71  * arg == addr of xen_remove_from_physmap_t.
72  */
73 #define XENMEM_remove_from_physmap      15
74 struct xen_remove_from_physmap {
75     /* Which domain to change the mapping for. */
76     domid_t domid;
77 
78     /* GPFN of the current mapping of the page. */
79     xen_pfn_t     gpfn;
80 };
81 typedef struct xen_remove_from_physmap xen_remove_from_physmap_t;
82 DEFINE_XEN_GUEST_HANDLE(xen_remove_from_physmap_t);
83 
84 #endif /* __XEN_PUBLIC_MEMORY_H__ */
85 
86 /*
87  * Local variables:
88  * mode: C
89  * c-file-style: "BSD"
90  * c-basic-offset: 4
91  * tab-width: 4
92  * indent-tabs-mode: nil
93  * End:
94  */
95