blob: 8c4a396e3cbc5afa99e4cf47bd7126f422437e28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <xen/vm_event.h>
#include <xen/monitor.h>
#include <asm/monitor.h>
#include <asm/vm_event.h>
#include <public/vm_event.h>
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:
*/
|