/* * arch/arm/monitor.c * * Arch-specific monitor_op domctl handler. * * Copyright (c) 2016 Tamas K Lengyel (tamas.lengyel@zentific.com) * * 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 . */ #include #include #include #include #include int arch_monitor_domctl_event(struct domain *d, struct xen_domctl_monitor_op *mop) { struct arch_domain *ad = &d->arch; bool requested_status = (XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op); switch ( mop->event ) { case XEN_DOMCTL_MONITOR_EVENT_PRIVILEGED_CALL: { bool old_status = ad->monitor.privileged_call_enabled; if ( unlikely(old_status == requested_status) ) return -EEXIST; domain_pause(d); ad->monitor.privileged_call_enabled = requested_status; domain_unpause(d); break; } default: /* * Should not be reached unless arch_monitor_get_capabilities() is * not properly implemented. */ ASSERT_UNREACHABLE(); return -EOPNOTSUPP; } return 0; } int monitor_smc(void) { vm_event_request_t req = { .reason = VM_EVENT_REASON_PRIVILEGED_CALL }; return monitor_traps(current, 1, &req); } /* * Local variables: * mode: C * c-file-style: "BSD" * c-basic-offset: 4 * indent-tabs-mode: nil * End: */