Linux Audio

Check our new training course

Loading...
v3.5.6
 1/*
 2 * locks.S: SMP low-level lock primitives on Sparc.
 3 *
 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
 5 * Copyright (C) 1998 Anton Blanchard (anton@progsoc.uts.edu.au)
 6 * Copyright (C) 1998 Jakub Jelinek   (jj@ultra.linux.cz)
 7 */
 8
 9#include <asm/ptrace.h>
10#include <asm/psr.h>
11#include <asm/smp.h>
12#include <asm/spinlock.h>
 
13
14	.text
15	.align	4
16
17	/* Read/writer locks, as usual this is overly clever to make it
18	 * as fast as possible.
19	 */
20
21	/* caches... */
22___rw_read_enter_spin_on_wlock:
23	orcc	%g2, 0x0, %g0
24	be,a	___rw_read_enter
25	 ldstub	[%g1 + 3], %g2
26	b	___rw_read_enter_spin_on_wlock
27	 ldub	[%g1 + 3], %g2
28___rw_read_try_spin_on_wlock:
29	andcc	%g2, 0xff, %g0
30	be,a	___rw_read_try
31	 ldstub	[%g1 + 3], %g2
32	xnorcc	%g2, 0x0, %o0	/* if g2 is ~0, set o0 to 0 and bugger off */
33	bne,a	___rw_read_enter_spin_on_wlock
34	 ld	[%g1], %g2
35	retl
36	 mov	%g4, %o7
37___rw_read_exit_spin_on_wlock:
38	orcc	%g2, 0x0, %g0
39	be,a	___rw_read_exit
40	 ldstub	[%g1 + 3], %g2
41	b	___rw_read_exit_spin_on_wlock
42	 ldub	[%g1 + 3], %g2
43___rw_write_enter_spin_on_wlock:
44	orcc	%g2, 0x0, %g0
45	be,a	___rw_write_enter
46	 ldstub	[%g1 + 3], %g2
47	b	___rw_write_enter_spin_on_wlock
48	 ld	[%g1], %g2
49
50	.globl	___rw_read_enter
 
51___rw_read_enter:
52	orcc	%g2, 0x0, %g0
53	bne,a	___rw_read_enter_spin_on_wlock
54	 ldub	[%g1 + 3], %g2
55	ld	[%g1], %g2
56	add	%g2, 1, %g2
57	st	%g2, [%g1]
58	retl
59	 mov	%g4, %o7
60
61	.globl	___rw_read_exit
 
62___rw_read_exit:
63	orcc	%g2, 0x0, %g0
64	bne,a	___rw_read_exit_spin_on_wlock
65	 ldub	[%g1 + 3], %g2
66	ld	[%g1], %g2
67	sub	%g2, 0x1ff, %g2
68	st	%g2, [%g1]
69	retl
70	 mov	%g4, %o7
71
72	.globl	___rw_read_try
 
73___rw_read_try:
74	orcc	%g2, 0x0, %g0
75	bne	___rw_read_try_spin_on_wlock
76	 ld	[%g1], %g2
77	add	%g2, 1, %g2
78	st	%g2, [%g1]
79	set	1, %o1
80	retl
81	 mov	%g4, %o7
82
83	.globl	___rw_write_enter
 
84___rw_write_enter:
85	orcc	%g2, 0x0, %g0
86	bne	___rw_write_enter_spin_on_wlock
87	 ld	[%g1], %g2
88	andncc	%g2, 0xff, %g0
89	bne,a	___rw_write_enter_spin_on_wlock
90	 stb	%g0, [%g1 + 3]
91	retl
92	 mov	%g4, %o7
v4.10.11
 1/*
 2 * locks.S: SMP low-level lock primitives on Sparc.
 3 *
 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
 5 * Copyright (C) 1998 Anton Blanchard (anton@progsoc.uts.edu.au)
 6 * Copyright (C) 1998 Jakub Jelinek   (jj@ultra.linux.cz)
 7 */
 8
 9#include <asm/ptrace.h>
10#include <asm/psr.h>
11#include <asm/smp.h>
12#include <asm/spinlock.h>
13#include <asm/export.h>
14
15	.text
16	.align	4
17
18	/* Read/writer locks, as usual this is overly clever to make it
19	 * as fast as possible.
20	 */
21
22	/* caches... */
23___rw_read_enter_spin_on_wlock:
24	orcc	%g2, 0x0, %g0
25	be,a	___rw_read_enter
26	 ldstub	[%g1 + 3], %g2
27	b	___rw_read_enter_spin_on_wlock
28	 ldub	[%g1 + 3], %g2
29___rw_read_try_spin_on_wlock:
30	andcc	%g2, 0xff, %g0
31	be,a	___rw_read_try
32	 ldstub	[%g1 + 3], %g2
33	xnorcc	%g2, 0x0, %o0	/* if g2 is ~0, set o0 to 0 and bugger off */
34	bne,a	___rw_read_enter_spin_on_wlock
35	 ld	[%g1], %g2
36	retl
37	 mov	%g4, %o7
38___rw_read_exit_spin_on_wlock:
39	orcc	%g2, 0x0, %g0
40	be,a	___rw_read_exit
41	 ldstub	[%g1 + 3], %g2
42	b	___rw_read_exit_spin_on_wlock
43	 ldub	[%g1 + 3], %g2
44___rw_write_enter_spin_on_wlock:
45	orcc	%g2, 0x0, %g0
46	be,a	___rw_write_enter
47	 ldstub	[%g1 + 3], %g2
48	b	___rw_write_enter_spin_on_wlock
49	 ld	[%g1], %g2
50
51	.globl	___rw_read_enter
52EXPORT_SYMBOL(___rw_read_enter)
53___rw_read_enter:
54	orcc	%g2, 0x0, %g0
55	bne,a	___rw_read_enter_spin_on_wlock
56	 ldub	[%g1 + 3], %g2
57	ld	[%g1], %g2
58	add	%g2, 1, %g2
59	st	%g2, [%g1]
60	retl
61	 mov	%g4, %o7
62
63	.globl	___rw_read_exit
64EXPORT_SYMBOL(___rw_read_exit)
65___rw_read_exit:
66	orcc	%g2, 0x0, %g0
67	bne,a	___rw_read_exit_spin_on_wlock
68	 ldub	[%g1 + 3], %g2
69	ld	[%g1], %g2
70	sub	%g2, 0x1ff, %g2
71	st	%g2, [%g1]
72	retl
73	 mov	%g4, %o7
74
75	.globl	___rw_read_try
76EXPORT_SYMBOL(___rw_read_try)
77___rw_read_try:
78	orcc	%g2, 0x0, %g0
79	bne	___rw_read_try_spin_on_wlock
80	 ld	[%g1], %g2
81	add	%g2, 1, %g2
82	st	%g2, [%g1]
83	set	1, %o1
84	retl
85	 mov	%g4, %o7
86
87	.globl	___rw_write_enter
88EXPORT_SYMBOL(___rw_write_enter)
89___rw_write_enter:
90	orcc	%g2, 0x0, %g0
91	bne	___rw_write_enter_spin_on_wlock
92	 ld	[%g1], %g2
93	andncc	%g2, 0xff, %g0
94	bne,a	___rw_write_enter_spin_on_wlock
95	 stb	%g0, [%g1 + 3]
96	retl
97	 mov	%g4, %o7