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