blob: 874764cd7294c5e9dbd15b294f50e0dd4ce751f2 (
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
|
/* $OpenBSD: atomic.h,v 1.5 2007/12/05 22:09:13 miod Exp $ */
/* Public Domain */
#ifndef __M88K_ATOMIC_H__
#define __M88K_ATOMIC_H__
#if defined(_KERNEL)
#include <machine/asm_macro.h>
#include <machine/lock.h>
#include <machine/psl.h>
#ifdef MULTIPROCESSOR
extern __cpu_simple_lock_t __atomic_lock;
#endif
static __inline void
atomic_setbits_int(__volatile unsigned int *uip, unsigned int v)
{
u_int psr;
psr = get_psr();
set_psr(psr | PSR_IND);
#ifdef MULTIPROCESSOR
__cpu_simple_lock(&__atomic_lock);
#endif
*uip |= v;
#ifdef MULTIPROCESSOR
__cpu_simple_unlock(&__atomic_lock);
#endif
set_psr(psr);
}
static __inline void
atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v)
{
u_int psr;
psr = get_psr();
set_psr(psr | PSR_IND);
#ifdef MULTIPROCESSOR
__cpu_simple_lock(&__atomic_lock);
#endif
*uip &= ~v;
#ifdef MULTIPROCESSOR
__cpu_simple_unlock(&__atomic_lock);
#endif
set_psr(psr);
}
#endif /* defined(_KERNEL) */
#endif /* __M88K_ATOMIC_H__ */
|