Coverage Report

Created: 2017-10-25 09:10

/root/src/xen/xen/include/asm/pv/traps.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * pv/traps.h
3
 *
4
 * PV guest traps interface definitions
5
 *
6
 * Copyright (C) 2017 Wei Liu <wei.liu2@citrix.com>
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms and conditions of the GNU General Public
10
 * License, version 2, as published by the Free Software Foundation.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public
18
 * License along with this program; If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#ifndef __X86_PV_TRAPS_H__
22
#define __X86_PV_TRAPS_H__
23
24
#ifdef CONFIG_PV
25
26
#include <public/xen.h>
27
28
void pv_trap_init(void);
29
30
/* Deliver interrupt to PV guest. Return 0 on success. */
31
int pv_raise_interrupt(struct vcpu *v, uint8_t vector);
32
33
int pv_emulate_privileged_op(struct cpu_user_regs *regs);
34
void pv_emulate_gate_op(struct cpu_user_regs *regs);
35
bool pv_emulate_invalid_op(struct cpu_user_regs *regs);
36
37
static inline bool pv_trap_callback_registered(const struct vcpu *v,
38
                                               uint8_t vector)
39
0
{
40
0
    return v->arch.pv_vcpu.trap_ctxt[vector].address;
41
0
}
Unexecuted instantiation: traps.c:pv_trap_callback_registered
Unexecuted instantiation: vmce.c:pv_trap_callback_registered
Unexecuted instantiation: emul-gate-op.c:pv_trap_callback_registered
Unexecuted instantiation: emul-inv-op.c:pv_trap_callback_registered
Unexecuted instantiation: emul-priv-op.c:pv_trap_callback_registered
42
43
#else  /* !CONFIG_PV */
44
45
#include <xen/errno.h>
46
47
static inline void pv_trap_init(void) {}
48
49
/* Deliver interrupt to PV guest. Return 0 on success. */
50
static int pv_raise_interrupt(struct vcpu *v, uint8_t vector) { return -EOPNOTSUPP; }
51
52
static inline int pv_emulate_privileged_op(struct cpu_user_regs *regs) { return 0; }
53
static inline void pv_emulate_gate_op(struct cpu_user_regs *regs) {}
54
static inline bool pv_emulate_invalid_op(struct cpu_user_regs *regs) { return true; }
55
56
static inline bool pv_trap_callback_registered(const struct vcpu *v,
57
                                               uint8_t vector)
58
{
59
    return false;
60
}
61
#endif /* CONFIG_PV */
62
63
#endif /* __X86_PV_TRAPS_H__ */
64
65
/*
66
 * Local variables:
67
 * mode: C
68
 * c-file-style: "BSD"
69
 * c-basic-offset: 4
70
 * tab-width: 4
71
 * indent-tabs-mode: nil
72
 * End:
73
 */