@@ -65,38 +65,6 @@ struct iovec {
#define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
-#define GET_FIELD(_p, _f, _w) (((_w) == 8) ? ((_p)->x64._f) : ((_p)->x32._f))
-
-#define SET_FIELD(_p, _f, _v, _w) do { \
- if ((_w) == 8) \
- (_p)->x64._f = (_v); \
- else \
- (_p)->x32._f = (_v); \
-} while (0)
-
-/* XXX SMH: following skanky macros rely on variable p2m_size being set */
-/* XXX TJD: also, "guest_width" should be the guest's sizeof(unsigned long) */
-
-struct domain_info_context {
- unsigned int guest_width;
- unsigned int p2m_frames;
- unsigned long p2m_size;
-};
-
-/* Number of xen_pfn_t in a page */
-#define FPP (PAGE_SIZE/(dinfo->guest_width))
-
-/* Number of entries in the pfn_to_mfn_frame_list_list */
-#define P2M_FLL_ENTRIES (((dinfo->p2m_size)+(FPP*FPP)-1)/(FPP*FPP))
-
-/* Number of entries in the pfn_to_mfn_frame_list */
-#define P2M_FL_ENTRIES (((dinfo->p2m_size)+FPP-1)/FPP)
-
-/* Size in bytes of the pfn_to_mfn_frame_list */
-#define P2M_GUEST_FL_SIZE ((P2M_FL_ENTRIES) * (dinfo->guest_width))
-#define P2M_TOOLS_FL_SIZE ((P2M_FL_ENTRIES) * \
- max_t(size_t, sizeof(xen_pfn_t), dinfo->guest_width))
-
#define DECLARE_DOMCTL struct xen_domctl domctl
#define DECLARE_SYSCTL struct xen_sysctl sysctl
#define DECLARE_PHYSDEV_OP struct physdev_op physdev_op
@@ -21,7 +21,7 @@
#define XC_CORE_H
#include "xen/version.h"
-#include "xc_private.h"
+#include "xg_private.h"
#include "xen/libelf/elfstructs.h"
/* section names */
@@ -18,10 +18,24 @@
*/
#include <inttypes.h>
-#include "xc_private.h"
+#include "xg_private.h"
#include "xg_core.h"
#include <xen/hvm/e820.h>
+/* Number of xen_pfn_t in a page */
+#define FPP (PAGE_SIZE/(dinfo->guest_width))
+
+/* Number of entries in the pfn_to_mfn_frame_list_list */
+#define P2M_FLL_ENTRIES (((dinfo->p2m_size)+(FPP*FPP)-1)/(FPP*FPP))
+
+/* Number of entries in the pfn_to_mfn_frame_list */
+#define P2M_FL_ENTRIES (((dinfo->p2m_size)+FPP-1)/FPP)
+
+/* Size in bytes of the pfn_to_mfn_frame_list */
+#define P2M_GUEST_FL_SIZE ((P2M_FL_ENTRIES) * (dinfo->guest_width))
+#define P2M_TOOLS_FL_SIZE ((P2M_FL_ENTRIES) * \
+ max_t(size_t, sizeof(xen_pfn_t), dinfo->guest_width))
+
int
xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt,
unsigned long pfn)
@@ -42,6 +42,21 @@
#endif
#endif
+#define GET_FIELD(_p, _f, _w) (((_w) == 8) ? ((_p)->x64._f) : ((_p)->x32._f))
+
+#define SET_FIELD(_p, _f, _v, _w) do { \
+ if ((_w) == 8) \
+ (_p)->x64._f = (_v); \
+ else \
+ (_p)->x32._f = (_v); \
+} while (0)
+
+struct domain_info_context {
+ unsigned int guest_width;
+ unsigned int p2m_frames;
+ unsigned long p2m_size;
+};
+
struct xc_dom_loader {
char *name;
/* Sadly the error returns from these functions are not consistent: */
@@ -139,7 +154,6 @@ static inline xen_pfn_t xc_pfn_to_mfn(xen_pfn_t pfn, xen_pfn_t *p2m,
/* Masks for PTE<->PFN conversions */
#define MADDR_BITS_X86 ((dinfo->guest_width == 8) ? 52 : 44)
#define MFN_MASK_X86 ((1ULL << (MADDR_BITS_X86 - PAGE_SHIFT_X86)) - 1)
-#define MADDR_MASK_X86 (MFN_MASK_X86 << PAGE_SHIFT_X86)
int pin_table(xc_interface *xch, unsigned int type, unsigned long mfn,
uint32_t dom);
@@ -13,7 +13,7 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*/
-#include "xc_private.h"
+#include "xg_private.h"
#include "xenguest.h"
#if defined(__i386__) || defined(__x86_64__)
There are some definitions which are used in libxenguest only now. Move them from libxenctrl over to libxenguest. Remove an unused macro. Signed-off-by: Juergen Gross <jgross@suse.com> --- tools/libs/ctrl/xc_private.h | 32 -------------------------------- tools/libs/guest/xg_core.h | 2 +- tools/libs/guest/xg_core_x86.c | 16 +++++++++++++++- tools/libs/guest/xg_private.h | 16 +++++++++++++++- tools/libs/guest/xg_resume.c | 2 +- 5 files changed, 32 insertions(+), 36 deletions(-)