#include "option_rom.h"
#include <xen/hvm/params.h>
+#include <xen-tools/libs.h>
#define ROM_INCLUDE_ROMBIOS
#define ROM_INCLUDE_VGABIOS
#include "util.h"
#include "hypercall.h"
#include <xen/hvm/hvm_xs_strings.h>
+#include <xen-tools/libs.h>
/* SBMIOS handle base values */
#define SMBIOS_HANDLE_TYPE0 0x0000
void __bug(char *file, int line) __attribute__((noreturn));
#define BUG() __bug(__FILE__, __LINE__)
#define BUG_ON(p) do { if (p) BUG(); } while (0)
-#define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)]))
#define min_t(type,x,y) \
({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
--- /dev/null
+#ifndef __XEN_TOOLS_LIBS__
+
+#ifndef BUILD_BUG_ON
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#define BUILD_BUG_ON(p) ({ _Static_assert(!(p), "!(" #p ")"); })
+#else
+#define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)]))
+#endif
+#endif
+
+#endif /* __XEN_TOOLS_LIBS__ */
#include "xg_private.h"
#include "xc_core.h"
+#include <xen-tools/libs.h>
+
int
xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt,
unsigned long pfn)
* The Grant Table region space is not used until the guest is
* booting. Use the first page for the scratch pfn.
*/
- XC_BUILD_BUG_ON(GUEST_GNTTAB_SIZE < XC_PAGE_SIZE);
+ BUILD_BUG_ON(GUEST_GNTTAB_SIZE < XC_PAGE_SIZE);
*gpfn = GUEST_GNTTAB_BASE >> XC_PAGE_SHIFT;
#include "xc_private.h"
#include "xc_bitops.h"
#include <xen/hvm/params.h>
+#include <xen-tools/libs.h>
enum {
#define XEN_CPUFEATURE(name, value) X86_FEATURE_##name = value,
hvm_hap[FEATURESET_NR_ENTRIES] = INIT_HVM_HAP_FEATURES,
deep_features[FEATURESET_NR_ENTRIES] = INIT_DEEP_FEATURES;
- XC_BUILD_BUG_ON(ARRAY_SIZE(known) != FEATURESET_NR_ENTRIES);
- XC_BUILD_BUG_ON(ARRAY_SIZE(special) != FEATURESET_NR_ENTRIES);
- XC_BUILD_BUG_ON(ARRAY_SIZE(pv) != FEATURESET_NR_ENTRIES);
- XC_BUILD_BUG_ON(ARRAY_SIZE(hvm_shadow) != FEATURESET_NR_ENTRIES);
- XC_BUILD_BUG_ON(ARRAY_SIZE(hvm_hap) != FEATURESET_NR_ENTRIES);
- XC_BUILD_BUG_ON(ARRAY_SIZE(deep_features) != FEATURESET_NR_ENTRIES);
+ BUILD_BUG_ON(ARRAY_SIZE(known) != FEATURESET_NR_ENTRIES);
+ BUILD_BUG_ON(ARRAY_SIZE(special) != FEATURESET_NR_ENTRIES);
+ BUILD_BUG_ON(ARRAY_SIZE(pv) != FEATURESET_NR_ENTRIES);
+ BUILD_BUG_ON(ARRAY_SIZE(hvm_shadow) != FEATURESET_NR_ENTRIES);
+ BUILD_BUG_ON(ARRAY_SIZE(hvm_hap) != FEATURESET_NR_ENTRIES);
+ BUILD_BUG_ON(ARRAY_SIZE(deep_features) != FEATURESET_NR_ENTRIES);
switch ( mask )
{
unsigned int start = 0, end = ARRAY_SIZE(deep_deps);
- XC_BUILD_BUG_ON(ARRAY_SIZE(deep_deps) != NR_DEEP_DEPS);
+ BUILD_BUG_ON(ARRAY_SIZE(deep_deps) != NR_DEEP_DEPS);
/* deep_deps[] is sorted. Perform a binary search. */
while ( start < end )
#include <xen/xen.h>
#include <xen/io/protocols.h>
+#include <xen-tools/libs.h>
#include "xg_private.h"
#include "xc_dom.h"
const xen_pfn_t base = GUEST_MAGIC_BASE >> XC_PAGE_SHIFT;
xen_pfn_t p2m[NR_MAGIC_PAGES];
- XC_BUILD_BUG_ON(NR_MAGIC_PAGES > GUEST_MAGIC_SIZE >> XC_PAGE_SHIFT);
+ BUILD_BUG_ON(NR_MAGIC_PAGES > GUEST_MAGIC_SIZE >> XC_PAGE_SHIFT);
DOMPRINTF_CALLED(dom->xch);
#include "xg_private.h"
#include "xc_dom_decompress.h"
+#include <xen-tools/libs.h>
+
#ifndef __MINIOS__
#if defined(HAVE_BZLIB)
* lzo_uint should match size_t. Check that this is the case to be
* sure we won't overflow various lzo_uint fields.
*/
- XC_BUILD_BUG_ON(sizeof(lzo_uint) != sizeof(size_t));
+ BUILD_BUG_ON(sizeof(lzo_uint) != sizeof(size_t));
ret = lzo_init();
if ( ret != LZO_E_OK )
#include <stdbool.h>
#include "xc_private.h"
+#include <xen-tools/libs.h>
+
/*
* Get PM statistic info
*/
sys_para->scaling_governor, CPUFREQ_NAME_LEN);
/* copy to user_para no matter what cpufreq governor */
- XC_BUILD_BUG_ON(sizeof(((struct xc_get_cpufreq_para *)0)->u) !=
- sizeof(((struct xen_get_cpufreq_para *)0)->u));
+ BUILD_BUG_ON(sizeof(((struct xc_get_cpufreq_para *)0)->u) !=
+ sizeof(((struct xen_get_cpufreq_para *)0)->u));
memcpy(&user_para->u, &sys_para->u, sizeof(sys_para->u));
}
#define PAGE_SIZE XC_PAGE_SIZE
#define PAGE_MASK XC_PAGE_MASK
-/* Force a compilation error if condition is true */
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-#define XC_BUILD_BUG_ON(p) ({ _Static_assert(!(p), "!(" #p ")"); })
-#else
-#define XC_BUILD_BUG_ON(p) ((void)sizeof(struct { int:-!!(p); }))
-#endif
-
#ifndef ARRAY_SIZE /* MiniOS leaks ARRAY_SIZE into our namespace as part of a
* stubdom build. It shouldn't... */
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
#include "xc_sr_common.h"
+#include <xen-tools/libs.h>
+
static const char *dhdr_types[] =
{
[DHDR_TYPE_X86_PV] = "x86 PV",
static void __attribute__((unused)) build_assertions(void)
{
- XC_BUILD_BUG_ON(sizeof(struct xc_sr_ihdr) != 24);
- XC_BUILD_BUG_ON(sizeof(struct xc_sr_dhdr) != 16);
- XC_BUILD_BUG_ON(sizeof(struct xc_sr_rhdr) != 8);
-
- XC_BUILD_BUG_ON(sizeof(struct xc_sr_rec_page_data_header) != 8);
- XC_BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_pv_info) != 8);
- XC_BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_pv_p2m_frames) != 8);
- XC_BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_pv_vcpu_hdr) != 8);
- XC_BUILD_BUG_ON(sizeof(struct xc_sr_rec_tsc_info) != 24);
- XC_BUILD_BUG_ON(sizeof(struct xc_sr_rec_hvm_params_entry) != 16);
- XC_BUILD_BUG_ON(sizeof(struct xc_sr_rec_hvm_params) != 8);
+ BUILD_BUG_ON(sizeof(struct xc_sr_ihdr) != 24);
+ BUILD_BUG_ON(sizeof(struct xc_sr_dhdr) != 16);
+ BUILD_BUG_ON(sizeof(struct xc_sr_rhdr) != 8);
+
+ BUILD_BUG_ON(sizeof(struct xc_sr_rec_page_data_header) != 8);
+ BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_pv_info) != 8);
+ BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_pv_p2m_frames) != 8);
+ BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_pv_vcpu_hdr) != 8);
+ BUILD_BUG_ON(sizeof(struct xc_sr_rec_tsc_info) != 24);
+ BUILD_BUG_ON(sizeof(struct xc_sr_rec_hvm_params_entry) != 16);
+ BUILD_BUG_ON(sizeof(struct xc_sr_rec_hvm_params) != 8);
}
/*
int libxl__random_bytes(libxl__gc *gc, uint8_t *buf, size_t len);
-/*
- * Compile time assertion
- */
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-#define BUILD_BUG_ON(p) ({ _Static_assert(!(p), "!(" #p ")"); })
-#else
-#define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)]))
-#endif
#include "_libxl_types_private.h"
#include "_libxl_types_internal_private.h"
#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
+#include <xen-tools/libs.h>
#define IA32_QM_CTR_ERROR_MASK (0x3ul << 62)