OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-ia64/] [smplock.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * <asm/smplock.h>
3
 *
4
 * Default SMP lock implementation
5
 */
6
#include <linux/interrupt.h>
7
#include <linux/spinlock.h>
8
#include <linux/sched.h>
9
 
10
#include <asm/current.h>
11
#include <asm/hardirq.h>
12
 
13
extern spinlock_t kernel_flag;
14
 
15
#define kernel_locked()         spin_is_locked(&kernel_flag)
16
 
17
/*
18
 * Release global kernel lock and global interrupt lock
19
 */
20
static __inline__ void
21
release_kernel_lock(struct task_struct *task, int cpu)
22
{
23
        if (task->lock_depth >= 0)
24
                spin_unlock(&kernel_flag);
25
        release_irqlock(cpu);
26
        __sti();
27
}
28
 
29
/*
30
 * Re-acquire the kernel lock
31
 */
32
static __inline__ void
33
reacquire_kernel_lock(struct task_struct *task)
34
{
35
        if (task->lock_depth >= 0)
36
                spin_lock(&kernel_flag);
37
}
38
 
39
/*
40
 * Getting the big kernel lock.
41
 *
42
 * This cannot happen asynchronously,
43
 * so we only need to worry about other
44
 * CPU's.
45
 */
46
static __inline__ void
47
lock_kernel(void)
48
{
49
        if (!++current->lock_depth)
50
                spin_lock(&kernel_flag);
51
}
52
 
53
static __inline__ void
54
unlock_kernel(void)
55
{
56
        if (--current->lock_depth < 0)
57
                spin_unlock(&kernel_flag);
58
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.