@@ -36,7 +36,7 @@ obj-y += microcode_intel.o
# This must come after the vendor specific files.
obj-y += microcode.o
obj-y += mm.o x86_64/mm.o
-obj-y += monitor_x86.o
+obj-y += monitor.o
obj-y += mpparse.o
obj-y += nmi.o
obj-y += numa.o
new file mode 100644
@@ -0,0 +1,72 @@
+/*
+ * arch/x86/monitor.c
+ *
+ * Arch-specific monitor_op domctl handler.
+ *
+ * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
+ * Copyright (c) 2016, Bitdefender S.R.L.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <asm/monitor.h>
+
+bool_t arch_monitor_domctl_event(struct domain *d,
+ struct xen_domctl_monitor_op *mop,
+ int *rc)
+{
+ struct arch_domain *ad = &d->arch;
+ bool_t requested_status = (XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op);
+
+ switch ( mop->event )
+ {
+ case XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR:
+ {
+ bool_t old_status = ad->monitor.mov_to_msr_enabled;
+
+ if ( unlikely(old_status == requested_status) )
+ return -EEXIST;
+
+ if ( XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op &&
+ mop->u.mov_to_msr.extended_capture &&
+ !hvm_enable_msr_exit_interception(d) )
+ return -EOPNOTSUPP;
+
+ domain_pause(d);
+
+ if ( XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op &&
+ mop->u.mov_to_msr.extended_capture )
+ ad->monitor.mov_to_msr_extended = 1;
+ else
+ ad->monitor.mov_to_msr_extended = 0;
+
+ ad->monitor.mov_to_msr_enabled = !old_status;
+ domain_unpause(d);
+ break;
+ }
+
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
deleted file mode 100644
@@ -1,72 +0,0 @@
-/*
- * arch/x86/monitor_x86.c
- *
- * Arch-specific monitor_op domctl handler.
- *
- * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
- * Copyright (c) 2016, Bitdefender S.R.L.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License v2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <asm/monitor_arch.h>
-
-bool_t arch_monitor_domctl_event(struct domain *d,
- struct xen_domctl_monitor_op *mop,
- int *rc)
-{
- struct arch_domain *ad = &d->arch;
- bool_t requested_status = (XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op);
-
- switch ( mop->event )
- {
- case XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR:
- {
- bool_t old_status = ad->monitor.mov_to_msr_enabled;
-
- if ( unlikely(old_status == requested_status) )
- return -EEXIST;
-
- if ( XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op &&
- mop->u.mov_to_msr.extended_capture &&
- !hvm_enable_msr_exit_interception(d) )
- return -EOPNOTSUPP;
-
- domain_pause(d);
-
- if ( XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op &&
- mop->u.mov_to_msr.extended_capture )
- ad->monitor.mov_to_msr_extended = 1;
- else
- ad->monitor.mov_to_msr_extended = 0;
-
- ad->monitor.mov_to_msr_enabled = !old_status;
- domain_unpause(d);
- break;
- }
-
- default:
- return 0;
- }
-
- return 1;
-}
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
@@ -25,7 +25,7 @@
#include <xsm/xsm.h>
#include <public/domctl.h>
-#include <asm/monitor_arch.h> /* for monitor_arch_# */
+#include <asm/monitor.h> /* for monitor_arch_# */
#if CONFIG_X86
#include <public/vm_event.h> /* for VM_EVENT_X86_CR3 */
new file mode 100644
@@ -0,0 +1,53 @@
+/*
+ * include/asm-arm/monitor.h
+ *
+ * Arch-specific monitor_op domctl handler.
+ *
+ * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
+ * Copyright (c) 2016, Bitdefender S.R.L.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __ASM_ARM_MONITOR_H__
+#define __ASM_ARM_MONITOR_H__
+
+#include <xen/sched.h>
+#include <public/domctl.h>
+
+static inline
+uint32_t arch_monitor_get_capabilities(struct domain *d)
+{
+ /* No monitor vm-events implemented on ARM. */
+ return 0;
+}
+
+static inline
+bool_t arch_monitor_domctl_op(struct domain *d,
+ struct xen_domctl_monitor_op *mop,
+ int *rc)
+{
+ /* No arch-specific monitor ops on ARM. */
+ return 0;
+}
+
+static inline
+bool_t arch_monitor_domctl_event(struct domain *d,
+ struct xen_domctl_monitor_op *mop,
+ int *rc)
+{
+ /* No arch-specific monitor vm-events on ARM. */
+ return 0;
+}
+
+#endif /* __ASM_ARM_MONITOR_H__ */
deleted file mode 100644
@@ -1,53 +0,0 @@
-/*
- * include/asm-arm/monitor_arch.h
- *
- * Arch-specific monitor_op domctl handler.
- *
- * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
- * Copyright (c) 2016, Bitdefender S.R.L.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License v2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __ASM_ARM_MONITOR_ARCH_H__
-#define __ASM_ARM_MONITOR_ARCH_H__
-
-#include <xen/sched.h>
-#include <public/domctl.h>
-
-static inline
-uint32_t arch_monitor_get_capabilities(struct domain *d)
-{
- /* No monitor vm-events implemented on ARM. */
- return 0;
-}
-
-static inline
-bool_t arch_monitor_domctl_op(struct domain *d,
- struct xen_domctl_monitor_op *mop,
- int *rc)
-{
- /* No arch-specific monitor ops on ARM. */
- return 0;
-}
-
-static inline
-bool_t arch_monitor_domctl_event(struct domain *d,
- struct xen_domctl_monitor_op *mop,
- int *rc)
-{
- /* No arch-specific monitor vm-events on ARM. */
- return 0;
-}
-
-#endif /* __ASM_ARM_MONITOR_ARCH_H__ */
new file mode 100644
@@ -0,0 +1,74 @@
+/*
+ * include/asm-x86/monitor.h
+ *
+ * Arch-specific monitor_op domctl handler.
+ *
+ * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
+ * Copyright (c) 2016, Bitdefender S.R.L.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __ASM_X86_MONITOR_H__
+#define __ASM_X86_MONITOR_H__
+
+#include <xen/sched.h> /* for struct domain, is_hvm_domain, ... */
+#include <public/domctl.h> /* for XEN_DOMCTL_MONITOR_#, ... */
+#include <asm/cpufeature.h> /* for cpu_has_vmx */
+#include <asm/hvm/hvm.h> /* for hvm_is_singlestep_supported */
+
+static inline
+uint32_t arch_monitor_get_capabilities(struct domain *d)
+{
+ uint32_t capabilities = 0;
+
+ /*
+ * At the moment only Intel HVM domains are supported. However, event
+ * delivery could be extended to AMD and PV domains.
+ */
+ if ( !is_hvm_domain(d) || !cpu_has_vmx )
+ return capabilities;
+
+ capabilities = (1 << XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG) |
+ (1 << XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR) |
+ (1 << XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT) |
+ (1 << XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST);
+
+ /* Since we know this is on VMX, we can just call the hvm func */
+ if ( hvm_is_singlestep_supported() )
+ capabilities |= (1 << XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP);
+
+ return capabilities;
+}
+
+static inline
+bool_t arch_monitor_domctl_op(struct domain *d,
+ struct xen_domctl_monitor_op *mop,
+ int *rc)
+{
+ if( likely(XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP == mop->op) )
+ {
+ domain_pause(d);
+ d->arch.mem_access_emulate_each_rep = !!mop->event;
+ domain_unpause(d);
+ *rc = 0;
+ return 1;
+ }
+ return 0;
+}
+
+bool_t arch_monitor_domctl_event(struct domain *d,
+ struct xen_domctl_monitor_op *mop,
+ int *rc);
+
+#endif /* __ASM_X86_MONITOR_H__ */
deleted file mode 100644
@@ -1,74 +0,0 @@
-/*
- * include/asm-x86/monitor_arch.h
- *
- * Arch-specific monitor_op domctl handler.
- *
- * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
- * Copyright (c) 2016, Bitdefender S.R.L.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License v2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __ASM_X86_MONITOR_ARCH_H__
-#define __ASM_X86_MONITOR_ARCH_H__
-
-#include <xen/sched.h> /* for struct domain, is_hvm_domain, ... */
-#include <public/domctl.h> /* for XEN_DOMCTL_MONITOR_#, ... */
-#include <asm/cpufeature.h> /* for cpu_has_vmx */
-#include <asm/hvm/hvm.h> /* for hvm_is_singlestep_supported */
-
-static inline
-uint32_t arch_monitor_get_capabilities(struct domain *d)
-{
- uint32_t capabilities = 0;
-
- /*
- * At the moment only Intel HVM domains are supported. However, event
- * delivery could be extended to AMD and PV domains.
- */
- if ( !is_hvm_domain(d) || !cpu_has_vmx )
- return capabilities;
-
- capabilities = (1 << XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG) |
- (1 << XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR) |
- (1 << XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT) |
- (1 << XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST);
-
- /* Since we know this is on VMX, we can just call the hvm func */
- if ( hvm_is_singlestep_supported() )
- capabilities |= (1 << XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP);
-
- return capabilities;
-}
-
-static inline
-bool_t arch_monitor_domctl_op(struct domain *d,
- struct xen_domctl_monitor_op *mop,
- int *rc)
-{
- if( likely(XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP == mop->op) )
- {
- domain_pause(d);
- d->arch.mem_access_emulate_each_rep = !!mop->event;
- domain_unpause(d);
- *rc = 0;
- return 1;
- }
- return 0;
-}
-
-bool_t arch_monitor_domctl_event(struct domain *d,
- struct xen_domctl_monitor_op *mop,
- int *rc);
-
-#endif /* __ASM_X86_MONITOR_ARCH_H__ */
(last commit before this one explains why this was necessary) Signed-off-by: Corneliu ZUZU <czuzu@bitdefender.com> --- xen/arch/x86/Makefile | 2 +- xen/arch/x86/monitor.c | 72 +++++++++++++++++++++++++++++++++++++ xen/arch/x86/monitor_x86.c | 72 ------------------------------------- xen/common/monitor.c | 2 +- xen/include/asm-arm/monitor.h | 53 +++++++++++++++++++++++++++ xen/include/asm-arm/monitor_arch.h | 53 --------------------------- xen/include/asm-x86/monitor.h | 74 ++++++++++++++++++++++++++++++++++++++ xen/include/asm-x86/monitor_arch.h | 74 -------------------------------------- 8 files changed, 201 insertions(+), 201 deletions(-) create mode 100644 xen/arch/x86/monitor.c delete mode 100644 xen/arch/x86/monitor_x86.c create mode 100644 xen/include/asm-arm/monitor.h delete mode 100644 xen/include/asm-arm/monitor_arch.h create mode 100644 xen/include/asm-x86/monitor.h delete mode 100644 xen/include/asm-x86/monitor_arch.h