#endif
/* Legacy hypercall (as of 0x00030202). */
-ret_t do_physdev_op_compat(XEN_GUEST_HANDLE(physdev_op_t) uop)
+ret_t do_physdev_op_compat(XEN_GUEST_HANDLE_PARAM(physdev_op_t) uop)
{
typeof(do_physdev_op) *fn =
(void *)pv_hypercall_table[__HYPERVISOR_physdev_op].native;
return ret;
}
-int microcode_update(XEN_GUEST_HANDLE_PARAM(const_void) buf, unsigned long len)
+int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len)
{
int ret;
struct ucode_buf *buffer;
{
if ( s > ctxt->s && !(s >> (paddr_bits - PAGE_SHIFT)) )
{
- e820entry_t ent;
- XEN_GUEST_HANDLE_PARAM(e820entry_t) buffer_param;
- XEN_GUEST_HANDLE(e820entry_t) buffer;
-
if ( !guest_handle_is_null(ctxt->map.buffer) )
{
+ e820entry_t ent;
+
if ( ctxt->n + 1 >= ctxt->map.nr_entries )
return -EINVAL;
ent.addr = (uint64_t)ctxt->s << PAGE_SHIFT;
ent.size = (uint64_t)(s - ctxt->s) << PAGE_SHIFT;
ent.type = E820_RESERVED;
- buffer_param = guest_handle_cast(ctxt->map.buffer, e820entry_t);
- buffer = guest_handle_from_param(buffer_param, e820entry_t);
- if ( __copy_to_guest_offset(buffer, ctxt->n, &ent, 1) )
+ if ( __copy_to_guest_offset(ctxt->map.buffer, ctxt->n, &ent, 1) )
return -EFAULT;
}
ctxt->n++;
case XENMEM_machine_memory_map:
{
struct memory_map_context ctxt;
- XEN_GUEST_HANDLE(e820entry_t) buffer;
- XEN_GUEST_HANDLE_PARAM(e820entry_t) buffer_param;
+ XEN_GUEST_HANDLE_PARAM(e820entry_t) buffer;
unsigned int i;
bool store;
if ( store && ctxt.map.nr_entries < e820.nr_map + 1 )
return -EINVAL;
- buffer_param = guest_handle_cast(ctxt.map.buffer, e820entry_t);
- buffer = guest_handle_from_param(buffer_param, e820entry_t);
+ buffer = guest_handle_cast(ctxt.map.buffer, e820entry_t);
if ( store && !guest_handle_okay(buffer, ctxt.map.nr_entries) )
return -EFAULT;
int hap_track_dirty_vram(struct domain *d,
unsigned long begin_pfn,
unsigned long nr,
- XEN_GUEST_HANDLE_PARAM(void) guest_dirty_bitmap)
+ XEN_GUEST_HANDLE(void) guest_dirty_bitmap)
{
long rc = 0;
struct sh_dirty_vram *dirty_vram;
int shadow_track_dirty_vram(struct domain *d,
unsigned long begin_pfn,
unsigned long nr,
- XEN_GUEST_HANDLE_PARAM(void) guest_dirty_bitmap)
+ XEN_GUEST_HANDLE(void) guest_dirty_bitmap)
{
int rc = 0;
unsigned long end_pfn = begin_pfn + nr;
}
else
{
- XEN_GUEST_HANDLE(const_frame_head_t) guest_head;
- XEN_GUEST_HANDLE_PARAM(const_frame_head_t) guest_head_param =
+ XEN_GUEST_HANDLE_PARAM(const_frame_head_t) guest_head =
const_guest_handle_from_ptr(head, frame_head_t);
- guest_head = guest_handle_from_param(guest_head_param,
- const_frame_head_t);
/* Also check accessibility of one struct frame_head beyond */
if (!guest_handle_okay(guest_head, 2))
guest_from_compat_handle(data, op->u.microcode.data);
- ret = microcode_update(
- guest_handle_to_param(data, const_void),
- op->u.microcode.length);
+ ret = microcode_update(data, op->u.microcode.length);
}
break;
XEN_GUEST_HANDLE(uint32) pdc;
guest_from_compat_handle(pdc, op->u.set_pminfo.u.pdc);
- ret = acpi_set_pdc_bits(
- op->u.set_pminfo.id,
- guest_handle_to_param(pdc, uint32));
+ ret = acpi_set_pdc_bits(op->u.set_pminfo.id, pdc);
}
break;
#define COMPAT
#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t)
+#define _XEN_GUEST_HANDLE_PARAM(t) XEN_GUEST_HANDLE_PARAM(t)
typedef int ret_t;
#include "../compat.c"
compat_processor_cx_t *state)
{
#define XLAT_processor_cx_HNDL_dp(_d_, _s_) do { \
- XEN_GUEST_HANDLE(compat_processor_csd_t) dps; \
- XEN_GUEST_HANDLE_PARAM(xen_processor_csd_t) dps_param; \
if ( unlikely(!compat_handle_okay((_s_)->dp, (_s_)->dpcnt)) ) \
- return -EFAULT; \
- guest_from_compat_handle(dps, (_s_)->dp); \
- dps_param = guest_handle_cast(dps, xen_processor_csd_t); \
- (_d_)->dp = guest_handle_from_param(dps_param, xen_processor_csd_t); \
+ return -EFAULT; \
+ guest_from_compat_handle((_d_)->dp, (_s_)->dp); \
} while (0)
XLAT_processor_cx(xen_state, state);
#undef XLAT_processor_cx_HNDL_dp
#include <xen/pmstat.h>
#include <compat/platform.h>
+CHECK_processor_px;
+
DEFINE_XEN_GUEST_HANDLE(compat_processor_px_t);
int
return -EFAULT;
#define XLAT_processor_performance_HNDL_states(_d_, _s_) do { \
- XEN_GUEST_HANDLE(compat_processor_px_t) states; \
- XEN_GUEST_HANDLE_PARAM(xen_processor_px_t) states_t; \
if ( unlikely(!compat_handle_okay((_s_)->states, (_s_)->state_count)) ) \
return -EFAULT; \
- guest_from_compat_handle(states, (_s_)->states); \
- states_t = guest_handle_cast(states, xen_processor_px_t); \
- (_d_)->states = guest_handle_from_param(states_t, xen_processor_px_t); \
+ guest_from_compat_handle((_d_)->states, (_s_)->states); \
} while (0)
XLAT_processor_performance(xen_perf, perf);
return ret;
}
-int acpi_set_pdc_bits(u32 acpi_id, XEN_GUEST_HANDLE_PARAM(uint32) pdc)
+int acpi_set_pdc_bits(uint32_t acpi_id, XEN_GUEST_HANDLE(uint32) pdc)
{
u32 bits[3];
int ret;
(XEN_GUEST_HANDLE_PARAM(type)) { _x }; \
})
-/* Cast a XEN_GUEST_HANDLE to XEN_GUEST_HANDLE_PARAM */
+/* Convert a XEN_GUEST_HANDLE to XEN_GUEST_HANDLE_PARAM */
#define guest_handle_to_param(hnd, type) ({ \
typeof((hnd).p) _x = (hnd).p; \
XEN_GUEST_HANDLE_PARAM(type) _y = { _x }; \
_y; \
})
-
-/* Cast a XEN_GUEST_HANDLE_PARAM to XEN_GUEST_HANDLE */
-#define guest_handle_from_param(hnd, type) ({ \
- typeof((hnd).p) _x = (hnd).p; \
- XEN_GUEST_HANDLE(type) _y = { _x }; \
- /* type checking: make sure that the pointers inside \
- * XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \
- * the same type, then return hnd */ \
- (void)(&_x == &_y.p); \
- _y; \
-})
-
#define guest_handle_for_field(hnd, type, fld) \
((XEN_GUEST_HANDLE(type)) { &(hnd).p->fld })
(XEN_GUEST_HANDLE_PARAM(type)) { _x }; \
})
-/* Cast a XEN_GUEST_HANDLE to XEN_GUEST_HANDLE_PARAM */
+/* Convert a XEN_GUEST_HANDLE to XEN_GUEST_HANDLE_PARAM */
#define guest_handle_to_param(hnd, type) ({ \
/* type checking: make sure that the pointers inside \
* XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \
(hnd); \
})
-/* Cast a XEN_GUEST_HANDLE_PARAM to XEN_GUEST_HANDLE */
-#define guest_handle_from_param(hnd, type) ({ \
- /* type checking: make sure that the pointers inside \
- * XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \
- * the same type, then return hnd */ \
- (void)((typeof(&(hnd).p)) 0 == \
- (typeof(&((XEN_GUEST_HANDLE_PARAM(type)) {}).p)) 0); \
- (hnd); \
-})
-
#define guest_handle_for_field(hnd, type, fld) \
((XEN_GUEST_HANDLE(type)) { &(hnd).p->fld })
int hap_track_dirty_vram(struct domain *d,
unsigned long begin_pfn,
unsigned long nr,
- XEN_GUEST_HANDLE_PARAM(void) dirty_bitmap);
+ XEN_GUEST_HANDLE(void) dirty_bitmap);
extern const struct paging_mode *hap_paging_get_mode(struct vcpu *);
int hap_set_allocation(struct domain *d, unsigned int pages, bool *preempted);
DECLARE_PER_CPU(struct cpu_signature, cpu_sig);
void microcode_set_module(unsigned int idx);
-int microcode_update(XEN_GUEST_HANDLE_PARAM(const_void), unsigned long len);
+int microcode_update(XEN_GUEST_HANDLE(const_void), unsigned long len);
int early_microcode_init(void);
int microcode_update_one(bool start_update);
int shadow_track_dirty_vram(struct domain *d,
unsigned long first_pfn,
unsigned long nr,
- XEN_GUEST_HANDLE_PARAM(void) dirty_bitmap);
+ XEN_GUEST_HANDLE(void) dirty_bitmap);
/* Handler for shadow control ops: operations from user-space to enable
* and disable ephemeral shadow modes (test mode and log-dirty mode) and
static inline void acpi_set_csubstate_limit(unsigned int new_limit) { return; }
#endif
-#ifdef XEN_GUEST_HANDLE_PARAM
-int acpi_set_pdc_bits(u32 acpi_id, XEN_GUEST_HANDLE_PARAM(uint32));
+#ifdef XEN_GUEST_HANDLE
+int acpi_set_pdc_bits(uint32_t acpi_id, XEN_GUEST_HANDLE(uint32));
#endif
int arch_acpi_set_pdc_bits(u32 acpi_id, u32 *, u32 mask);