Subversion Repositories HelenOS

Rev

Rev 111 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 111 Rev 115
Line 26... Line 26...
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
#
27
#
28
 
28
 
29
.text
29
.text
30
 
30
 
31
.global atomic_inc
-
 
32
atomic_inc:
-
 
33
	pushl %ebx
-
 
34
	movl 8(%esp),%ebx
-
 
35
#ifdef __SMP__	
-
 
36
	lock incl (%ebx)
-
 
37
#else
-
 
38
	incl (%ebx)
-
 
39
#endif		
-
 
40
	popl %ebx
-
 
41
	ret
-
 
42
 
-
 
43
.global atomic_dec
-
 
44
atomic_dec:
-
 
45
	pushl %ebx
-
 
46
	movl 8(%esp),%ebx
-
 
47
#ifdef __SMP__	
-
 
48
	lock decl (%ebx)
-
 
49
#else
-
 
50
	decl (%ebx)
-
 
51
#endif
-
 
52
	popl %ebx
-
 
53
	ret
-
 
54
	
-
 
55
 
-
 
56
#ifdef __SMP__
31
#ifdef __SMP__
57
 
32
 
58
 
-
 
59
.global test_and_set
-
 
60
.global spinlock_arch
33
.global spinlock_arch
61
 
34
 
62
test_and_set:
-
 
63
	pushl %ebx
-
 
64
    
-
 
65
	movl 8(%esp),%ebx
-
 
66
	movl $1,%eax
-
 
67
	xchgl %eax,(%ebx)	# xchg implicitly turns on the LOCK signal
-
 
68
    
-
 
69
	popl %ebx
-
 
70
	ret
-
 
71
 
-
 
72
 
-
 
73
#
35
#
74
# This is a bus-and-hyperthreading-friendly implementation of spinlock 
36
# This is a bus-and-hyperthreading-friendly implementation of spinlock 
75
#
37
#
76
spinlock_arch:
38
spinlock_arch:
77
	pushl %eax
39
	pushl %eax