The function vm_event_monitor_traps actually belongs in the monitor subsystem.
As part of this patch we fix the sync input's type to bool_t to match how
the callers use it.
Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
*/
#include <xen/vm_event.h>
+#include <xen/monitor.h>
#include <asm/hvm/monitor.h>
#include <asm/monitor.h>
#include <asm/vm_event.h>
.u.write_ctrlreg.old_value = old
};
- if ( vm_event_monitor_traps(curr, sync, &req) >= 0 )
+ if ( monitor_traps(curr, sync, &req) >= 0 )
return 1;
}
.u.mov_to_msr.value = value,
};
- vm_event_monitor_traps(curr, 1, &req);
+ monitor_traps(curr, 1, &req);
}
}
req.vcpu_id = curr->vcpu_id;
- return vm_event_monitor_traps(curr, sync, &req);
+ return monitor_traps(curr, sync, &req);
}
/*
* License along with this program; If not, see <http://www.gnu.org/licenses/>.
*/
+#include <xen/event.h>
#include <xen/monitor.h>
#include <xen/sched.h>
#include <xen/vm_event.h>
#include <xsm/xsm.h>
#include <public/domctl.h>
+#include <asm/altp2m.h>
#include <asm/monitor.h>
+#include <asm/vm_event.h>
int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
{
return 0;
}
+int monitor_traps(struct vcpu *v, bool_t sync, vm_event_request_t *req)
+{
+ int rc;
+ struct domain *d = v->domain;
+
+ rc = vm_event_claim_slot(d, &d->vm_event->monitor);
+ switch ( rc )
+ {
+ case 0:
+ break;
+ case -ENOSYS:
+ /*
+ * If there was no ring to handle the event, then
+ * simply continue executing normally.
+ */
+ return 0;
+ default:
+ return rc;
+ };
+
+ if ( sync )
+ {
+ req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+ vm_event_vcpu_pause(v);
+ rc = 1;
+ }
+
+ if ( altp2m_active(d) )
+ {
+ req->flags |= VM_EVENT_FLAG_ALTERNATE_P2M;
+ req->altp2m_idx = altp2m_vcpu_idx(v);
+ }
+
+ vm_event_fill_regs(req);
+ vm_event_put_request(d, &d->vm_event->monitor, req);
+
+ return rc;
+}
+
void monitor_guest_request(void)
{
struct vcpu *curr = current;
.vcpu_id = curr->vcpu_id,
};
- vm_event_monitor_traps(curr, d->monitor.guest_request_sync, &req);
+ monitor_traps(curr, d->monitor.guest_request_sync, &req);
}
}
#include <xen/vm_event.h>
#include <xen/mem_access.h>
#include <asm/p2m.h>
-#include <asm/altp2m.h>
#include <asm/monitor.h>
#include <asm/vm_event.h>
#include <xsm/xsm.h>
vcpu_unpause(v);
}
-/*
- * Monitor vm-events
- */
-
-int vm_event_monitor_traps(struct vcpu *v, uint8_t sync,
- vm_event_request_t *req)
-{
- int rc;
- struct domain *d = v->domain;
-
- rc = vm_event_claim_slot(d, &d->vm_event->monitor);
- switch ( rc )
- {
- case 0:
- break;
- case -ENOSYS:
- /*
- * If there was no ring to handle the event, then
- * simply continue executing normally.
- */
- return 0;
- default:
- return rc;
- };
-
- if ( sync )
- {
- req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
- vm_event_vcpu_pause(v);
- rc = 1;
- }
-
- if ( altp2m_active(d) )
- {
- req->flags |= VM_EVENT_FLAG_ALTERNATE_P2M;
- req->altp2m_idx = altp2m_vcpu_idx(v);
- }
-
- vm_event_fill_regs(req);
- vm_event_put_request(d, &d->vm_event->monitor, req);
-
- return rc;
-}
-
/*
* Local variables:
* mode: C
*
* Common monitor_op domctl handler.
*
- * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
+ * Copyright (c) 2015-2016 Tamas K Lengyel (tamas@tklengyel.com)
* Copyright (c) 2016, Bitdefender S.R.L.
*
* This program is free software; you can redistribute it and/or
#ifndef __XEN_MONITOR_H__
#define __XEN_MONITOR_H__
+#include <public/vm_event.h>
+
struct domain;
struct xen_domctl_monitor_op;
int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *op);
void monitor_guest_request(void);
+int monitor_traps(struct vcpu *v, bool_t sync, vm_event_request_t *req);
+
#endif /* __XEN_MONITOR_H__ */
void vm_event_vcpu_pause(struct vcpu *v);
void vm_event_vcpu_unpause(struct vcpu *v);
-/*
- * Monitor vm-events
- */
-int vm_event_monitor_traps(struct vcpu *v, uint8_t sync,
- vm_event_request_t *req);
-
#endif /* __VM_EVENT_H__ */