diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h
index 6e06ef1..cdcdd07 100644
--- a/tools/libxc/include/xc_dom.h
+++ b/tools/libxc/include/xc_dom.h
@@ -161,12 +161,12 @@ struct xc_dom_image {
     unsigned long flags;
     unsigned int console_evtchn;
     unsigned int xenstore_evtchn;
-    domid_t console_domid;
-    domid_t xenstore_domid;
+    uint32_t console_domid;
+    uint32_t xenstore_domid;
     xen_pfn_t shared_info_mfn;
 
     xc_interface *xch;
-    domid_t guest_domid;
+    uint32_t guest_domid;
     int claim_enabled; /* 0 by default, 1 enables it */
 
     int xen_version;
@@ -318,23 +318,23 @@ int xc_dom_build_image(struct xc_dom_image *dom);
 int xc_dom_update_guest_p2m(struct xc_dom_image *dom);
 
 int xc_dom_boot_xen_init(struct xc_dom_image *dom, xc_interface *xch,
-                     domid_t domid);
+                         uint32_t domid);
 int xc_dom_boot_mem_init(struct xc_dom_image *dom);
 void *xc_dom_boot_domU_map(struct xc_dom_image *dom, xen_pfn_t pfn,
                            xen_pfn_t count);
 int xc_dom_boot_image(struct xc_dom_image *dom);
 int xc_dom_compat_check(struct xc_dom_image *dom);
 int xc_dom_gnttab_init(struct xc_dom_image *dom);
-int xc_dom_gnttab_hvm_seed(xc_interface *xch, domid_t domid,
+int xc_dom_gnttab_hvm_seed(xc_interface *xch, uint32_t domid,
                            xen_pfn_t console_gmfn,
                            xen_pfn_t xenstore_gmfn,
-                           domid_t console_domid,
-                           domid_t xenstore_domid);
-int xc_dom_gnttab_seed(xc_interface *xch, domid_t domid,
+                           uint32_t console_domid,
+                           uint32_t xenstore_domid);
+int xc_dom_gnttab_seed(xc_interface *xch, uint32_t domid,
                        xen_pfn_t console_gmfn,
                        xen_pfn_t xenstore_gmfn,
-                       domid_t console_domid,
-                       domid_t xenstore_domid);
+                       uint32_t console_domid,
+                       uint32_t xenstore_domid);
 bool xc_dom_translated(const struct xc_dom_image *dom);
 
 /* --- debugging bits ---------------------------------------------- */
diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 3bcab3c..666db0b 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -900,8 +900,8 @@ int xc_vcpu_getcontext(xc_interface *xch,
  */
 int xc_dom_vuart_init(xc_interface *xch,
                       uint32_t type,
-                      domid_t domid,
-                      domid_t console_domid,
+                      uint32_t domid,
+                      uint32_t console_domid,
                       xen_pfn_t gfn,
                       evtchn_port_t *evtchn);
 
@@ -930,7 +930,7 @@ int xc_vcpu_getinfo(xc_interface *xch,
                     xc_vcpuinfo_t *info);
 
 long long xc_domain_get_cpu_usage(xc_interface *xch,
-                                  domid_t domid,
+                                  uint32_t domid,
                                   int vcpu);
 
 int xc_domain_sethandle(xc_interface *xch, uint32_t domid,
@@ -1093,7 +1093,7 @@ int xc_domain_set_max_evtchn(xc_interface *xch, uint32_t domid,
  * @param grant_frames max. number of grant frames
  * @param maptrack_frames max. number of maptrack frames
  */
-int xc_domain_set_gnttab_limits(xc_interface *xch, domid_t domid,
+int xc_domain_set_gnttab_limits(xc_interface *xch, uint32_t domid,
                                 uint32_t grant_frames,
                                 uint32_t maptrack_frames);
 
@@ -1370,9 +1370,9 @@ int xc_domain_get_tsc_info(xc_interface *xch,
 
 int xc_domain_disable_migrate(xc_interface *xch, uint32_t domid);
 
-int xc_domain_maximum_gpfn(xc_interface *xch, domid_t domid, xen_pfn_t *gpfns);
+int xc_domain_maximum_gpfn(xc_interface *xch, uint32_t domid, xen_pfn_t *gpfns);
 
-int xc_domain_nr_gpfns(xc_interface *xch, domid_t domid, xen_pfn_t *gpfns);
+int xc_domain_nr_gpfns(xc_interface *xch, uint32_t domid, xen_pfn_t *gpfns);
 
 int xc_domain_increase_reservation(xc_interface *xch,
                                    uint32_t domid,
@@ -1407,8 +1407,8 @@ int xc_domain_add_to_physmap(xc_interface *xch,
                              xen_pfn_t gpfn);
 
 int xc_domain_add_to_physmap_batch(xc_interface *xch,
-                                   domid_t domid,
-                                   domid_t foreign_domid,
+                                   uint32_t domid,
+                                   uint32_t foreign_domid,
                                    unsigned int space,
                                    unsigned int size,
                                    xen_ulong_t *idxs,
@@ -1434,7 +1434,7 @@ int xc_domain_claim_pages(xc_interface *xch,
                                unsigned long nr_pages);
 
 int xc_domain_memory_exchange_pages(xc_interface *xch,
-                                    int domid,
+                                    uint32_t domid,
                                     unsigned long nr_in_extents,
                                     unsigned int in_order,
                                     xen_pfn_t *in_extents,
@@ -1539,7 +1539,7 @@ static inline int xc_clear_domain_page(xc_interface *xch, uint32_t domid,
 }
 
 int xc_mmuext_op(xc_interface *xch, struct mmuext_op *op, unsigned int nr_ops,
-                 domid_t dom);
+                 uint32_t dom);
 
 /* System wide memory properties */
 int xc_maximum_ram_page(xc_interface *xch, unsigned long *max_mfn);
@@ -1625,7 +1625,7 @@ int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
  * (in its doc comment in domctl.h).
  */
 int xc_domain_subscribe_for_suspend(
-    xc_interface *xch, domid_t domid, evtchn_port_t port);
+    xc_interface *xch, uint32_t domid, evtchn_port_t port);
 
 /**************************
  * GRANT TABLE OPERATIONS *
@@ -1641,18 +1641,18 @@ int xc_gnttab_op(xc_interface *xch, int cmd,
 /* Logs iff hypercall bounce fails, otherwise doesn't. */
 
 int xc_gnttab_query_size(xc_interface *xch, struct gnttab_query_size *query);
-int xc_gnttab_get_version(xc_interface *xch, int domid); /* Never logs */
-grant_entry_v1_t *xc_gnttab_map_table_v1(xc_interface *xch, int domid, int *gnt_num);
-grant_entry_v2_t *xc_gnttab_map_table_v2(xc_interface *xch, int domid, int *gnt_num);
+int xc_gnttab_get_version(xc_interface *xch, uint32_t domid); /* Never logs */
+grant_entry_v1_t *xc_gnttab_map_table_v1(xc_interface *xch, uint32_t domid, int *gnt_num);
+grant_entry_v2_t *xc_gnttab_map_table_v2(xc_interface *xch, uint32_t domid, int *gnt_num);
 /* Sometimes these don't set errno [fixme], and sometimes they don't log. */
 
 int xc_physdev_map_pirq(xc_interface *xch,
-                        int domid,
+                        uint32_t domid,
                         int index,
                         int *pirq);
 
 int xc_physdev_map_pirq_msi(xc_interface *xch,
-                            int domid,
+                            uint32_t domid,
                             int index,
                             int *pirq,
                             int devfn,
@@ -1661,7 +1661,7 @@ int xc_physdev_map_pirq_msi(xc_interface *xch,
                             uint64_t table_base);
 
 int xc_physdev_unmap_pirq(xc_interface *xch,
-                          int domid,
+                          uint32_t domid,
                           int pirq);
 
 /*
@@ -1701,12 +1701,12 @@ const xc_error *xc_get_last_error(xc_interface *handle);
  */
 void xc_clear_last_error(xc_interface *xch);
 
-int xc_hvm_param_set(xc_interface *handle, domid_t dom, uint32_t param, uint64_t value);
-int xc_hvm_param_get(xc_interface *handle, domid_t dom, uint32_t param, uint64_t *value);
+int xc_hvm_param_set(xc_interface *handle, uint32_t dom, uint32_t param, uint64_t value);
+int xc_hvm_param_get(xc_interface *handle, uint32_t dom, uint32_t param, uint64_t *value);
 
 /* Deprecated: use xc_hvm_param_set/get() instead. */
-int xc_set_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned long value);
-int xc_get_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned long *value);
+int xc_set_hvm_param(xc_interface *handle, uint32_t dom, int param, unsigned long value);
+int xc_get_hvm_param(xc_interface *handle, uint32_t dom, int param, unsigned long *value);
 
 /* HVM guest pass-through */
 int xc_assign_device(xc_interface *xch,
@@ -1828,12 +1828,12 @@ int xc_domain_debug_control(xc_interface *xch,
 
 #if defined(__i386__) || defined(__x86_64__)
 int xc_cpuid_set(xc_interface *xch,
-                 domid_t domid,
+                 uint32_t domid,
                  const unsigned int *input,
                  const char **config,
                  char **config_transformed);
 int xc_cpuid_apply_policy(xc_interface *xch,
-                          domid_t domid,
+                          uint32_t domid,
                           uint32_t *featureset,
                           unsigned int nr_features);
 void xc_cpuid_to_str(const unsigned int *regs,
@@ -1947,31 +1947,31 @@ int xc_tmem_control(xc_interface *xch,
                     int32_t pool_id, uint32_t subop, uint32_t cli_id,
                     uint32_t len, uint32_t arg, void *buf);
 int xc_tmem_auth(xc_interface *xch, int cli_id, char *uuid_str, int enable);
-int xc_tmem_save(xc_interface *xch, int dom, int live, int fd, int field_marker);
-int xc_tmem_save_extra(xc_interface *xch, int dom, int fd, int field_marker);
-void xc_tmem_save_done(xc_interface *xch, int dom);
-int xc_tmem_restore(xc_interface *xch, int dom, int fd);
-int xc_tmem_restore_extra(xc_interface *xch, int dom, int fd);
+int xc_tmem_save(xc_interface *xch, uint32_t domid, int live, int fd, int field_marker);
+int xc_tmem_save_extra(xc_interface *xch, uint32_t domid, int fd, int field_marker);
+void xc_tmem_save_done(xc_interface *xch, uint32_t domid);
+int xc_tmem_restore(xc_interface *xch, uint32_t domid, int fd);
+int xc_tmem_restore_extra(xc_interface *xch, uint32_t domid, int fd);
 
 /**
  * altp2m operations
  */
 
-int xc_altp2m_get_domain_state(xc_interface *handle, domid_t dom, bool *state);
-int xc_altp2m_set_domain_state(xc_interface *handle, domid_t dom, bool state);
-int xc_altp2m_set_vcpu_enable_notify(xc_interface *handle, domid_t domid,
+int xc_altp2m_get_domain_state(xc_interface *handle, uint32_t dom, bool *state);
+int xc_altp2m_set_domain_state(xc_interface *handle, uint32_t dom, bool state);
+int xc_altp2m_set_vcpu_enable_notify(xc_interface *handle, uint32_t domid,
                                      uint32_t vcpuid, xen_pfn_t gfn);
-int xc_altp2m_create_view(xc_interface *handle, domid_t domid,
+int xc_altp2m_create_view(xc_interface *handle, uint32_t domid,
                           xenmem_access_t default_access, uint16_t *view_id);
-int xc_altp2m_destroy_view(xc_interface *handle, domid_t domid,
+int xc_altp2m_destroy_view(xc_interface *handle, uint32_t domid,
                            uint16_t view_id);
 /* Switch all vCPUs of the domain to the specified altp2m view */
-int xc_altp2m_switch_to_view(xc_interface *handle, domid_t domid,
+int xc_altp2m_switch_to_view(xc_interface *handle, uint32_t domid,
                              uint16_t view_id);
-int xc_altp2m_set_mem_access(xc_interface *handle, domid_t domid,
+int xc_altp2m_set_mem_access(xc_interface *handle, uint32_t domid,
                              uint16_t view_id, xen_pfn_t gfn,
                              xenmem_access_t access);
-int xc_altp2m_change_gfn(xc_interface *handle, domid_t domid,
+int xc_altp2m_change_gfn(xc_interface *handle, uint32_t domid,
                          uint16_t view_id, xen_pfn_t old_gfn,
                          xen_pfn_t new_gfn);
 
@@ -1981,14 +1981,14 @@ int xc_altp2m_change_gfn(xc_interface *handle, domid_t domid,
  * Hardware-Assisted Paging (i.e. Intel EPT, AMD NPT). Moreover, AMD NPT
  * support is considered experimental.
  */
-int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id, uint32_t *port);
-int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id);
-int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id);
-int xc_mem_paging_nominate(xc_interface *xch, domid_t domain_id,
+int xc_mem_paging_enable(xc_interface *xch, uint32_t domain_id, uint32_t *port);
+int xc_mem_paging_disable(xc_interface *xch, uint32_t domain_id);
+int xc_mem_paging_resume(xc_interface *xch, uint32_t domain_id);
+int xc_mem_paging_nominate(xc_interface *xch, uint32_t domain_id,
                            uint64_t gfn);
-int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, uint64_t gfn);
-int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, uint64_t gfn);
-int xc_mem_paging_load(xc_interface *xch, domid_t domain_id,
+int xc_mem_paging_evict(xc_interface *xch, uint32_t domain_id, uint64_t gfn);
+int xc_mem_paging_prep(xc_interface *xch, uint32_t domain_id, uint64_t gfn);
+int xc_mem_paging_load(xc_interface *xch, uint32_t domain_id,
                        uint64_t gfn, void *buffer);
 
 /** 
@@ -2001,7 +2001,7 @@ int xc_mem_paging_load(xc_interface *xch, domid_t domain_id,
  * Allowed types are XENMEM_access_default, XENMEM_access_n, any combination of
  * XENMEM_access_ + (rwx), and XENMEM_access_rx2rw
  */
-int xc_set_mem_access(xc_interface *xch, domid_t domain_id,
+int xc_set_mem_access(xc_interface *xch, uint32_t domain_id,
                       xenmem_access_t access, uint64_t first_pfn,
                       uint32_t nr);
 
@@ -2010,14 +2010,14 @@ int xc_set_mem_access(xc_interface *xch, domid_t domain_id,
  * The nr parameter specifies the size of the pages and access arrays.
  * The same allowed access types as for xc_set_mem_access() apply.
  */
-int xc_set_mem_access_multi(xc_interface *xch, domid_t domain_id,
+int xc_set_mem_access_multi(xc_interface *xch, uint32_t domain_id,
                             uint8_t *access, uint64_t *pages,
                             uint32_t nr);
 
 /*
  * Gets the mem access for the given page (returned in access on success)
  */
-int xc_get_mem_access(xc_interface *xch, domid_t domain_id,
+int xc_get_mem_access(xc_interface *xch, uint32_t domain_id,
                       uint64_t pfn, xenmem_access_t *access);
 
 /***
@@ -2030,16 +2030,16 @@ int xc_get_mem_access(xc_interface *xch, domid_t domain_id,
  * Will return NULL on error.
  * Caller has to unmap this page when done.
  */
-void *xc_monitor_enable(xc_interface *xch, domid_t domain_id, uint32_t *port);
-int xc_monitor_disable(xc_interface *xch, domid_t domain_id);
-int xc_monitor_resume(xc_interface *xch, domid_t domain_id);
+void *xc_monitor_enable(xc_interface *xch, uint32_t domain_id, uint32_t *port);
+int xc_monitor_disable(xc_interface *xch, uint32_t domain_id);
+int xc_monitor_resume(xc_interface *xch, uint32_t domain_id);
 /*
  * Get a bitmap of supported monitor events in the form
  * (1 << XEN_DOMCTL_MONITOR_EVENT_*).
  */
-int xc_monitor_get_capabilities(xc_interface *xch, domid_t domain_id,
+int xc_monitor_get_capabilities(xc_interface *xch, uint32_t domain_id,
                                 uint32_t *capabilities);
-int xc_monitor_write_ctrlreg(xc_interface *xch, domid_t domain_id,
+int xc_monitor_write_ctrlreg(xc_interface *xch, uint32_t domain_id,
                              uint16_t index, bool enable, bool sync,
                              uint64_t bitmask, bool onchangeonly);
 /*
@@ -2047,21 +2047,21 @@ int xc_monitor_write_ctrlreg(xc_interface *xch, domid_t domain_id,
  * Please consult the Intel/AMD manuals for more information on
  * non-architectural indices.
  */
-int xc_monitor_mov_to_msr(xc_interface *xch, domid_t domain_id, uint32_t msr,
+int xc_monitor_mov_to_msr(xc_interface *xch, uint32_t domain_id, uint32_t msr,
                           bool enable);
-int xc_monitor_singlestep(xc_interface *xch, domid_t domain_id, bool enable);
-int xc_monitor_software_breakpoint(xc_interface *xch, domid_t domain_id,
+int xc_monitor_singlestep(xc_interface *xch, uint32_t domain_id, bool enable);
+int xc_monitor_software_breakpoint(xc_interface *xch, uint32_t domain_id,
                                    bool enable);
-int xc_monitor_descriptor_access(xc_interface *xch, domid_t domain_id,
+int xc_monitor_descriptor_access(xc_interface *xch, uint32_t domain_id,
                                  bool enable);
-int xc_monitor_guest_request(xc_interface *xch, domid_t domain_id,
+int xc_monitor_guest_request(xc_interface *xch, uint32_t domain_id,
                              bool enable, bool sync, bool allow_userspace);
-int xc_monitor_debug_exceptions(xc_interface *xch, domid_t domain_id,
+int xc_monitor_debug_exceptions(xc_interface *xch, uint32_t domain_id,
                                 bool enable, bool sync);
-int xc_monitor_cpuid(xc_interface *xch, domid_t domain_id, bool enable);
-int xc_monitor_privileged_call(xc_interface *xch, domid_t domain_id,
+int xc_monitor_cpuid(xc_interface *xch, uint32_t domain_id, bool enable);
+int xc_monitor_privileged_call(xc_interface *xch, uint32_t domain_id,
                                bool enable);
-int xc_monitor_emul_unimplemented(xc_interface *xch, domid_t domain_id,
+int xc_monitor_emul_unimplemented(xc_interface *xch, uint32_t domain_id,
                                   bool enable);
 /**
  * This function enables / disables emulation for each REP for a
@@ -2072,7 +2072,7 @@ int xc_monitor_emul_unimplemented(xc_interface *xch, domid_t domain_id,
  * @parm enable if 0 optimize when possible, else emulate each REP.
  * @return 0 on success, -1 on failure.
  */
-int xc_monitor_emulate_each_rep(xc_interface *xch, domid_t domain_id,
+int xc_monitor_emulate_each_rep(xc_interface *xch, uint32_t domain_id,
                                 bool enable);
 
 /***
@@ -2099,7 +2099,7 @@ int xc_monitor_emulate_each_rep(xc_interface *xch, domid_t domain_id,
  * When sharing for a domain is turned off, the domain may still reference
  * shared pages. Unsharing happens lazily. */
 int xc_memshr_control(xc_interface *xch,
-                      domid_t domid,
+                      uint32_t domid,
                       int enable);
 
 /* Create a communication ring in which the hypervisor will place ENOMEM
@@ -2131,13 +2131,13 @@ int xc_memshr_control(xc_interface *xch,
  */
 
 int xc_memshr_ring_enable(xc_interface *xch, 
-                          domid_t domid, 
+                          uint32_t domid,
                           uint32_t *port);
 /* Disable the ring for ENOMEM communication.
  * May fail with EINVAL if the ring was not enabled in the first place.
  */
 int xc_memshr_ring_disable(xc_interface *xch, 
-                           domid_t domid);
+                           uint32_t domid);
 
 /*
  * Calls below return EINVAL if sharing has not been enabled for the domain
@@ -2147,7 +2147,7 @@ int xc_memshr_ring_disable(xc_interface *xch,
  * notify the hypervisor to re-schedule the faulting vcpu of the domain with an
  * event channel kick and/or this call. */
 int xc_memshr_domain_resume(xc_interface *xch,
-                            domid_t domid);
+                            uint32_t domid);
 
 /* Select a page for sharing. 
  *
@@ -2163,7 +2163,7 @@ int xc_memshr_domain_resume(xc_interface *xch,
  *  ENOENT or EEXIST if there are internal hypervisor errors.
  */
 int xc_memshr_nominate_gfn(xc_interface *xch,
-                           domid_t domid,
+                           uint32_t domid,
                            unsigned long gfn,
                            uint64_t *handle);
 /* Same as above, but instead of a guest frame number, the input is a grant
@@ -2172,7 +2172,7 @@ int xc_memshr_nominate_gfn(xc_interface *xch,
  * May fail with EINVAL if the grant reference is invalid.
  */
 int xc_memshr_nominate_gref(xc_interface *xch,
-                            domid_t domid,
+                            uint32_t domid,
                             grant_ref_t gref,
                             uint64_t *handle);
 
@@ -2194,10 +2194,10 @@ int xc_memshr_nominate_gref(xc_interface *xch,
  * source. Either 3-tuple can be specified later for further re-sharing. 
  */
 int xc_memshr_share_gfns(xc_interface *xch,
-                    domid_t source_domain,
+                    uint32_t source_domain,
                     unsigned long source_gfn,
                     uint64_t source_handle,
-                    domid_t client_domain,
+                    uint32_t client_domain,
                     unsigned long client_gfn,
                     uint64_t client_handle);
 
@@ -2206,10 +2206,10 @@ int xc_memshr_share_gfns(xc_interface *xch,
  * May fail with EINVAL if either grant reference is invalid.
  */
 int xc_memshr_share_grefs(xc_interface *xch,
-                    domid_t source_domain,
+                    uint32_t source_domain,
                     grant_ref_t source_gref,
                     uint64_t source_handle,
-                    domid_t client_domain,
+                    uint32_t client_domain,
                     grant_ref_t client_gref,
                     uint64_t client_handle);
 
@@ -2223,10 +2223,10 @@ int xc_memshr_share_grefs(xc_interface *xch,
  *  ENOENT if there is an internal hypervisor error.
  */
 int xc_memshr_add_to_physmap(xc_interface *xch,
-                    domid_t source_domain,
+                    uint32_t source_domain,
                     unsigned long source_gfn,
                     uint64_t source_handle,
-                    domid_t client_domain,
+                    uint32_t client_domain,
                     unsigned long client_gfn);
 
 /* Allows to deduplicate a range of memory of a client domain. Using
@@ -2239,8 +2239,8 @@ int xc_memshr_add_to_physmap(xc_interface *xch,
  * the sharing metadata before deduplication can happen.
  */
 int xc_memshr_range_share(xc_interface *xch,
-                          domid_t source_domain,
-                          domid_t client_domain,
+                          uint32_t source_domain,
+                          uint32_t client_domain,
                           uint64_t first_gfn,
                           uint64_t last_gfn);
 
@@ -2251,11 +2251,11 @@ int xc_memshr_range_share(xc_interface *xch,
  * argument.
  */
 int xc_memshr_debug_gfn(xc_interface *xch,
-                        domid_t domid,
+                        uint32_t domid,
                         unsigned long gfn);
 /* May additionally fail with EINVAL if the grant reference is invalid. */
 int xc_memshr_debug_gref(xc_interface *xch,
-                         domid_t domid,
+                         uint32_t domid,
                          grant_ref_t gref);
 
 /* Audits the share subsystem. 
@@ -2331,7 +2331,7 @@ int xc_flask_policyvers(xc_interface *xc_handle);
 int xc_flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size);
 int xc_flask_getavc_threshold(xc_interface *xc_handle);
 int xc_flask_setavc_threshold(xc_interface *xc_handle, int threshold);
-int xc_flask_relabel_domain(xc_interface *xch, int domid, uint32_t sid);
+int xc_flask_relabel_domain(xc_interface *xch, uint32_t domid, uint32_t sid);
 
 struct elf_binary;
 void xc_elf_set_logfile(xc_interface *xch, struct elf_binary *elf,
diff --git a/tools/libxc/include/xenctrl_compat.h b/tools/libxc/include/xenctrl_compat.h
index 040e7b2..a655e47 100644
--- a/tools/libxc/include/xenctrl_compat.h
+++ b/tools/libxc/include/xenctrl_compat.h
@@ -59,9 +59,9 @@ int xc_evtchn_close(xc_evtchn *xce);
 int xc_evtchn_fd(xc_evtchn *xce);
 int xc_evtchn_notify(xc_evtchn *xce, evtchn_port_t port);
 xc_evtchn_port_or_error_t
-xc_evtchn_bind_unbound_port(xc_evtchn *xce, int domid);
+xc_evtchn_bind_unbound_port(xc_evtchn *xce, uint32_t domid);
 xc_evtchn_port_or_error_t
-xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
+xc_evtchn_bind_interdomain(xc_evtchn *xce, uint32_t domid,
                            evtchn_port_t remote_port);
 xc_evtchn_port_or_error_t
 xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq);
@@ -123,46 +123,46 @@ int xc_gntshr_munmap(xc_gntshr *xcg, void *start_address, uint32_t count);
 #ifdef XC_WANT_COMPAT_DEVICEMODEL_API
 
 int xc_hvm_create_ioreq_server(
-    xc_interface *xch, domid_t domid, int handle_bufioreq,
+    xc_interface *xch, uint32_t domid, int handle_bufioreq,
     ioservid_t *id);
 int xc_hvm_get_ioreq_server_info(
-    xc_interface *xch, domid_t domid, ioservid_t id, xen_pfn_t *ioreq_pfn,
+    xc_interface *xch, uint32_t domid, ioservid_t id, xen_pfn_t *ioreq_pfn,
     xen_pfn_t *bufioreq_pfn, evtchn_port_t *bufioreq_port);
 int xc_hvm_map_io_range_to_ioreq_server(
-    xc_interface *xch, domid_t domid, ioservid_t id, int is_mmio,
+    xc_interface *xch, uint32_t domid, ioservid_t id, int is_mmio,
     uint64_t start, uint64_t end);
 int xc_hvm_unmap_io_range_from_ioreq_server(
-    xc_interface *xch, domid_t domid, ioservid_t id, int is_mmio,
+    xc_interface *xch, uint32_t domid, ioservid_t id, int is_mmio,
     uint64_t start, uint64_t end);
 int xc_hvm_map_pcidev_to_ioreq_server(
-    xc_interface *xch, domid_t domid, ioservid_t id, uint16_t segment,
+    xc_interface *xch, uint32_t domid, ioservid_t id, uint16_t segment,
     uint8_t bus, uint8_t device, uint8_t function);
 int xc_hvm_unmap_pcidev_from_ioreq_server(
-    xc_interface *xch, domid_t domid, ioservid_t id, uint16_t segment,
+    xc_interface *xch, uint32_t domid, ioservid_t id, uint16_t segment,
     uint8_t bus, uint8_t device, uint8_t function);
 int xc_hvm_destroy_ioreq_server(
-    xc_interface *xch, domid_t domid, ioservid_t id);
+    xc_interface *xch, uint32_t domid, ioservid_t id);
 int xc_hvm_set_ioreq_server_state(
-    xc_interface *xch, domid_t domid, ioservid_t id, int enabled);
+    xc_interface *xch, uint32_t domid, ioservid_t id, int enabled);
 int xc_hvm_set_pci_intx_level(
-    xc_interface *xch, domid_t domid, uint16_t segment, uint8_t bus,
+    xc_interface *xch, uint32_t domid, uint16_t segment, uint8_t bus,
     uint8_t device, uint8_t intx, unsigned int level);
 int xc_hvm_set_isa_irq_level(
-    xc_interface *xch, domid_t domid, uint8_t irq, unsigned int level);
+    xc_interface *xch, uint32_t domid, uint8_t irq, unsigned int level);
 int xc_hvm_set_pci_link_route(
-    xc_interface *xch, domid_t domid, uint8_t link, uint8_t irq);
+    xc_interface *xch, uint32_t domid, uint8_t link, uint8_t irq);
 int xc_hvm_inject_msi(
-    xc_interface *xch, domid_t domid, uint64_t msi_addr, uint32_t msi_data);
+    xc_interface *xch, uint32_t domid, uint64_t msi_addr, uint32_t msi_data);
 int xc_hvm_track_dirty_vram(
-    xc_interface *xch, domid_t domid, uint64_t first_pfn, uint32_t nr,
+    xc_interface *xch, uint32_t domid, uint64_t first_pfn, uint32_t nr,
     unsigned long *dirty_bitmap);
 int xc_hvm_modified_memory(
-    xc_interface *xch, domid_t domid, uint64_t first_pfn, uint32_t nr);
+    xc_interface *xch, uint32_t domid, uint64_t first_pfn, uint32_t nr);
 int xc_hvm_set_mem_type(
-    xc_interface *xch, domid_t domid, hvmmem_type_t type,
+    xc_interface *xch, uint32_t domid, hvmmem_type_t type,
     uint64_t first_pfn, uint32_t nr);
 int xc_hvm_inject_trap(
-    xc_interface *xch, domid_t domid, int vcpu, uint8_t vector,
+    xc_interface *xch, uint32_t domid, int vcpu, uint8_t vector,
     uint8_t type, uint32_t error_code, uint8_t insn_len, uint64_t cr2);
 
 #endif /* XC_WANT_COMPAT_DEVICEMODEL_API */
diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h
index de97f1b..b4b2e19 100644
--- a/tools/libxc/include/xenguest.h
+++ b/tools/libxc/include/xenguest.h
@@ -109,7 +109,7 @@ struct save_callbacks {
     int (*wait_checkpoint)(void* data);
 
     /* Enable qemu-dm logging dirty pages to xen */
-    int (*switch_qemu_logdirty)(int domid, unsigned enable, void *data); /* HVM only */
+    int (*switch_qemu_logdirty)(uint32_t domid, unsigned enable, void *data); /* HVM only */
 
     /* to be provided as the last argument to each callback function */
     void* data;
@@ -195,8 +195,8 @@ struct restore_callbacks {
  */
 int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
                       unsigned int store_evtchn, unsigned long *store_mfn,
-                      domid_t store_domid, unsigned int console_evtchn,
-                      unsigned long *console_mfn, domid_t console_domid,
+                      uint32_t store_domid, unsigned int console_evtchn,
+                      unsigned long *console_mfn, uint32_t console_domid,
                       unsigned int hvm, unsigned int pae,
                       xc_migration_stream_t stream_type,
                       struct restore_callbacks *callbacks, int send_back_fd);
@@ -243,7 +243,7 @@ struct xc_hvm_firmware_module {
  */
 int xc_suspend_evtchn_release(xc_interface *xch,
                               struct xenevtchn_handle *xce,
-                              int domid, int suspend_evtchn, int *lockfd);
+                              uint32_t domid, int suspend_evtchn, int *lockfd);
 
 /**
  * This function eats the initial notification.
@@ -252,7 +252,7 @@ int xc_suspend_evtchn_release(xc_interface *xch,
  */
 int xc_suspend_evtchn_init_exclusive(xc_interface *xch,
                                      struct xenevtchn_handle *xce,
-                                     int domid, int port, int *lockfd);
+                                     uint32_t domid, int port, int *lockfd);
 
 /* xce must not be used for anything else */
 int xc_await_suspend(xc_interface *xch, struct xenevtchn_handle *xce,
@@ -267,7 +267,7 @@ int xc_await_suspend(xc_interface *xch, struct xenevtchn_handle *xce,
  */
 int xc_suspend_evtchn_init_sane(xc_interface *xch,
                                 struct xenevtchn_handle *xce,
-                                int domid, int port, int *lockfd);
+                                uint32_t domid, int port, int *lockfd);
 
 int xc_mark_page_online(xc_interface *xch, unsigned long start,
                         unsigned long end, uint32_t *status);
@@ -278,7 +278,7 @@ int xc_mark_page_offline(xc_interface *xch, unsigned long start,
 int xc_query_page_offline_status(xc_interface *xch, unsigned long start,
                                  unsigned long end, uint32_t *status);
 
-int xc_exchange_page(xc_interface *xch, int domid, xen_pfn_t mfn);
+int xc_exchange_page(xc_interface *xch, uint32_t domid, xen_pfn_t mfn);
 
 
 /**
@@ -293,7 +293,7 @@ struct xc_domain_meminfo {
     unsigned long p2m_size;
 };
 
-int xc_map_domain_meminfo(xc_interface *xch, int domid,
+int xc_map_domain_meminfo(xc_interface *xch, uint32_t domid,
                           struct xc_domain_meminfo *minfo);
 
 int xc_unmap_domain_meminfo(xc_interface *xch, struct xc_domain_meminfo *mem);
diff --git a/tools/libxc/xc_altp2m.c b/tools/libxc/xc_altp2m.c
index 0639632..07fcd18 100644
--- a/tools/libxc/xc_altp2m.c
+++ b/tools/libxc/xc_altp2m.c
@@ -24,7 +24,7 @@
 #include <stdbool.h>
 #include <xen/hvm/hvm_op.h>
 
-int xc_altp2m_get_domain_state(xc_interface *handle, domid_t dom, bool *state)
+int xc_altp2m_get_domain_state(xc_interface *handle, uint32_t dom, bool *state)
 {
     int rc;
     DECLARE_HYPERCALL_BUFFER(xen_hvm_altp2m_op_t, arg);
@@ -47,7 +47,7 @@ int xc_altp2m_get_domain_state(xc_interface *handle, domid_t dom, bool *state)
     return rc;
 }
 
-int xc_altp2m_set_domain_state(xc_interface *handle, domid_t dom, bool state)
+int xc_altp2m_set_domain_state(xc_interface *handle, uint32_t dom, bool state)
 {
     int rc;
     DECLARE_HYPERCALL_BUFFER(xen_hvm_altp2m_op_t, arg);
@@ -69,7 +69,7 @@ int xc_altp2m_set_domain_state(xc_interface *handle, domid_t dom, bool state)
 }
 
 /* This is a bit odd to me that it acts on current.. */
-int xc_altp2m_set_vcpu_enable_notify(xc_interface *handle, domid_t domid,
+int xc_altp2m_set_vcpu_enable_notify(xc_interface *handle, uint32_t domid,
                                      uint32_t vcpuid, xen_pfn_t gfn)
 {
     int rc;
@@ -92,7 +92,7 @@ int xc_altp2m_set_vcpu_enable_notify(xc_interface *handle, domid_t domid,
     return rc;
 }
 
-int xc_altp2m_create_view(xc_interface *handle, domid_t domid,
+int xc_altp2m_create_view(xc_interface *handle, uint32_t domid,
                           xenmem_access_t default_access, uint16_t *view_id)
 {
     int rc;
@@ -118,7 +118,7 @@ int xc_altp2m_create_view(xc_interface *handle, domid_t domid,
     return rc;
 }
 
-int xc_altp2m_destroy_view(xc_interface *handle, domid_t domid,
+int xc_altp2m_destroy_view(xc_interface *handle, uint32_t domid,
                            uint16_t view_id)
 {
     int rc;
@@ -141,7 +141,7 @@ int xc_altp2m_destroy_view(xc_interface *handle, domid_t domid,
 }
 
 /* Switch all vCPUs of the domain to the specified altp2m view */
-int xc_altp2m_switch_to_view(xc_interface *handle, domid_t domid,
+int xc_altp2m_switch_to_view(xc_interface *handle, uint32_t domid,
                              uint16_t view_id)
 {
     int rc;
@@ -163,7 +163,7 @@ int xc_altp2m_switch_to_view(xc_interface *handle, domid_t domid,
     return rc;
 }
 
-int xc_altp2m_set_mem_access(xc_interface *handle, domid_t domid,
+int xc_altp2m_set_mem_access(xc_interface *handle, uint32_t domid,
                              uint16_t view_id, xen_pfn_t gfn,
                              xenmem_access_t access)
 {
@@ -188,7 +188,7 @@ int xc_altp2m_set_mem_access(xc_interface *handle, domid_t domid,
     return rc;
 }
 
-int xc_altp2m_change_gfn(xc_interface *handle, domid_t domid,
+int xc_altp2m_change_gfn(xc_interface *handle, uint32_t domid,
                          uint16_t view_id, xen_pfn_t old_gfn,
                          xen_pfn_t new_gfn)
 {
diff --git a/tools/libxc/xc_core.h b/tools/libxc/xc_core.h
index ffbe490..ed7ed53 100644
--- a/tools/libxc/xc_core.h
+++ b/tools/libxc/xc_core.h
@@ -147,7 +147,7 @@ int xc_core_arch_map_p2m_writable(xc_interface *xch, unsigned int guest_width,
                                   shared_info_any_t *live_shinfo,
                                   xen_pfn_t **live_p2m, unsigned long *pfnp);
 
-int xc_core_arch_get_scratch_gpfn(xc_interface *xch, domid_t domid,
+int xc_core_arch_get_scratch_gpfn(xc_interface *xch, uint32_t domid,
                                   xen_pfn_t *gpfn);
 
 
diff --git a/tools/libxc/xc_core_arm.c b/tools/libxc/xc_core_arm.c
index 362c1a7..c3c492c 100644
--- a/tools/libxc/xc_core_arm.c
+++ b/tools/libxc/xc_core_arm.c
@@ -96,7 +96,7 @@ xc_core_arch_map_p2m_writable(xc_interface *xch, unsigned int guest_width, xc_do
 }
 
 int
-xc_core_arch_get_scratch_gpfn(xc_interface *xch, domid_t domid,
+xc_core_arch_get_scratch_gpfn(xc_interface *xch, uint32_t domid,
                               xen_pfn_t *gpfn)
 {
     /*
diff --git a/tools/libxc/xc_core_x86.c b/tools/libxc/xc_core_x86.c
index 679e753..54852a2 100644
--- a/tools/libxc/xc_core_x86.c
+++ b/tools/libxc/xc_core_x86.c
@@ -208,7 +208,7 @@ xc_core_arch_map_p2m_writable(xc_interface *xch, unsigned int guest_width, xc_do
 }
 
 int
-xc_core_arch_get_scratch_gpfn(xc_interface *xch, domid_t domid,
+xc_core_arch_get_scratch_gpfn(xc_interface *xch, uint32_t domid,
                               xen_pfn_t *gpfn)
 {
     return xc_domain_nr_gpfns(xch, domid, gpfn);
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index d890935..25b922e 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -202,7 +202,7 @@ static void cpuid(const unsigned int *input, unsigned int *regs)
 #endif
 }
 
-static int get_cpuid_domain_info(xc_interface *xch, domid_t domid,
+static int get_cpuid_domain_info(xc_interface *xch, uint32_t domid,
                                  struct cpuid_domain_info *info,
                                  uint32_t *featureset,
                                  unsigned int nr_features)
@@ -608,7 +608,7 @@ static int xc_cpuid_policy(xc_interface *xch,
 }
 
 static int xc_cpuid_do_domctl(
-    xc_interface *xch, domid_t domid,
+    xc_interface *xch, uint32_t domid,
     const unsigned int *input, const unsigned int *regs)
 {
     DECLARE_DOMCTL;
@@ -709,7 +709,7 @@ static void sanitise_featureset(struct cpuid_domain_info *info)
     }
 }
 
-int xc_cpuid_apply_policy(xc_interface *xch, domid_t domid,
+int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,
                           uint32_t *featureset,
                           unsigned int nr_features)
 {
@@ -796,7 +796,7 @@ int xc_cpuid_apply_policy(xc_interface *xch, domid_t domid,
  * For 's' and 'x' the configuration is overwritten with the value applied.
  */
 int xc_cpuid_set(
-    xc_interface *xch, domid_t domid, const unsigned int *input,
+    xc_interface *xch, uint32_t domid, const unsigned int *input,
     const char **config, char **config_transformed)
 {
     int rc;
diff --git a/tools/libxc/xc_csched.c b/tools/libxc/xc_csched.c
index 139fc16..8e8c672 100644
--- a/tools/libxc/xc_csched.c
+++ b/tools/libxc/xc_csched.c
@@ -32,7 +32,7 @@ xc_sched_credit_domain_set(
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_scheduler_op;
-    domctl.domain = (domid_t) domid;
+    domctl.domain = domid;
     domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
     domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
     domctl.u.scheduler_op.u.credit = *sdom;
@@ -52,7 +52,7 @@ xc_sched_credit_domain_get(
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_scheduler_op;
-    domctl.domain = (domid_t) domid;
+    domctl.domain = domid;
     domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
     domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getinfo;
 
diff --git a/tools/libxc/xc_csched2.c b/tools/libxc/xc_csched2.c
index 12c95e6..5eb753a 100644
--- a/tools/libxc/xc_csched2.c
+++ b/tools/libxc/xc_csched2.c
@@ -32,7 +32,7 @@ xc_sched_credit2_domain_set(
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_scheduler_op;
-    domctl.domain = (domid_t) domid;
+    domctl.domain = domid;
     domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT2;
     domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
     domctl.u.scheduler_op.u.credit2 = *sdom;
@@ -52,7 +52,7 @@ xc_sched_credit2_domain_get(
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_scheduler_op;
-    domctl.domain = (domid_t) domid;
+    domctl.domain = domid;
     domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT2;
     domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getinfo;
 
diff --git a/tools/libxc/xc_devicemodel_compat.c b/tools/libxc/xc_devicemodel_compat.c
index e4edeea..dbd1785 100644
--- a/tools/libxc/xc_devicemodel_compat.c
+++ b/tools/libxc/xc_devicemodel_compat.c
@@ -7,7 +7,7 @@
 #include "xc_private.h"
 
 int xc_hvm_create_ioreq_server(
-    xc_interface *xch, domid_t domid, int handle_bufioreq,
+    xc_interface *xch, uint32_t domid, int handle_bufioreq,
     ioservid_t *id)
 {
     return xendevicemodel_create_ioreq_server(xch->dmod, domid,
@@ -15,7 +15,7 @@ int xc_hvm_create_ioreq_server(
 }
 
 int xc_hvm_get_ioreq_server_info(
-    xc_interface *xch, domid_t domid, ioservid_t id, xen_pfn_t *ioreq_pfn,
+    xc_interface *xch, uint32_t domid, ioservid_t id, xen_pfn_t *ioreq_pfn,
     xen_pfn_t *bufioreq_pfn, evtchn_port_t *bufioreq_port)
 {
     return xendevicemodel_get_ioreq_server_info(xch->dmod, domid, id,
@@ -24,7 +24,7 @@ int xc_hvm_get_ioreq_server_info(
 }
 
 int xc_hvm_map_io_range_to_ioreq_server(
-    xc_interface *xch, domid_t domid, ioservid_t id, int is_mmio,
+    xc_interface *xch, uint32_t domid, ioservid_t id, int is_mmio,
     uint64_t start, uint64_t end)
 {
     return xendevicemodel_map_io_range_to_ioreq_server(xch->dmod, domid,
@@ -33,7 +33,7 @@ int xc_hvm_map_io_range_to_ioreq_server(
 }
 
 int xc_hvm_unmap_io_range_from_ioreq_server(
-    xc_interface *xch, domid_t domid, ioservid_t id, int is_mmio,
+    xc_interface *xch, uint32_t domid, ioservid_t id, int is_mmio,
     uint64_t start, uint64_t end)
 {
     return xendevicemodel_unmap_io_range_from_ioreq_server(xch->dmod, domid,
@@ -42,7 +42,7 @@ int xc_hvm_unmap_io_range_from_ioreq_server(
 }
 
 int xc_hvm_map_pcidev_to_ioreq_server(
-    xc_interface *xch, domid_t domid, ioservid_t id, uint16_t segment,
+    xc_interface *xch, uint32_t domid, ioservid_t id, uint16_t segment,
     uint8_t bus, uint8_t device, uint8_t function)
 {
     return xendevicemodel_map_pcidev_to_ioreq_server(xch->dmod, domid, id,
@@ -51,7 +51,7 @@ int xc_hvm_map_pcidev_to_ioreq_server(
 }
 
 int xc_hvm_unmap_pcidev_from_ioreq_server(
-    xc_interface *xch, domid_t domid, ioservid_t id, uint16_t segment,
+    xc_interface *xch, uint32_t domid, ioservid_t id, uint16_t segment,
     uint8_t bus, uint8_t device, uint8_t function)
 {
     return xendevicemodel_unmap_pcidev_from_ioreq_server(xch->dmod, domid,
@@ -60,20 +60,20 @@ int xc_hvm_unmap_pcidev_from_ioreq_server(
 }
 
 int xc_hvm_destroy_ioreq_server(
-    xc_interface *xch, domid_t domid, ioservid_t id)
+    xc_interface *xch, uint32_t domid, ioservid_t id)
 {
     return xendevicemodel_destroy_ioreq_server(xch->dmod, domid, id);
 }
 
 int xc_hvm_set_ioreq_server_state(
-    xc_interface *xch, domid_t domid, ioservid_t id, int enabled)
+    xc_interface *xch, uint32_t domid, ioservid_t id, int enabled)
 {
     return xendevicemodel_set_ioreq_server_state(xch->dmod, domid, id,
                                                  enabled);
 }
 
 int xc_hvm_set_pci_intx_level(
-    xc_interface *xch, domid_t domid, uint16_t segment, uint8_t bus,
+    xc_interface *xch, uint32_t domid, uint16_t segment, uint8_t bus,
     uint8_t device, uint8_t intx, unsigned int level)
 {
     return xendevicemodel_set_pci_intx_level(xch->dmod, domid, segment,
@@ -81,25 +81,25 @@ int xc_hvm_set_pci_intx_level(
 }
 
 int xc_hvm_set_isa_irq_level(
-    xc_interface *xch, domid_t domid, uint8_t irq, unsigned int level)
+    xc_interface *xch, uint32_t domid, uint8_t irq, unsigned int level)
 {
     return xendevicemodel_set_isa_irq_level(xch->dmod, domid, irq, level);
 }
 
 int xc_hvm_set_pci_link_route(
-    xc_interface *xch, domid_t domid, uint8_t link, uint8_t irq)
+    xc_interface *xch, uint32_t domid, uint8_t link, uint8_t irq)
 {
     return xendevicemodel_set_pci_link_route(xch->dmod, domid, link, irq);
 }
 
 int xc_hvm_inject_msi(
-    xc_interface *xch, domid_t domid, uint64_t msi_addr, uint32_t msi_data)
+    xc_interface *xch, uint32_t domid, uint64_t msi_addr, uint32_t msi_data)
 {
     return xendevicemodel_inject_msi(xch->dmod, domid, msi_addr, msi_data);
 }
 
 int xc_hvm_track_dirty_vram(
-    xc_interface *xch, domid_t domid, uint64_t first_pfn, uint32_t nr,
+    xc_interface *xch, uint32_t domid, uint64_t first_pfn, uint32_t nr,
     unsigned long *dirty_bitmap)
 {
     return xendevicemodel_track_dirty_vram(xch->dmod, domid, first_pfn,
@@ -107,13 +107,13 @@ int xc_hvm_track_dirty_vram(
 }
 
 int xc_hvm_modified_memory(
-    xc_interface *xch, domid_t domid, uint64_t first_pfn, uint32_t nr)
+    xc_interface *xch, uint32_t domid, uint64_t first_pfn, uint32_t nr)
 {
     return xendevicemodel_modified_memory(xch->dmod, domid, first_pfn, nr);
 }
 
 int xc_hvm_set_mem_type(
-    xc_interface *xch, domid_t domid, hvmmem_type_t type,
+    xc_interface *xch, uint32_t domid, hvmmem_type_t type,
     uint64_t first_pfn, uint32_t nr)
 {
     return xendevicemodel_set_mem_type(xch->dmod, domid, type, first_pfn,
@@ -121,7 +121,7 @@ int xc_hvm_set_mem_type(
 }
 
 int xc_hvm_inject_trap(
-    xc_interface *xch, domid_t domid, int vcpu, uint8_t vector,
+    xc_interface *xch, uint32_t domid, int vcpu, uint8_t vector,
     uint8_t type, uint32_t error_code, uint8_t insn_len, uint64_t cr2)
 {
     return xendevicemodel_inject_event(xch->dmod, domid, vcpu, vector,
diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index 98200ae..7c4997a 100644
--- a/tools/libxc/xc_dom_arm.c
+++ b/tools/libxc/xc_dom_arm.c
@@ -212,7 +212,7 @@ static int vcpu_arm64(struct xc_dom_image *dom)
 
 /* ------------------------------------------------------------------------ */
 
-static int set_mode(xc_interface *xch, domid_t domid, char *guest_type)
+static int set_mode(xc_interface *xch, uint32_t domid, char *guest_type)
 {
     static const struct {
         char           *guest;
diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c
index 8a376d0..40eb518 100644
--- a/tools/libxc/xc_dom_boot.c
+++ b/tools/libxc/xc_dom_boot.c
@@ -110,7 +110,7 @@ int xc_dom_compat_check(struct xc_dom_image *dom)
     return found;
 }
 
-int xc_dom_boot_xen_init(struct xc_dom_image *dom, xc_interface *xch, domid_t domid)
+int xc_dom_boot_xen_init(struct xc_dom_image *dom, xc_interface *xch, uint32_t domid)
 {
     dom->xch = xch;
     dom->guest_domid = domid;
@@ -250,7 +250,7 @@ int xc_dom_boot_image(struct xc_dom_image *dom)
     return rc;
 }
 
-static xen_pfn_t xc_dom_gnttab_setup(xc_interface *xch, domid_t domid)
+static xen_pfn_t xc_dom_gnttab_setup(xc_interface *xch, uint32_t domid)
 {
     gnttab_setup_table_t setup;
     DECLARE_HYPERCALL_BUFFER(xen_pfn_t, gmfnp);
@@ -282,11 +282,11 @@ static xen_pfn_t xc_dom_gnttab_setup(xc_interface *xch, domid_t domid)
     return gmfn;
 }
 
-int xc_dom_gnttab_seed(xc_interface *xch, domid_t domid,
+int xc_dom_gnttab_seed(xc_interface *xch, uint32_t domid,
                        xen_pfn_t console_gmfn,
                        xen_pfn_t xenstore_gmfn,
-                       domid_t console_domid,
-                       domid_t xenstore_domid)
+                       uint32_t console_domid,
+                       uint32_t xenstore_domid)
 {
 
     xen_pfn_t gnttab_gmfn;
@@ -339,11 +339,11 @@ int xc_dom_gnttab_seed(xc_interface *xch, domid_t domid,
     return 0;
 }
 
-int xc_dom_gnttab_hvm_seed(xc_interface *xch, domid_t domid,
+int xc_dom_gnttab_hvm_seed(xc_interface *xch, uint32_t domid,
                            xen_pfn_t console_gpfn,
                            xen_pfn_t xenstore_gpfn,
-                           domid_t console_domid,
-                           domid_t xenstore_domid)
+                           uint32_t console_domid,
+                           uint32_t xenstore_domid)
 {
     int rc;
     xen_pfn_t scratch_gpfn;
diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index cb68efc..bac584f 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -1030,7 +1030,7 @@ static int vcpu_hvm(struct xc_dom_image *dom)
 
 /* ------------------------------------------------------------------------ */
 
-static int x86_compat(xc_interface *xch, domid_t domid, char *guest_type)
+static int x86_compat(xc_interface *xch, uint32_t domid, char *guest_type)
 {
     static const struct {
         char           *guest;
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index ccd2016..3ccd27f 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -52,7 +52,7 @@ int xc_domain_create(xc_interface *xch, uint32_t ssidref,
     }
 
     domctl.cmd = XEN_DOMCTL_createdomain;
-    domctl.domain = (domid_t)*pdomid;
+    domctl.domain = *pdomid;
     domctl.u.createdomain.ssidref = ssidref;
     domctl.u.createdomain.flags   = flags;
     memcpy(domctl.u.createdomain.handle, handle, sizeof(xen_domain_handle_t));
@@ -81,7 +81,7 @@ int xc_domain_cacheflush(xc_interface *xch, uint32_t domid,
 #else
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_cacheflush;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.cacheflush.start_pfn = start_pfn;
     domctl.u.cacheflush.nr_pfns = nr_pfns;
     return do_domctl(xch, &domctl);
@@ -93,7 +93,7 @@ int xc_domain_pause(xc_interface *xch,
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_pausedomain;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     return do_domctl(xch, &domctl);
 }
 
@@ -103,7 +103,7 @@ int xc_domain_unpause(xc_interface *xch,
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_unpausedomain;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     return do_domctl(xch, &domctl);
 }
 
@@ -113,7 +113,7 @@ int xc_domain_destroy(xc_interface *xch,
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_destroydomain;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     return do_domctl(xch, &domctl);
 }
 
@@ -168,7 +168,7 @@ int xc_domain_node_setaffinity(xc_interface *xch,
     }
 
     domctl.cmd = XEN_DOMCTL_setnodeaffinity;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
 
     memcpy(local, nodemap, nodesize);
     set_xen_guest_handle(domctl.u.nodeaffinity.nodemap.bitmap, local);
@@ -206,7 +206,7 @@ int xc_domain_node_getaffinity(xc_interface *xch,
     }
 
     domctl.cmd = XEN_DOMCTL_getnodeaffinity;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
 
     set_xen_guest_handle(domctl.u.nodeaffinity.nodemap.bitmap, local);
     domctl.u.nodeaffinity.nodemap.nr_bits = nodesize * 8;
@@ -254,7 +254,7 @@ int xc_vcpu_setaffinity(xc_interface *xch,
     }
 
     domctl.cmd = XEN_DOMCTL_setvcpuaffinity;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.vcpuaffinity.vcpu = vcpu;
     domctl.u.vcpuaffinity.flags = flags;
 
@@ -306,7 +306,7 @@ int xc_vcpu_getaffinity(xc_interface *xch,
     }
 
     domctl.cmd = XEN_DOMCTL_getvcpuaffinity;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.vcpuaffinity.vcpu = vcpu;
     domctl.u.vcpuaffinity.flags = flags;
 
@@ -345,8 +345,8 @@ int xc_domain_get_guest_width(xc_interface *xch, uint32_t domid,
 
 int xc_dom_vuart_init(xc_interface *xch,
                       uint32_t type,
-                      domid_t domid,
-                      domid_t console_domid,
+                      uint32_t domid,
+                      uint32_t console_domid,
                       xen_pfn_t gfn,
                       evtchn_port_t *evtchn)
 {
@@ -385,10 +385,10 @@ int xc_domain_getinfo(xc_interface *xch,
     for ( nr_doms = 0; nr_doms < max_doms; nr_doms++ )
     {
         domctl.cmd = XEN_DOMCTL_getdomaininfo;
-        domctl.domain = (domid_t)next_domid;
+        domctl.domain = next_domid;
         if ( (rc = do_domctl(xch, &domctl)) < 0 )
             break;
-        info->domid      = (uint16_t)domctl.domain;
+        info->domid      = domctl.domain;
 
         info->dying    = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_dying);
         info->shutdown = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_shutdown);
@@ -471,7 +471,7 @@ int xc_set_broken_page_p2m(xc_interface *xch,
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_set_broken_page_p2m;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.set_broken_page_p2m.pfn = pfn;
     ret = do_domctl(xch, &domctl);
 
@@ -492,7 +492,7 @@ int xc_domain_hvm_getcontext(xc_interface *xch,
         return -1;
 
     domctl.cmd = XEN_DOMCTL_gethvmcontext;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.hvmcontext.size = size;
     set_xen_guest_handle(domctl.u.hvmcontext.buffer, ctxt_buf);
 
@@ -520,7 +520,7 @@ int xc_domain_hvm_getcontext_partial(xc_interface *xch,
         return -1;
 
     domctl.cmd = XEN_DOMCTL_gethvmcontext_partial;
-    domctl.domain = (domid_t) domid;
+    domctl.domain = domid;
     domctl.u.hvmcontext_partial.type = typecode;
     domctl.u.hvmcontext_partial.instance = instance;
     domctl.u.hvmcontext_partial.bufsz = size;
@@ -571,7 +571,7 @@ int xc_vcpu_getcontext(xc_interface *xch,
         return -1;
 
     domctl.cmd = XEN_DOMCTL_getvcpucontext;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.vcpucontext.vcpu   = (uint16_t)vcpu;
     set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
 
@@ -597,7 +597,7 @@ int xc_vcpu_get_extstate(xc_interface *xch,
         return -EINVAL;
 
     domctl.cmd = XEN_DOMCTL_getvcpuextstate;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.vcpuextstate.vcpu = (uint16_t)vcpu;
     domctl.u.vcpuextstate.xfeature_mask = extstate->xfeature_mask;
     domctl.u.vcpuextstate.size = extstate->size;
@@ -687,7 +687,7 @@ int xc_shadow_control(xc_interface *xch,
     memset(&domctl, 0, sizeof(domctl));
 
     domctl.cmd = XEN_DOMCTL_shadow_op;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.shadow_op.op     = sop;
     domctl.u.shadow_op.pages  = pages;
     domctl.u.shadow_op.mb     = mb ? *mb : 0;
@@ -714,7 +714,7 @@ int xc_domain_setmaxmem(xc_interface *xch,
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_max_mem;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.max_mem.max_memkb = max_memkb;
     return do_domctl(xch, &domctl);
 }
@@ -727,7 +727,7 @@ int xc_domain_pin_memory_cacheattr(xc_interface *xch,
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_pin_mem_cacheattr;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.pin_mem_cacheattr.start = start;
     domctl.u.pin_mem_cacheattr.end = end;
     domctl.u.pin_mem_cacheattr.type = type;
@@ -847,7 +847,7 @@ int xc_domain_set_time_offset(xc_interface *xch,
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_settimeoffset;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.settimeoffset.time_offset_seconds = time_offset_seconds;
     return do_domctl(xch, &domctl);
 }
@@ -856,7 +856,7 @@ int xc_domain_disable_migrate(xc_interface *xch, uint32_t domid)
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_disable_migrate;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.disable_migrate.disable = 1;
     return do_domctl(xch, &domctl);
 }
@@ -870,7 +870,7 @@ int xc_domain_set_tsc_info(xc_interface *xch,
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_settscinfo;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.tsc_info.tsc_mode = tsc_mode;
     domctl.u.tsc_info.elapsed_nsec = elapsed_nsec;
     domctl.u.tsc_info.gtsc_khz = gtsc_khz;
@@ -889,7 +889,7 @@ int xc_domain_get_tsc_info(xc_interface *xch,
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_gettscinfo;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     rc = do_domctl(xch, &domctl);
     if ( rc == 0 )
     {
@@ -902,7 +902,7 @@ int xc_domain_get_tsc_info(xc_interface *xch,
 }
 
 
-int xc_domain_maximum_gpfn(xc_interface *xch, domid_t domid, xen_pfn_t *gpfns)
+int xc_domain_maximum_gpfn(xc_interface *xch, uint32_t domid, xen_pfn_t *gpfns)
 {
     long rc = do_memory_op(xch, XENMEM_maximum_gpfn, &domid, sizeof(domid));
 
@@ -914,7 +914,7 @@ int xc_domain_maximum_gpfn(xc_interface *xch, domid_t domid, xen_pfn_t *gpfns)
     return rc;
 }
 
-int xc_domain_nr_gpfns(xc_interface *xch, domid_t domid, xen_pfn_t *gpfns)
+int xc_domain_nr_gpfns(xc_interface *xch, uint32_t domid, xen_pfn_t *gpfns)
 {
     int rc = xc_domain_maximum_gpfn(xch, domid, gpfns);
 
@@ -1060,8 +1060,8 @@ int xc_domain_add_to_physmap(xc_interface *xch,
 }
 
 int xc_domain_add_to_physmap_batch(xc_interface *xch,
-                                   domid_t domid,
-                                   domid_t foreign_domid,
+                                   uint32_t domid,
+                                   uint32_t foreign_domid,
                                    unsigned int space,
                                    unsigned int size,
                                    xen_ulong_t *idxs,
@@ -1180,7 +1180,7 @@ int xc_domain_populate_physmap_exact(xc_interface *xch,
 }
 
 int xc_domain_memory_exchange_pages(xc_interface *xch,
-                                    int domid,
+                                    uint32_t domid,
                                     unsigned long nr_in_extents,
                                     unsigned int in_order,
                                     xen_pfn_t *in_extents,
@@ -1322,7 +1322,7 @@ int xc_domain_max_vcpus(xc_interface *xch, uint32_t domid, unsigned int max)
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_max_vcpus;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.max_vcpus.max    = max;
     return do_domctl(xch, &domctl);
 }
@@ -1332,7 +1332,7 @@ int xc_domain_sethandle(xc_interface *xch, uint32_t domid,
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_setdomainhandle;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     memcpy(domctl.u.setdomainhandle.handle, handle,
            sizeof(xen_domain_handle_t));
     return do_domctl(xch, &domctl);
@@ -1347,7 +1347,7 @@ int xc_vcpu_getinfo(xc_interface *xch,
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_getvcpuinfo;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.getvcpuinfo.vcpu   = (uint16_t)vcpu;
 
     rc = do_domctl(xch, &domctl);
@@ -1366,7 +1366,7 @@ int xc_domain_ioport_permission(xc_interface *xch,
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_ioport_permission;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.ioport_permission.first_port = first_port;
     domctl.u.ioport_permission.nr_ports = nr_ports;
     domctl.u.ioport_permission.allow_access = allow_access;
@@ -1484,7 +1484,7 @@ static inline int xc_hvm_param_deprecated_check(uint32_t param)
     return 0;
 }
 
-int xc_hvm_param_set(xc_interface *handle, domid_t dom, uint32_t param, uint64_t value)
+int xc_hvm_param_set(xc_interface *handle, uint32_t dom, uint32_t param, uint64_t value)
 {
     DECLARE_HYPERCALL_BUFFER(xen_hvm_param_t, arg);
     int rc = xc_hvm_param_deprecated_check(param);
@@ -1506,7 +1506,7 @@ int xc_hvm_param_set(xc_interface *handle, domid_t dom, uint32_t param, uint64_t
     return rc;
 }
 
-int xc_hvm_param_get(xc_interface *handle, domid_t dom, uint32_t param, uint64_t *value)
+int xc_hvm_param_get(xc_interface *handle, uint32_t dom, uint32_t param, uint64_t *value)
 {
     DECLARE_HYPERCALL_BUFFER(xen_hvm_param_t, arg);
     int rc = xc_hvm_param_deprecated_check(param);
@@ -1528,12 +1528,12 @@ int xc_hvm_param_get(xc_interface *handle, domid_t dom, uint32_t param, uint64_t
     return rc;
 }
 
-int xc_set_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned long value)
+int xc_set_hvm_param(xc_interface *handle, uint32_t dom, int param, unsigned long value)
 {
     return xc_hvm_param_set(handle, dom, param, value);
 }
 
-int xc_get_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned long *value)
+int xc_get_hvm_param(xc_interface *handle, uint32_t dom, int param, unsigned long *value)
 {
     uint64_t v;
     int ret;
@@ -1593,7 +1593,7 @@ int xc_get_device_group(
     }
 
     domctl.cmd = XEN_DOMCTL_get_device_group;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
 
     domctl.u.get_device_group.machine_sbdf = machine_sbdf;
     domctl.u.get_device_group.max_sdevs = max_sdevs;
@@ -1655,7 +1655,7 @@ int xc_assign_dt_device(
         return -1;
 
     domctl.cmd = XEN_DOMCTL_assign_device;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
 
     domctl.u.assign_device.dev = XEN_DOMCTL_DEV_DT;
     domctl.u.assign_device.u.dt.size = size;
@@ -1687,7 +1687,7 @@ int xc_test_assign_dt_device(
         return -1;
 
     domctl.cmd = XEN_DOMCTL_test_assign_device;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
 
     domctl.u.assign_device.dev = XEN_DOMCTL_DEV_DT;
     domctl.u.assign_device.u.dt.size = size;
@@ -1715,7 +1715,7 @@ int xc_deassign_dt_device(
         return -1;
 
     domctl.cmd = XEN_DOMCTL_deassign_device;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
 
     domctl.u.assign_device.dev = XEN_DOMCTL_DEV_DT;
     domctl.u.assign_device.u.dt.size = size;
@@ -1745,7 +1745,7 @@ int xc_domain_update_msi_irq(
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_bind_pt_irq;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
 
     bind = &(domctl.u.bind_pt_irq);
     bind->irq_type = PT_IRQ_TYPE_MSI;
@@ -1770,7 +1770,7 @@ int xc_domain_unbind_msi_irq(
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_unbind_pt_irq;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
 
     bind = &(domctl.u.bind_pt_irq);
     bind->irq_type = PT_IRQ_TYPE_MSI;
@@ -1799,7 +1799,7 @@ static int xc_domain_bind_pt_irq_int(
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_bind_pt_irq;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
 
     bind = &(domctl.u.bind_pt_irq);
     bind->irq_type = irq_type;
@@ -1857,7 +1857,7 @@ static int xc_domain_unbind_pt_irq_int(
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_unbind_pt_irq;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
 
     bind = &(domctl.u.bind_pt_irq);
     bind->irq_type = irq_type;
@@ -1955,7 +1955,7 @@ int xc_unmap_domain_meminfo(xc_interface *xch, struct xc_domain_meminfo *minfo)
     return 0;
 }
 
-int xc_map_domain_meminfo(xc_interface *xch, int domid,
+int xc_map_domain_meminfo(xc_interface *xch, uint32_t domid,
                           struct xc_domain_meminfo *minfo)
 {
     struct domain_info_context _di;
@@ -2175,7 +2175,7 @@ int xc_domain_set_target(
 }
 
 int xc_domain_subscribe_for_suspend(
-    xc_interface *xch, domid_t dom, evtchn_port_t port)
+    xc_interface *xch, uint32_t dom, evtchn_port_t port)
 {
     DECLARE_DOMCTL;
 
@@ -2232,7 +2232,7 @@ int xc_domain_debug_control(xc_interface *xc, uint32_t domid, uint32_t sop, uint
     DECLARE_DOMCTL;
 
     memset(&domctl, 0, sizeof(domctl));
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.cmd = XEN_DOMCTL_debug_op;
     domctl.u.debug_op.op     = sop;
     domctl.u.debug_op.vcpu   = vcpu;
@@ -2293,7 +2293,7 @@ int xc_domain_set_max_evtchn(xc_interface *xch, uint32_t domid,
     return do_domctl(xch, &domctl);
 }
 
-int xc_domain_set_gnttab_limits(xc_interface *xch, domid_t domid,
+int xc_domain_set_gnttab_limits(xc_interface *xch, uint32_t domid,
                                 uint32_t grant_frames,
                                 uint32_t maptrack_frames)
 {
@@ -2356,7 +2356,7 @@ int xc_domain_setvnuma(xc_interface *xch,
     set_xen_guest_handle(domctl.u.vnuma.vnode_to_pnode, vnode_to_pnode);
 
     domctl.cmd = XEN_DOMCTL_setvnumainfo;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.vnuma.nr_vnodes = nr_vnodes;
     domctl.u.vnuma.nr_vmemranges = nr_vmemranges;
     domctl.u.vnuma.nr_vcpus = nr_vcpus;
@@ -2432,7 +2432,7 @@ int xc_domain_soft_reset(xc_interface *xch,
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_soft_reset;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     return do_domctl(xch, &domctl);
 }
 /*
diff --git a/tools/libxc/xc_evtchn.c b/tools/libxc/xc_evtchn.c
index 8d4fcc1..614786d 100644
--- a/tools/libxc/xc_evtchn.c
+++ b/tools/libxc/xc_evtchn.c
@@ -50,8 +50,8 @@ xc_evtchn_alloc_unbound(xc_interface *xch,
 {
     int rc;
     struct evtchn_alloc_unbound arg = {
-        .dom = (domid_t)dom,
-        .remote_dom = (domid_t)remote_dom
+        .dom        = dom,
+        .remote_dom = remote_dom,
     };
 
     rc = do_evtchn_op(xch, EVTCHNOP_alloc_unbound, &arg, sizeof(arg), 0);
@@ -64,7 +64,7 @@ xc_evtchn_alloc_unbound(xc_interface *xch,
 int xc_evtchn_reset(xc_interface *xch,
                     uint32_t dom)
 {
-    struct evtchn_reset arg = { .dom = (domid_t)dom };
+    struct evtchn_reset arg = { .dom = dom };
     return do_evtchn_op(xch, EVTCHNOP_reset, &arg, sizeof(arg), 0);
 }
 
diff --git a/tools/libxc/xc_evtchn_compat.c b/tools/libxc/xc_evtchn_compat.c
index 5d3e4ba..82baf14 100644
--- a/tools/libxc/xc_evtchn_compat.c
+++ b/tools/libxc/xc_evtchn_compat.c
@@ -30,13 +30,13 @@ int xc_evtchn_notify(xc_evtchn *xce, evtchn_port_t port)
 }
 
 evtchn_port_or_error_t
-xc_evtchn_bind_unbound_port(xc_evtchn *xce, int domid)
+xc_evtchn_bind_unbound_port(xc_evtchn *xce, uint32_t domid)
 {
     return xenevtchn_bind_unbound_port(xce, domid);
 }
 
 evtchn_port_or_error_t
-xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
+xc_evtchn_bind_interdomain(xc_evtchn *xce, uint32_t domid,
                            evtchn_port_t remote_port)
 {
     return xenevtchn_bind_interdomain(xce, domid, remote_port);
diff --git a/tools/libxc/xc_flask.c b/tools/libxc/xc_flask.c
index ec52b0f..c1652ba 100644
--- a/tools/libxc/xc_flask.c
+++ b/tools/libxc/xc_flask.c
@@ -429,7 +429,7 @@ int xc_flask_setavc_threshold(xc_interface *xch, int threshold)
     return xc_flask_op(xch, &op);
 }
 
-int xc_flask_relabel_domain(xc_interface *xch, int domid, uint32_t sid)
+int xc_flask_relabel_domain(xc_interface *xch, uint32_t domid, uint32_t sid)
 {
     DECLARE_FLASK_OP;
     op.cmd = FLASK_RELABEL_DOMAIN;
diff --git a/tools/libxc/xc_gnttab.c b/tools/libxc/xc_gnttab.c
index 9e6f1fb..eb92d89 100644
--- a/tools/libxc/xc_gnttab.c
+++ b/tools/libxc/xc_gnttab.c
@@ -50,7 +50,7 @@ int xc_gnttab_query_size(xc_interface *xch, struct gnttab_query_size *query)
     return rc;
 }
 
-int xc_gnttab_get_version(xc_interface *xch, int domid)
+int xc_gnttab_get_version(xc_interface *xch, uint32_t domid)
 {
     struct gnttab_get_version query;
     int rc;
@@ -64,7 +64,7 @@ int xc_gnttab_get_version(xc_interface *xch, int domid)
         return query.version;
 }
 
-static void *_gnttab_map_table(xc_interface *xch, int domid, int *gnt_num)
+static void *_gnttab_map_table(xc_interface *xch, uint32_t domid, int *gnt_num)
 {
     int rc, i;
     struct gnttab_query_size query;
@@ -134,7 +134,7 @@ static void *_gnttab_map_table(xc_interface *xch, int domid, int *gnt_num)
     return gnt;
 }
 
-grant_entry_v1_t *xc_gnttab_map_table_v1(xc_interface *xch, int domid,
+grant_entry_v1_t *xc_gnttab_map_table_v1(xc_interface *xch, uint32_t domid,
                                          int *gnt_num)
 {
     if (xc_gnttab_get_version(xch, domid) == 2)
@@ -142,7 +142,7 @@ grant_entry_v1_t *xc_gnttab_map_table_v1(xc_interface *xch, int domid,
     return _gnttab_map_table(xch, domid, gnt_num);
 }
 
-grant_entry_v2_t *xc_gnttab_map_table_v2(xc_interface *xch, int domid,
+grant_entry_v2_t *xc_gnttab_map_table_v2(xc_interface *xch, uint32_t domid,
                                          int *gnt_num)
 {
     if (xc_gnttab_get_version(xch, domid) != 2)
diff --git a/tools/libxc/xc_mem_access.c b/tools/libxc/xc_mem_access.c
index 9536635..b452460 100644
--- a/tools/libxc/xc_mem_access.c
+++ b/tools/libxc/xc_mem_access.c
@@ -24,7 +24,7 @@
 #include <xen/memory.h>
 
 int xc_set_mem_access(xc_interface *xch,
-                      domid_t domain_id,
+                      uint32_t domain_id,
                       xenmem_access_t access,
                       uint64_t first_pfn,
                       uint32_t nr)
@@ -42,7 +42,7 @@ int xc_set_mem_access(xc_interface *xch,
 }
 
 int xc_set_mem_access_multi(xc_interface *xch,
-                            domid_t domain_id,
+                            uint32_t domain_id,
                             uint8_t *access,
                             uint64_t *pages,
                             uint32_t nr)
@@ -80,7 +80,7 @@ int xc_set_mem_access_multi(xc_interface *xch,
 }
 
 int xc_get_mem_access(xc_interface *xch,
-                      domid_t domain_id,
+                      uint32_t domain_id,
                       uint64_t pfn,
                       xenmem_access_t *access)
 {
diff --git a/tools/libxc/xc_mem_paging.c b/tools/libxc/xc_mem_paging.c
index 28611f4..a067706 100644
--- a/tools/libxc/xc_mem_paging.c
+++ b/tools/libxc/xc_mem_paging.c
@@ -22,7 +22,7 @@
 
 #include "xc_private.h"
 
-static int xc_mem_paging_memop(xc_interface *xch, domid_t domain_id,
+static int xc_mem_paging_memop(xc_interface *xch, uint32_t domain_id,
                                unsigned int op, uint64_t gfn, void *buffer)
 {
     xen_mem_paging_op_t mpo;
@@ -37,7 +37,7 @@ static int xc_mem_paging_memop(xc_interface *xch, domid_t domain_id,
     return do_memory_op(xch, XENMEM_paging_op, &mpo, sizeof(mpo));
 }
 
-int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id,
+int xc_mem_paging_enable(xc_interface *xch, uint32_t domain_id,
                          uint32_t *port)
 {
     if ( !port )
@@ -52,7 +52,7 @@ int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id,
                                port);
 }
 
-int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id)
+int xc_mem_paging_disable(xc_interface *xch, uint32_t domain_id)
 {
     return xc_vm_event_control(xch, domain_id,
                                XEN_VM_EVENT_DISABLE,
@@ -60,7 +60,7 @@ int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id)
                                NULL);
 }
 
-int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id)
+int xc_mem_paging_resume(xc_interface *xch, uint32_t domain_id)
 {
     return xc_vm_event_control(xch, domain_id,
                                XEN_VM_EVENT_RESUME,
@@ -68,28 +68,28 @@ int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id)
                                NULL);
 }
 
-int xc_mem_paging_nominate(xc_interface *xch, domid_t domain_id, uint64_t gfn)
+int xc_mem_paging_nominate(xc_interface *xch, uint32_t domain_id, uint64_t gfn)
 {
     return xc_mem_paging_memop(xch, domain_id,
                                XENMEM_paging_op_nominate,
                                gfn, NULL);
 }
 
-int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, uint64_t gfn)
+int xc_mem_paging_evict(xc_interface *xch, uint32_t domain_id, uint64_t gfn)
 {
     return xc_mem_paging_memop(xch, domain_id,
                                XENMEM_paging_op_evict,
                                gfn, NULL);
 }
 
-int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, uint64_t gfn)
+int xc_mem_paging_prep(xc_interface *xch, uint32_t domain_id, uint64_t gfn)
 {
     return xc_mem_paging_memop(xch, domain_id,
                                XENMEM_paging_op_prep,
                                gfn, NULL);
 }
 
-int xc_mem_paging_load(xc_interface *xch, domid_t domain_id,
+int xc_mem_paging_load(xc_interface *xch, uint32_t domain_id,
                        uint64_t gfn, void *buffer)
 {
     int rc, old_errno;
diff --git a/tools/libxc/xc_memshr.c b/tools/libxc/xc_memshr.c
index f53a59a..d5e135e 100644
--- a/tools/libxc/xc_memshr.c
+++ b/tools/libxc/xc_memshr.c
@@ -25,7 +25,7 @@
 #include <xen/grant_table.h>
 
 int xc_memshr_control(xc_interface *xch,
-                      domid_t domid,
+                      uint32_t domid,
                       int enable)
 {
     DECLARE_DOMCTL;
@@ -42,7 +42,7 @@ int xc_memshr_control(xc_interface *xch,
 }
 
 int xc_memshr_ring_enable(xc_interface *xch, 
-                          domid_t domid, 
+                          uint32_t domid,
                           uint32_t *port)
 {
     if ( !port )
@@ -58,7 +58,7 @@ int xc_memshr_ring_enable(xc_interface *xch,
 }
 
 int xc_memshr_ring_disable(xc_interface *xch, 
-                           domid_t domid)
+                           uint32_t domid)
 {
     return xc_vm_event_control(xch, domid,
                                XEN_VM_EVENT_DISABLE,
@@ -66,7 +66,7 @@ int xc_memshr_ring_disable(xc_interface *xch,
                                NULL);
 }
 
-static int xc_memshr_memop(xc_interface *xch, domid_t domid, 
+static int xc_memshr_memop(xc_interface *xch, uint32_t domid,
                             xen_mem_sharing_op_t *mso)
 {
     mso->domain = domid;
@@ -75,7 +75,7 @@ static int xc_memshr_memop(xc_interface *xch, domid_t domid,
 }
 
 int xc_memshr_nominate_gfn(xc_interface *xch,
-                           domid_t domid,
+                           uint32_t domid,
                            unsigned long gfn,
                            uint64_t *handle)
 {
@@ -95,7 +95,7 @@ int xc_memshr_nominate_gfn(xc_interface *xch,
 }
 
 int xc_memshr_nominate_gref(xc_interface *xch,
-                            domid_t domid,
+                            uint32_t domid,
                             grant_ref_t gref,
                             uint64_t *handle)
 {
@@ -115,10 +115,10 @@ int xc_memshr_nominate_gref(xc_interface *xch,
 }
 
 int xc_memshr_share_gfns(xc_interface *xch,
-                         domid_t source_domain,
+                         uint32_t source_domain,
                          unsigned long source_gfn,
                          uint64_t source_handle,
-                         domid_t client_domain,
+                         uint32_t client_domain,
                          unsigned long client_gfn,
                          uint64_t client_handle)
 {
@@ -138,10 +138,10 @@ int xc_memshr_share_gfns(xc_interface *xch,
 }
 
 int xc_memshr_share_grefs(xc_interface *xch,
-                          domid_t source_domain,
+                          uint32_t source_domain,
                           grant_ref_t source_gref,
                           uint64_t source_handle,
-                          domid_t client_domain,
+                          uint32_t client_domain,
                           grant_ref_t client_gref,
                           uint64_t client_handle)
 {
@@ -161,10 +161,10 @@ int xc_memshr_share_grefs(xc_interface *xch,
 }
 
 int xc_memshr_add_to_physmap(xc_interface *xch,
-                    domid_t source_domain,
+                    uint32_t source_domain,
                     unsigned long source_gfn,
                     uint64_t source_handle,
-                    domid_t client_domain,
+                    uint32_t client_domain,
                     unsigned long client_gfn)
 {
     xen_mem_sharing_op_t mso;
@@ -182,8 +182,8 @@ int xc_memshr_add_to_physmap(xc_interface *xch,
 }
 
 int xc_memshr_range_share(xc_interface *xch,
-                          domid_t source_domain,
-                          domid_t client_domain,
+                          uint32_t source_domain,
+                          uint32_t client_domain,
                           uint64_t first_gfn,
                           uint64_t last_gfn)
 {
@@ -201,7 +201,7 @@ int xc_memshr_range_share(xc_interface *xch,
 }
 
 int xc_memshr_domain_resume(xc_interface *xch,
-                            domid_t domid)
+                            uint32_t domid)
 {
     return xc_vm_event_control(xch, domid,
                                XEN_VM_EVENT_RESUME,
@@ -210,7 +210,7 @@ int xc_memshr_domain_resume(xc_interface *xch,
 }
 
 int xc_memshr_debug_gfn(xc_interface *xch,
-                        domid_t domid,
+                        uint32_t domid,
                         unsigned long gfn)
 {
     xen_mem_sharing_op_t mso;
@@ -224,7 +224,7 @@ int xc_memshr_debug_gfn(xc_interface *xch,
 }
 
 int xc_memshr_debug_gref(xc_interface *xch,
-                         domid_t domid,
+                         uint32_t domid,
                          grant_ref_t gref)
 {
     xen_mem_sharing_op_t mso;
diff --git a/tools/libxc/xc_monitor.c b/tools/libxc/xc_monitor.c
index 6046680..2840f14 100644
--- a/tools/libxc/xc_monitor.c
+++ b/tools/libxc/xc_monitor.c
@@ -22,13 +22,13 @@
 
 #include "xc_private.h"
 
-void *xc_monitor_enable(xc_interface *xch, domid_t domain_id, uint32_t *port)
+void *xc_monitor_enable(xc_interface *xch, uint32_t domain_id, uint32_t *port)
 {
     return xc_vm_event_enable(xch, domain_id, HVM_PARAM_MONITOR_RING_PFN,
                               port);
 }
 
-int xc_monitor_disable(xc_interface *xch, domid_t domain_id)
+int xc_monitor_disable(xc_interface *xch, uint32_t domain_id)
 {
     return xc_vm_event_control(xch, domain_id,
                                XEN_VM_EVENT_DISABLE,
@@ -36,7 +36,7 @@ int xc_monitor_disable(xc_interface *xch, domid_t domain_id)
                                NULL);
 }
 
-int xc_monitor_resume(xc_interface *xch, domid_t domain_id)
+int xc_monitor_resume(xc_interface *xch, uint32_t domain_id)
 {
     return xc_vm_event_control(xch, domain_id,
                                XEN_VM_EVENT_RESUME,
@@ -44,7 +44,7 @@ int xc_monitor_resume(xc_interface *xch, domid_t domain_id)
                                NULL);
 }
 
-int xc_monitor_get_capabilities(xc_interface *xch, domid_t domain_id,
+int xc_monitor_get_capabilities(xc_interface *xch, uint32_t domain_id,
                                 uint32_t *capabilities)
 {
     int rc;
@@ -68,7 +68,7 @@ int xc_monitor_get_capabilities(xc_interface *xch, domid_t domain_id,
     return 0;
 }
 
-int xc_monitor_write_ctrlreg(xc_interface *xch, domid_t domain_id,
+int xc_monitor_write_ctrlreg(xc_interface *xch, uint32_t domain_id,
                              uint16_t index, bool enable, bool sync,
                              uint64_t bitmask, bool onchangeonly)
 {
@@ -89,7 +89,7 @@ int xc_monitor_write_ctrlreg(xc_interface *xch, domid_t domain_id,
     return do_domctl(xch, &domctl);
 }
 
-int xc_monitor_mov_to_msr(xc_interface *xch, domid_t domain_id, uint32_t msr,
+int xc_monitor_mov_to_msr(xc_interface *xch, uint32_t domain_id, uint32_t msr,
                           bool enable)
 {
     DECLARE_DOMCTL;
@@ -104,7 +104,7 @@ int xc_monitor_mov_to_msr(xc_interface *xch, domid_t domain_id, uint32_t msr,
     return do_domctl(xch, &domctl);
 }
 
-int xc_monitor_software_breakpoint(xc_interface *xch, domid_t domain_id,
+int xc_monitor_software_breakpoint(xc_interface *xch, uint32_t domain_id,
                                    bool enable)
 {
     DECLARE_DOMCTL;
@@ -118,7 +118,7 @@ int xc_monitor_software_breakpoint(xc_interface *xch, domid_t domain_id,
     return do_domctl(xch, &domctl);
 }
 
-int xc_monitor_singlestep(xc_interface *xch, domid_t domain_id,
+int xc_monitor_singlestep(xc_interface *xch, uint32_t domain_id,
                           bool enable)
 {
     DECLARE_DOMCTL;
@@ -132,7 +132,7 @@ int xc_monitor_singlestep(xc_interface *xch, domid_t domain_id,
     return do_domctl(xch, &domctl);
 }
 
-int xc_monitor_descriptor_access(xc_interface *xch, domid_t domain_id,
+int xc_monitor_descriptor_access(xc_interface *xch, uint32_t domain_id,
                                  bool enable)
 {
     DECLARE_DOMCTL;
@@ -146,7 +146,7 @@ int xc_monitor_descriptor_access(xc_interface *xch, domid_t domain_id,
     return do_domctl(xch, &domctl);
 }
 
-int xc_monitor_guest_request(xc_interface *xch, domid_t domain_id, bool enable,
+int xc_monitor_guest_request(xc_interface *xch, uint32_t domain_id, bool enable,
                              bool sync, bool allow_userspace)
 {
     DECLARE_DOMCTL;
@@ -162,7 +162,7 @@ int xc_monitor_guest_request(xc_interface *xch, domid_t domain_id, bool enable,
     return do_domctl(xch, &domctl);
 }
 
-int xc_monitor_emulate_each_rep(xc_interface *xch, domid_t domain_id,
+int xc_monitor_emulate_each_rep(xc_interface *xch, uint32_t domain_id,
                                 bool enable)
 {
     DECLARE_DOMCTL;
@@ -175,7 +175,7 @@ int xc_monitor_emulate_each_rep(xc_interface *xch, domid_t domain_id,
     return do_domctl(xch, &domctl);
 }
 
-int xc_monitor_debug_exceptions(xc_interface *xch, domid_t domain_id,
+int xc_monitor_debug_exceptions(xc_interface *xch, uint32_t domain_id,
                                 bool enable, bool sync)
 {
     DECLARE_DOMCTL;
@@ -190,7 +190,7 @@ int xc_monitor_debug_exceptions(xc_interface *xch, domid_t domain_id,
     return do_domctl(xch, &domctl);
 }
 
-int xc_monitor_cpuid(xc_interface *xch, domid_t domain_id, bool enable)
+int xc_monitor_cpuid(xc_interface *xch, uint32_t domain_id, bool enable)
 {
     DECLARE_DOMCTL;
 
@@ -203,7 +203,7 @@ int xc_monitor_cpuid(xc_interface *xch, domid_t domain_id, bool enable)
     return do_domctl(xch, &domctl);
 }
 
-int xc_monitor_privileged_call(xc_interface *xch, domid_t domain_id,
+int xc_monitor_privileged_call(xc_interface *xch, uint32_t domain_id,
                                bool enable)
 {
     DECLARE_DOMCTL;
@@ -217,7 +217,7 @@ int xc_monitor_privileged_call(xc_interface *xch, domid_t domain_id,
     return do_domctl(xch, &domctl);
 }
 
-int xc_monitor_emul_unimplemented(xc_interface *xch, domid_t domain_id,
+int xc_monitor_emul_unimplemented(xc_interface *xch, uint32_t domain_id,
                                   bool enable)
 {
     DECLARE_DOMCTL;
diff --git a/tools/libxc/xc_nomigrate.c b/tools/libxc/xc_nomigrate.c
index fe8f68c..6d6169d 100644
--- a/tools/libxc/xc_nomigrate.c
+++ b/tools/libxc/xc_nomigrate.c
@@ -30,8 +30,8 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t flags,
 
 int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
                       unsigned int store_evtchn, unsigned long *store_mfn,
-                      domid_t store_domid, unsigned int console_evtchn,
-                      unsigned long *console_mfn, domid_t console_domid,
+                      uint32_t store_domid, unsigned int console_evtchn,
+                      unsigned long *console_mfn, uint32_t console_domid,
                       unsigned int hvm, unsigned int pae,
                       xc_migration_stream_t stream_type,
                       struct restore_callbacks *callbacks, int send_back_fd)
diff --git a/tools/libxc/xc_offline_page.c b/tools/libxc/xc_offline_page.c
index 3248a34..19538fc 100644
--- a/tools/libxc/xc_offline_page.c
+++ b/tools/libxc/xc_offline_page.c
@@ -262,7 +262,7 @@ static int __update_pte(xc_interface *xch,
     return 0;
 }
 
-static int change_pte(xc_interface *xch, int domid,
+static int change_pte(xc_interface *xch, uint32_t domid,
                      struct xc_domain_meminfo *minfo,
                      struct pte_backup *backup,
                      struct xc_mmu *mmu,
@@ -340,7 +340,7 @@ static int change_pte(xc_interface *xch, int domid,
     return -1;
 }
 
-static int update_pte(xc_interface *xch, int domid,
+static int update_pte(xc_interface *xch, uint32_t domid,
                      struct xc_domain_meminfo *minfo,
                      struct pte_backup *backup,
                      struct xc_mmu *mmu,
@@ -350,7 +350,7 @@ static int update_pte(xc_interface *xch, int domid,
                       __update_pte, new_mfn);
 }
 
-static int clear_pte(xc_interface *xch, int domid,
+static int clear_pte(xc_interface *xch, uint32_t domid,
                      struct xc_domain_meminfo *minfo,
                      struct pte_backup *backup,
                      struct xc_mmu *mmu,
@@ -364,7 +364,7 @@ static int clear_pte(xc_interface *xch, int domid,
  * Check if a page can be exchanged successfully
  */
 
-static int is_page_exchangable(xc_interface *xch, int domid, xen_pfn_t mfn,
+static int is_page_exchangable(xc_interface *xch, uint32_t domid, xen_pfn_t mfn,
                                xc_dominfo_t *info)
 {
     uint32_t status;
@@ -455,7 +455,7 @@ xen_pfn_t *xc_map_m2p(xc_interface *xch,
 }
 
 /* The domain should be suspended when called here */
-int xc_exchange_page(xc_interface *xch, int domid, xen_pfn_t mfn)
+int xc_exchange_page(xc_interface *xch, uint32_t domid, xen_pfn_t mfn)
 {
     xc_dominfo_t info;
     struct xc_domain_meminfo minfo;
diff --git a/tools/libxc/xc_physdev.c b/tools/libxc/xc_physdev.c
index 23108d6..460a8e7 100644
--- a/tools/libxc/xc_physdev.c
+++ b/tools/libxc/xc_physdev.c
@@ -34,7 +34,7 @@ int xc_physdev_pci_access_modify(xc_interface *xch,
 }
 
 int xc_physdev_map_pirq(xc_interface *xch,
-                        int domid,
+                        uint32_t domid,
                         int index,
                         int *pirq)
 {
@@ -61,7 +61,7 @@ int xc_physdev_map_pirq(xc_interface *xch,
 }
 
 int xc_physdev_map_pirq_msi(xc_interface *xch,
-                            int domid,
+                            uint32_t domid,
                             int index,
                             int *pirq,
                             int devfn,
@@ -96,7 +96,7 @@ int xc_physdev_map_pirq_msi(xc_interface *xch,
 }
 
 int xc_physdev_unmap_pirq(xc_interface *xch,
-                          int domid,
+                          uint32_t domid,
                           int pirq)
 {
     int rc;
diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index f395594..36ead5f 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -221,7 +221,7 @@ int xc_get_pfn_type_batch(xc_interface *xch, uint32_t dom,
     if ( xc_hypercall_bounce_pre(xch, arr) )
         return -1;
     domctl.cmd = XEN_DOMCTL_getpageframeinfo3;
-    domctl.domain = (domid_t)dom;
+    domctl.domain = dom;
     domctl.u.getpageframeinfo3.num = num;
     set_xen_guest_handle(domctl.u.getpageframeinfo3.array, arr);
     rc = do_domctl(xch, &domctl);
@@ -233,7 +233,7 @@ int xc_mmuext_op(
     xc_interface *xch,
     struct mmuext_op *op,
     unsigned int nr_ops,
-    domid_t dom)
+    uint32_t dom)
 {
     DECLARE_HYPERCALL_BOUNCE(op, nr_ops*sizeof(*op), XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
     long ret = -1;
@@ -344,12 +344,12 @@ int xc_maximum_ram_page(xc_interface *xch, unsigned long *max_mfn)
     return rc;
 }
 
-long long xc_domain_get_cpu_usage( xc_interface *xch, domid_t domid, int vcpu )
+long long xc_domain_get_cpu_usage(xc_interface *xch, uint32_t domid, int vcpu)
 {
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_getvcpuinfo;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.getvcpuinfo.vcpu   = (uint16_t)vcpu;
     if ( (do_domctl(xch, &domctl) < 0) )
     {
@@ -403,7 +403,7 @@ int xc_get_pfn_list(xc_interface *xch,
     }
 
     domctl.cmd = XEN_DOMCTL_getmemlist;
-    domctl.domain   = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.getmemlist.max_pfns = max_pfns;
     set_xen_guest_handle(domctl.u.getmemlist.buffer, pfn_buf);
 
diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
index 1c27b0f..03bc9a7 100644
--- a/tools/libxc/xc_private.h
+++ b/tools/libxc/xc_private.h
@@ -414,16 +414,16 @@ int xc_ffs64(uint64_t x);
 /**
  * vm_event operations. Internal use only.
  */
-int xc_vm_event_control(xc_interface *xch, domid_t domain_id, unsigned int op,
+int xc_vm_event_control(xc_interface *xch, uint32_t domain_id, unsigned int op,
                         unsigned int mode, uint32_t *port);
 /*
  * Enables vm_event and returns the mapped ring page indicated by param.
  * param can be HVM_PARAM_PAGING/ACCESS/SHARING_RING_PFN
  */
-void *xc_vm_event_enable(xc_interface *xch, domid_t domain_id, int param,
+void *xc_vm_event_enable(xc_interface *xch, uint32_t domain_id, int param,
                          uint32_t *port);
 
-int do_dm_op(xc_interface *xch, domid_t domid, unsigned int nr_bufs, ...);
+int do_dm_op(xc_interface *xch, uint32_t domid, unsigned int nr_bufs, ...);
 
 #endif /* __XC_PRIVATE_H__ */
 
diff --git a/tools/libxc/xc_psr.c b/tools/libxc/xc_psr.c
index 039b920..edec4d1 100644
--- a/tools/libxc/xc_psr.c
+++ b/tools/libxc/xc_psr.c
@@ -32,7 +32,7 @@ int xc_psr_cmt_attach(xc_interface *xch, uint32_t domid)
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_psr_cmt_op;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.psr_cmt_op.cmd = XEN_DOMCTL_PSR_CMT_OP_ATTACH;
 
     return do_domctl(xch, &domctl);
@@ -43,7 +43,7 @@ int xc_psr_cmt_detach(xc_interface *xch, uint32_t domid)
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_psr_cmt_op;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.psr_cmt_op.cmd = XEN_DOMCTL_PSR_CMT_OP_DETACH;
 
     return do_domctl(xch, &domctl);
@@ -56,7 +56,7 @@ int xc_psr_cmt_get_domain_rmid(xc_interface *xch, uint32_t domid,
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_psr_cmt_op;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.psr_cmt_op.cmd = XEN_DOMCTL_PSR_CMT_OP_QUERY_RMID;
 
     rc = do_domctl(xch, &domctl);
@@ -275,7 +275,7 @@ int xc_psr_cat_set_domain_data(xc_interface *xch, uint32_t domid,
     }
 
     domctl.cmd = XEN_DOMCTL_psr_cat_op;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.psr_cat_op.cmd = cmd;
     domctl.u.psr_cat_op.target = target;
     domctl.u.psr_cat_op.data = data;
@@ -311,7 +311,7 @@ int xc_psr_cat_get_domain_data(xc_interface *xch, uint32_t domid,
     }
 
     domctl.cmd = XEN_DOMCTL_psr_cat_op;
-    domctl.domain = (domid_t)domid;
+    domctl.domain = domid;
     domctl.u.psr_cat_op.cmd = cmd;
     domctl.u.psr_cat_op.target = target;
 
diff --git a/tools/libxc/xc_rt.c b/tools/libxc/xc_rt.c
index 77aaa36..ad257c6 100644
--- a/tools/libxc/xc_rt.c
+++ b/tools/libxc/xc_rt.c
@@ -32,7 +32,7 @@ int xc_sched_rtds_domain_set(xc_interface *xch,
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_scheduler_op;
-    domctl.domain = (domid_t) domid;
+    domctl.domain = domid;
     domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_RTDS;
     domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
     domctl.u.scheduler_op.u.rtds.period = sdom->period;
@@ -51,7 +51,7 @@ int xc_sched_rtds_domain_get(xc_interface *xch,
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_scheduler_op;
-    domctl.domain = (domid_t) domid;
+    domctl.domain = domid;
     domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_RTDS;
     domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getinfo;
 
@@ -78,7 +78,7 @@ int xc_sched_rtds_vcpu_set(xc_interface *xch,
         return -1;
 
     domctl.cmd = XEN_DOMCTL_scheduler_op;
-    domctl.domain = (domid_t) domid;
+    domctl.domain = domid;
     domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_RTDS;
     domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putvcpuinfo;
 
@@ -112,7 +112,7 @@ int xc_sched_rtds_vcpu_get(xc_interface *xch,
         return -1;
 
     domctl.cmd = XEN_DOMCTL_scheduler_op;
-    domctl.domain = (domid_t) domid;
+    domctl.domain = domid;
     domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_RTDS;
     domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getvcpuinfo;
 
diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xc_sr_common.h
index 3635704..a145a15 100644
--- a/tools/libxc/xc_sr_common.h
+++ b/tools/libxc/xc_sr_common.h
@@ -250,7 +250,7 @@ struct xc_sr_context
              */
             xen_pfn_t    xenstore_gfn,    console_gfn;
             unsigned int xenstore_evtchn, console_evtchn;
-            domid_t      xenstore_domid,  console_domid;
+            uint32_t     xenstore_domid,  console_domid;
 
             /* Bitmap of currently populated PFNs during restore. */
             unsigned long *populated_pfns;
diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
index a016678..ea7b033 100644
--- a/tools/libxc/xc_sr_restore.c
+++ b/tools/libxc/xc_sr_restore.c
@@ -825,8 +825,8 @@ static int restore(struct xc_sr_context *ctx)
 
 int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
                       unsigned int store_evtchn, unsigned long *store_mfn,
-                      domid_t store_domid, unsigned int console_evtchn,
-                      unsigned long *console_gfn, domid_t console_domid,
+                      uint32_t store_domid, unsigned int console_evtchn,
+                      unsigned long *console_gfn, uint32_t console_domid,
                       unsigned int hvm, unsigned int pae,
                       xc_migration_stream_t stream_type,
                       struct restore_callbacks *callbacks, int send_back_fd)
diff --git a/tools/libxc/xc_suspend.c b/tools/libxc/xc_suspend.c
index 8361c7b..0ce6364 100644
--- a/tools/libxc/xc_suspend.c
+++ b/tools/libxc/xc_suspend.c
@@ -35,12 +35,12 @@
 
 #define SUSPEND_FILE_BUFLEN (sizeof(SUSPEND_LOCK_FILE) + 10)
 
-static void get_suspend_file(char buf[], int domid)
+static void get_suspend_file(char buf[], uint32_t domid)
 {
     snprintf(buf, SUSPEND_FILE_BUFLEN, SUSPEND_LOCK_FILE, domid);
 }
 
-static int lock_suspend_event(xc_interface *xch, int domid, int *lockfd)
+static int lock_suspend_event(xc_interface *xch, uint32_t domid, int *lockfd)
 {
     int fd = -1, r;
     char suspend_file[SUSPEND_FILE_BUFLEN];
@@ -100,7 +100,7 @@ static int lock_suspend_event(xc_interface *xch, int domid, int *lockfd)
     return -1;
 }
 
-static int unlock_suspend_event(xc_interface *xch, int domid, int *lockfd)
+static int unlock_suspend_event(xc_interface *xch, uint32_t domid, int *lockfd)
 {
     int r;
     char suspend_file[SUSPEND_FILE_BUFLEN];
@@ -148,7 +148,7 @@ int xc_await_suspend(xc_interface *xch, xenevtchn_handle *xce, int suspend_evtch
 /* Internal callers are allowed to call this with suspend_evtchn<0
  * but *lockfd>0. */
 int xc_suspend_evtchn_release(xc_interface *xch, xenevtchn_handle *xce,
-                              int domid, int suspend_evtchn, int *lockfd)
+                              uint32_t domid, int suspend_evtchn, int *lockfd)
 {
     if (suspend_evtchn >= 0)
         xenevtchn_unbind(xce, suspend_evtchn);
@@ -157,7 +157,7 @@ int xc_suspend_evtchn_release(xc_interface *xch, xenevtchn_handle *xce,
 }
 
 int xc_suspend_evtchn_init_sane(xc_interface *xch, xenevtchn_handle *xce,
-                                int domid, int port, int *lockfd)
+                                uint32_t domid, int port, int *lockfd)
 {
     int rc, suspend_evtchn = -1;
 
@@ -187,7 +187,7 @@ int xc_suspend_evtchn_init_sane(xc_interface *xch, xenevtchn_handle *xce,
 }
 
 int xc_suspend_evtchn_init_exclusive(xc_interface *xch, xenevtchn_handle *xce,
-                                     int domid, int port, int *lockfd)
+                                     uint32_t domid, int port, int *lockfd)
 {
     int suspend_evtchn;
 
diff --git a/tools/libxc/xc_tmem.c b/tools/libxc/xc_tmem.c
index 9bf5cc3..a365c74 100644
--- a/tools/libxc/xc_tmem.c
+++ b/tools/libxc/xc_tmem.c
@@ -191,7 +191,7 @@ int xc_tmem_auth(xc_interface *xch,
 
 /* returns 0 if nothing to save, -1 if error saving, 1 if saved successfully */
 int xc_tmem_save(xc_interface *xch,
-                 int dom, int io_fd, int live, int field_marker)
+                 uint32_t domid, int io_fd, int live, int field_marker)
 {
     int marker = field_marker;
     int i, j, rc;
@@ -202,7 +202,7 @@ int xc_tmem_save(xc_interface *xch,
     char *buf = NULL;
 
     rc = xc_tmem_control(xch, 0, XEN_SYSCTL_TMEM_OP_SAVE_BEGIN,
-                         dom, 0 /* len*/ , live, NULL);
+                         domid, 0 /* len*/ , live, NULL);
     if ( rc )
     {
         /* Nothing to save - no tmem enabled. */
@@ -214,7 +214,7 @@ int xc_tmem_save(xc_interface *xch,
 
     if ( xc_tmem_control(xch, 0 /* pool_id */,
                          XEN_SYSCTL_TMEM_OP_GET_CLIENT_INFO,
-                         dom /* cli_id */, sizeof(info), 0 /* arg */,
+                         domid /* cli_id */, sizeof(info), 0 /* arg */,
                          &info) < 0 )
         return -1;
 
@@ -228,7 +228,7 @@ int xc_tmem_save(xc_interface *xch,
 
     rc = xc_tmem_control(xch, 0 /* pool_id is ignored. */,
                          XEN_SYSCTL_TMEM_OP_GET_POOLS,
-                         dom /* cli_id */, sizeof(*pools) * info.nr_pools,
+                         domid /* cli_id */, sizeof(*pools) * info.nr_pools,
                          0 /* arg */, pools);
 
     if ( rc < 0 || (uint32_t)rc > info.nr_pools )
@@ -274,9 +274,9 @@ int xc_tmem_save(xc_interface *xch,
             for ( j = pool->n_pages; j > 0; j-- )
             {
                 int ret;
-                if ( (ret = xc_tmem_control(xch, pool->id,
-                                            XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_PAGE, dom,
-                                            bufsize, 0, buf)) > 0 )
+                if ( (ret = xc_tmem_control(
+                          xch, pool->id, XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_PAGE,
+                          domid, bufsize, 0, buf)) > 0 )
                 {
                     h = (struct tmem_handle *)buf;
                     if ( write_exact(io_fd, &h->oid, sizeof(h->oid)) )
@@ -305,7 +305,7 @@ int xc_tmem_save(xc_interface *xch,
                 }
             }
             DPRINTF("saved %"PRId64" tmem pages for dom=%d pool=%d, checksum=%x\n",
-                    pool->n_pages - j, dom, pool->id, checksum);
+                    pool->n_pages - j, domid, pool->id, checksum);
         }
     }
     free(pools);
@@ -320,7 +320,7 @@ int xc_tmem_save(xc_interface *xch,
 }
 
 /* only called for live migration */
-int xc_tmem_save_extra(xc_interface *xch, int dom, int io_fd, int field_marker)
+int xc_tmem_save_extra(xc_interface *xch, uint32_t domid, int io_fd, int field_marker)
 {
     struct tmem_handle handle;
     int marker = field_marker;
@@ -329,7 +329,7 @@ int xc_tmem_save_extra(xc_interface *xch, int dom, int io_fd, int field_marker)
 
     if ( write_exact(io_fd, &marker, sizeof(marker)) )
         return -1;
-    while ( xc_tmem_control(xch, 0, XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_INV, dom,
+    while ( xc_tmem_control(xch, 0, XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_INV, domid,
                             sizeof(handle),0,&handle) > 0 ) {
         if ( write_exact(io_fd, &handle.pool_id, sizeof(handle.pool_id)) )
             return -1;
@@ -350,9 +350,9 @@ int xc_tmem_save_extra(xc_interface *xch, int dom, int io_fd, int field_marker)
 }
 
 /* only called for live migration */
-void xc_tmem_save_done(xc_interface *xch, int dom)
+void xc_tmem_save_done(xc_interface *xch, uint32_t domid)
 {
-    xc_tmem_control(xch,0,XEN_SYSCTL_TMEM_OP_SAVE_END,dom,0,0,NULL);
+    xc_tmem_control(xch, 0, XEN_SYSCTL_TMEM_OP_SAVE_END, domid, 0, 0, NULL);
 }
 
 /* restore routines */
@@ -379,7 +379,7 @@ static int xc_tmem_restore_new_pool(
                            0 /* arg */, &pool);
 }
 
-int xc_tmem_restore(xc_interface *xch, int dom, int io_fd)
+int xc_tmem_restore(xc_interface *xch, uint32_t domid, int io_fd)
 {
     uint32_t minusone;
     xen_tmem_client_t info;
@@ -394,12 +394,12 @@ int xc_tmem_restore(xc_interface *xch, int dom, int io_fd)
     if ( !info.nr_pools )
         return -1;
 
-    if ( xc_tmem_control(xch,0,XEN_SYSCTL_TMEM_OP_RESTORE_BEGIN,dom,0,0,NULL) < 0 )
+    if ( xc_tmem_control(xch, 0, XEN_SYSCTL_TMEM_OP_RESTORE_BEGIN, domid, 0, 0, NULL) < 0 )
         return -1;
 
     if ( xc_tmem_control(xch, 0 /* pool_id */,
                          XEN_SYSCTL_TMEM_OP_SET_CLIENT_INFO,
-                         dom /* cli_id */, sizeof(info), 0 /* arg */,
+                         domid /* cli_id */, sizeof(info), 0 /* arg */,
                          &info) < 0 )
         return -1;
 
@@ -415,7 +415,7 @@ int xc_tmem_restore(xc_interface *xch, int dom, int io_fd)
         if ( read_exact(io_fd, &pool, sizeof(pool)) )
             goto out_memory;
 
-        if ( xc_tmem_restore_new_pool(xch, dom, pool.id, pool.flags.raw,
+        if ( xc_tmem_restore_new_pool(xch, domid, pool.id, pool.flags.raw,
                                       pool.uuid[0], pool.uuid[1]) < 0 )
             goto out_memory;
 
@@ -447,9 +447,9 @@ int xc_tmem_restore(xc_interface *xch, int dom, int io_fd)
                 goto out_memory;
 
             checksum += *buf;
-            if ( (rc = xc_tmem_control_oid(xch, pool.id,
-                                           XEN_SYSCTL_TMEM_OP_RESTORE_PUT_PAGE, dom,
-                                           bufsize, index, oid, buf)) <= 0 )
+            if ( (rc = xc_tmem_control_oid(
+                      xch, pool.id, XEN_SYSCTL_TMEM_OP_RESTORE_PUT_PAGE,
+                      domid, bufsize, index, oid, buf)) <= 0 )
             {
                 DPRINTF("xc_tmem_restore: putting page failed, rc=%d\n",rc);
  out_memory:
@@ -459,7 +459,7 @@ int xc_tmem_restore(xc_interface *xch, int dom, int io_fd)
         }
         if ( pool.n_pages )
             DPRINTF("restored %"PRId64" tmem pages for dom=%d pool=%d, check=%x\n",
-                    pool.n_pages - j, dom, pool.id, checksum);
+                    pool.n_pages - j, domid, pool.id, checksum);
     }
     free(buf);
 
@@ -467,7 +467,7 @@ int xc_tmem_restore(xc_interface *xch, int dom, int io_fd)
 }
 
 /* only called for live migration, must be called after suspend */
-int xc_tmem_restore_extra(xc_interface *xch, int dom, int io_fd)
+int xc_tmem_restore_extra(xc_interface *xch, uint32_t domid, int io_fd)
 {
     uint32_t pool_id;
     struct xen_tmem_oid oid;
@@ -481,8 +481,9 @@ int xc_tmem_restore_extra(xc_interface *xch, int dom, int io_fd)
             return -1;
         if ( read_exact(io_fd, &index, sizeof(index)) )
             return -1;
-        if ( xc_tmem_control_oid(xch, pool_id, XEN_SYSCTL_TMEM_OP_RESTORE_FLUSH_PAGE, dom,
-                             0,index,oid,NULL) <= 0 )
+        if ( xc_tmem_control_oid(
+                 xch, pool_id, XEN_SYSCTL_TMEM_OP_RESTORE_FLUSH_PAGE,
+                 domid, 0, index, oid, NULL) <= 0 )
             return -1;
         count++;
         checksum += pool_id + oid.oid[0] + oid.oid[1] + oid.oid[2] + index;
diff --git a/tools/libxc/xc_vm_event.c b/tools/libxc/xc_vm_event.c
index 443c73b..8674607 100644
--- a/tools/libxc/xc_vm_event.c
+++ b/tools/libxc/xc_vm_event.c
@@ -22,7 +22,7 @@
 
 #include "xc_private.h"
 
-int xc_vm_event_control(xc_interface *xch, domid_t domain_id, unsigned int op,
+int xc_vm_event_control(xc_interface *xch, uint32_t domain_id, unsigned int op,
                         unsigned int mode, uint32_t *port)
 {
     DECLARE_DOMCTL;
@@ -39,7 +39,7 @@ int xc_vm_event_control(xc_interface *xch, domid_t domain_id, unsigned int op,
     return rc;
 }
 
-void *xc_vm_event_enable(xc_interface *xch, domid_t domain_id, int param,
+void *xc_vm_event_enable(xc_interface *xch, uint32_t domain_id, int param,
                          uint32_t *port)
 {
     void *ring_page = NULL;
diff --git a/tools/libxc/xg_private.c b/tools/libxc/xg_private.c
index d98f282..2073dba 100644
--- a/tools/libxc/xg_private.c
+++ b/tools/libxc/xg_private.c
@@ -161,7 +161,7 @@ char *xc_inflate_buffer(xc_interface *xch,
 /*******************/
 
 int pin_table(
-    xc_interface *xch, unsigned int type, unsigned long mfn, domid_t dom)
+    xc_interface *xch, unsigned int type, unsigned long mfn, uint32_t dom)
 {
     struct mmuext_op op;
 
diff --git a/tools/libxc/xg_private.h b/tools/libxc/xg_private.h
index 175c1e5..f0a4b2c 100644
--- a/tools/libxc/xg_private.h
+++ b/tools/libxc/xg_private.h
@@ -142,6 +142,6 @@ static inline xen_pfn_t xc_pfn_to_mfn(xen_pfn_t pfn, xen_pfn_t *p2m,
 #define MADDR_MASK_X86  (MFN_MASK_X86 << PAGE_SHIFT_X86)
 
 int pin_table(xc_interface *xch, unsigned int type, unsigned long mfn,
-              domid_t dom);
+              uint32_t dom);
 
 #endif /* XG_PRIVATE_H */
