@@ -215,7 +215,7 @@ install: build
$(INSTALL_DATA) libxenctrl.a $(DESTDIR)$(libdir)
$(SYMLINK_SHLIB) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenctrl.so.$(MAJOR)
$(SYMLINK_SHLIB) libxenctrl.so.$(MAJOR) $(DESTDIR)$(libdir)/libxenctrl.so
- $(INSTALL_DATA) include/xenctrl.h include/xenctrl_compat.h $(DESTDIR)$(includedir)
+ $(INSTALL_DATA) include/xenctrl.h include/xenctrl_compat.h include/xenctrl_dom.h $(DESTDIR)$(includedir)
$(INSTALL_SHLIB) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
$(INSTALL_DATA) libxenguest.a $(DESTDIR)$(libdir)
$(SYMLINK_SHLIB) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenguest.so.$(MAJOR)
@@ -235,6 +235,7 @@ uninstall:
rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xencontrol.pc
rm -f $(DESTDIR)$(includedir)/xenctrl.h
rm -f $(DESTDIR)$(includedir)/xenctrl_compat.h
+ rm -f $(DESTDIR)$(includedir)/xenctrl_dom.h
rm -f $(DESTDIR)$(libdir)/libxenctrl.so
rm -f $(DESTDIR)$(libdir)/libxenctrl.so.$(MAJOR)
rm -f $(DESTDIR)$(libdir)/libxenctrl.so.$(MAJOR).$(MINOR)
@@ -17,9 +17,7 @@
#define _XC_DOM_H
#include <xen/libelf/libelf.h>
-#include <xenguest.h>
-#define INVALID_PFN ((xen_pfn_t)-1)
#define X86_HVM_NR_SPECIAL_PAGES 8
#define X86_HVM_END_SPECIAL_REGION 0xff000u
#define XG_MAX_MODULES 2
@@ -38,6 +36,12 @@ struct xc_dom_seg {
xen_pfn_t pages;
};
+struct xc_hvm_firmware_module {
+ uint8_t *data;
+ uint32_t length;
+ uint64_t guest_addr_out;
+};
+
struct xc_dom_mem {
struct xc_dom_mem *next;
void *ptr;
@@ -255,6 +259,8 @@ struct xc_dom_arch {
int (*setup_pgtables) (struct xc_dom_image * dom);
/* arch-specific data structs setup */
+ /* in Mini-OS environment start_info might be a macro, avoid collision. */
+#undef start_info
int (*start_info) (struct xc_dom_image * dom);
int (*shared_info) (struct xc_dom_image * dom, void *shared_info);
int (*vcpu) (struct xc_dom_image * dom);
@@ -22,6 +22,8 @@
#ifndef XENGUEST_H
#define XENGUEST_H
+#include <xenctrl_dom.h>
+
#define XC_NUMA_NO_NODE (~0U)
#define XCFLAGS_LIVE (1 << 0)
@@ -249,12 +251,6 @@ int xc_linux_build(xc_interface *xch,
unsigned int console_evtchn,
unsigned long *console_mfn);
-struct xc_hvm_firmware_module {
- uint8_t *data;
- uint32_t length;
- uint64_t guest_addr_out;
-};
-
/*
* Sets *lockfd to -1.
* Has deallocated everything even on error.
@@ -60,12 +60,13 @@
*
*/
-#include "xg_private.h"
+#include "xc_private.h"
#include "xc_core.h"
-#include "xenctrl_dom.h"
#include <stdlib.h>
#include <unistd.h>
+#include <xen/libelf/libelf.h>
+
/* number of pages to write at a time */
#define DUMP_INCREMENT (4 * 1024)
@@ -21,7 +21,7 @@
#define XC_CORE_H
#include "xen/version.h"
-#include "xg_private.h"
+#include "xc_private.h"
#include "xen/libelf/elfstructs.h"
/* section names */
@@ -16,7 +16,7 @@
*
*/
-#include "xg_private.h"
+#include "xc_private.h"
#include "xc_core.h"
#include <xen-tools/libs.h>
@@ -17,12 +17,10 @@
*
*/
-#include "xg_private.h"
+#include "xc_private.h"
#include "xc_core.h"
#include <xen/hvm/e820.h>
-#define GET_FIELD(_p, _f) ((dinfo->guest_width==8) ? ((_p)->x64._f) : ((_p)->x32._f))
-
int
xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt,
unsigned long pfn)
@@ -98,7 +96,7 @@ xc_core_arch_map_p2m_rw(xc_interface *xch, struct domain_info_context *dinfo, xc
live_p2m_frame_list_list =
xc_map_foreign_range(xch, dom, PAGE_SIZE, PROT_READ,
- GET_FIELD(live_shinfo, arch.pfn_to_mfn_frame_list_list));
+ GET_FIELD(live_shinfo, arch.pfn_to_mfn_frame_list_list, dinfo->guest_width));
if ( !live_p2m_frame_list_list )
{
@@ -21,8 +21,7 @@
#include "xc_private.h"
#include "xc_core.h"
-#include "xg_private.h"
-#include "xg_save_restore.h"
+#include "xc_private.h"
#include <xen/memory.h>
#include <xen/hvm/hvm_op.h>
@@ -19,7 +19,6 @@
#include <string.h>
#include "xc_private.h"
-#include "xg_private.h"
xc_hypercall_buffer_t XC__HYPERCALL_BUFFER_NAME(HYPERCALL_BUFFER_NULL) = {
.hbuf = NULL,
@@ -18,7 +18,6 @@
*/
#include "xc_private.h"
-#include "xg_private.h"
#include "xenctrl_dom.h"
#include <stdarg.h>
#include <stdlib.h>
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
+#include <limits.h>
#include <sys/ioctl.h>
#include "_paths.h"
@@ -62,6 +63,39 @@ struct iovec {
#include <sys/uio.h>
#endif
+#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 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
@@ -75,6 +109,8 @@ struct iovec {
#define PAGE_SIZE XC_PAGE_SIZE
#define PAGE_MASK XC_PAGE_MASK
+#define INVALID_PFN ((xen_pfn_t)-1)
+
/*
** Define max dirty page cache to permit during save/restore -- need to balance
** keeping cache usage down with CPU impact of invalidating too often.
@@ -14,8 +14,6 @@
*/
#include "xc_private.h"
-#include "xg_private.h"
-#include "xg_save_restore.h"
#if defined(__i386__) || defined(__x86_64__)
@@ -97,15 +97,6 @@ typedef uint64_t x86_pgentry_t;
#define NRPAGES(x) (ROUNDUP(x, PAGE_SHIFT) >> PAGE_SHIFT)
-
-/* 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 long p2m_size;
-};
-
static inline xen_pfn_t xc_pfn_to_mfn(xen_pfn_t pfn, xen_pfn_t *p2m,
unsigned gwidth)
{
@@ -121,19 +112,6 @@ static inline xen_pfn_t xc_pfn_to_mfn(xen_pfn_t pfn, xen_pfn_t *p2m,
}
}
-/* 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))
/* Masks for PTE<->PFN conversions */
#define MADDR_BITS_X86 ((dinfo->guest_width == 8) ? 52 : 44)
@@ -109,15 +109,6 @@ static inline int get_platform_info(xc_interface *xch, uint32_t dom,
#define M2P_SIZE(_m) ROUNDUP(((_m) * sizeof(xen_pfn_t)), M2P_SHIFT)
#define M2P_CHUNKS(_m) (M2P_SIZE((_m)) >> M2P_SHIFT)
-#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)
-
#define UNFOLD_CR3(_c) \
((uint64_t)((dinfo->guest_width == 8) \
? ((_c) >> 12) \