Coverage Report

Created: 2017-10-25 09:10

/root/src/xen/xen/common/preempt.c
Line
Count
Source (jump to first uncovered line)
1
/******************************************************************************
2
 * preempt.c
3
 * 
4
 * Track atomic regions in the hypervisor which disallow sleeping.
5
 * 
6
 * Copyright (c) 2010, Keir Fraser <keir@xen.org>
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/preempt.h>
23
#include <xen/irq.h>
24
#include <asm/system.h>
25
26
DEFINE_PER_CPU(unsigned int, __preempt_count);
27
28
bool_t in_atomic(void)
29
0
{
30
0
    return preempt_count() || in_irq() || !local_irq_is_enabled();
31
0
}
32
33
#ifndef NDEBUG
34
void ASSERT_NOT_IN_ATOMIC(void)
35
20.3M
{
36
20.3M
    ASSERT(!preempt_count());
37
20.3M
    ASSERT(!in_irq());
38
20.3M
    ASSERT(local_irq_is_enabled());
39
20.3M
}
40
#endif