Coverage Report

Created: 2017-10-25 09:10

/root/src/xen/xen/arch/x86/pv/misc-hypercalls.c
Line
Count
Source (jump to first uncovered line)
1
/******************************************************************************
2
 * arch/x86/pv/misc-hypercalls.c
3
 *
4
 * Misc hypercall handlers
5
 *
6
 * Modifications to Linux original are copyright (c) 2002-2004, K A Fraser
7
 *
8
 * This program is free software; you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation; either version 2 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
#include <xen/hypercall.h>
23
24
#include <asm/debugreg.h>
25
26
long do_set_debugreg(int reg, unsigned long value)
27
0
{
28
0
    return set_debugreg(current, reg, value);
29
0
}
30
31
unsigned long do_get_debugreg(int reg)
32
0
{
33
0
    struct vcpu *curr = current;
34
0
35
0
    switch ( reg )
36
0
    {
37
0
    case 0 ... 3:
38
0
    case 6:
39
0
        return curr->arch.debugreg[reg];
40
0
    case 7:
41
0
        return (curr->arch.debugreg[7] |
42
0
                curr->arch.debugreg[5]);
43
0
    case 4 ... 5:
44
0
        return ((curr->arch.pv_vcpu.ctrlreg[4] & X86_CR4_DE) ?
45
0
                curr->arch.debugreg[reg + 2] : 0);
46
0
    }
47
0
48
0
    return -EINVAL;
49
0
}
50
51
long do_fpu_taskswitch(int set)
52
0
{
53
0
    struct vcpu *v = current;
54
0
55
0
    if ( set )
56
0
    {
57
0
        v->arch.pv_vcpu.ctrlreg[0] |= X86_CR0_TS;
58
0
        stts();
59
0
    }
60
0
    else
61
0
    {
62
0
        v->arch.pv_vcpu.ctrlreg[0] &= ~X86_CR0_TS;
63
0
        if ( v->fpu_dirtied )
64
0
            clts();
65
0
    }
66
0
67
0
    return 0;
68
0
}
69
70
/*
71
 * Local variables:
72
 * mode: C
73
 * c-file-style: "BSD"
74
 * c-basic-offset: 4
75
 * tab-width: 4
76
 * indent-tabs-mode: nil
77
 * End:
78
 */