2008-05-20 03:53:02 +04:00
/ *
2005-04-17 02:20:36 +04:00
* locks. S : S M P l o w - l e v e l l o c k p r i m i t i v e s o n S p a r c .
*
* Copyright ( C ) 1 9 9 6 D a v i d S . M i l l e r ( d a v e m @caip.rutgers.edu)
* Copyright ( C ) 1 9 9 8 A n t o n B l a n c h a r d ( a n t o n @progsoc.uts.edu.au)
* Copyright ( C ) 1 9 9 8 J a k u b J e l i n e k ( j j @ultra.linux.cz)
* /
# include < a s m / p t r a c e . h >
# include < a s m / p s r . h >
# include < a s m / s m p . h >
# include < a s m / s p i n l o c k . h >
.text
.align 4
/ * Read/ w r i t e r l o c k s , a s u s u a l t h i s i s o v e r l y c l e v e r t o m a k e i t
* as f a s t a s p o s s i b l e .
* /
/* caches... */
___rw_read_enter_spin_on_wlock :
orcc % g 2 , 0 x0 , % g 0
be,a _ _ _ r w _ r e a d _ e n t e r
ldstub [ % g 1 + 3 ] , % g 2
b _ _ _ r w _ r e a d _ e n t e r _ s p i n _ o n _ w l o c k
ldub [ % g 1 + 3 ] , % g 2
2006-10-08 17:32:15 +04:00
___rw_read_try_spin_on_wlock :
andcc % g 2 , 0 x f f , % g 0
be,a _ _ _ r w _ r e a d _ t r y
ldstub [ % g 1 + 3 ] , % g 2
xnorcc % g 2 , 0 x0 , % o 0 / * i f g 2 i s ~ 0 , s e t o 0 t o 0 a n d b u g g e r o f f * /
bne,a _ _ _ r w _ r e a d _ e n t e r _ s p i n _ o n _ w l o c k
ld [ % g 1 ] , % g 2
retl
mov % g 4 , % o 7
2005-04-17 02:20:36 +04:00
___rw_read_exit_spin_on_wlock :
orcc % g 2 , 0 x0 , % g 0
be,a _ _ _ r w _ r e a d _ e x i t
ldstub [ % g 1 + 3 ] , % g 2
b _ _ _ r w _ r e a d _ e x i t _ s p i n _ o n _ w l o c k
ldub [ % g 1 + 3 ] , % g 2
___rw_write_enter_spin_on_wlock :
orcc % g 2 , 0 x0 , % g 0
be,a _ _ _ r w _ w r i t e _ e n t e r
ldstub [ % g 1 + 3 ] , % g 2
b _ _ _ r w _ w r i t e _ e n t e r _ s p i n _ o n _ w l o c k
ld [ % g 1 ] , % g 2
.globl ___rw_read_enter
___rw_read_enter :
orcc % g 2 , 0 x0 , % g 0
bne,a _ _ _ r w _ r e a d _ e n t e r _ s p i n _ o n _ w l o c k
ldub [ % g 1 + 3 ] , % g 2
ld [ % g 1 ] , % g 2
add % g 2 , 1 , % g 2
st % g 2 , [ % g 1 ]
retl
mov % g 4 , % o 7
.globl ___rw_read_exit
___rw_read_exit :
orcc % g 2 , 0 x0 , % g 0
bne,a _ _ _ r w _ r e a d _ e x i t _ s p i n _ o n _ w l o c k
ldub [ % g 1 + 3 ] , % g 2
ld [ % g 1 ] , % g 2
sub % g 2 , 0 x1 f f , % g 2
st % g 2 , [ % g 1 ]
retl
mov % g 4 , % o 7
2006-10-08 17:32:15 +04:00
.globl ___rw_read_try
___rw_read_try :
orcc % g 2 , 0 x0 , % g 0
bne _ _ _ r w _ r e a d _ t r y _ s p i n _ o n _ w l o c k
ld [ % g 1 ] , % g 2
add % g 2 , 1 , % g 2
st % g 2 , [ % g 1 ]
set 1 , % o 1
retl
mov % g 4 , % o 7
2005-04-17 02:20:36 +04:00
.globl ___rw_write_enter
___rw_write_enter :
orcc % g 2 , 0 x0 , % g 0
bne _ _ _ r w _ w r i t e _ e n t e r _ s p i n _ o n _ w l o c k
ld [ % g 1 ] , % g 2
andncc % g 2 , 0 x f f , % g 0
bne,a _ _ _ r w _ w r i t e _ e n t e r _ s p i n _ o n _ w l o c k
stb % g 0 , [ % g 1 + 3 ]
retl
mov % g 4 , % o 7