Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
4e8fd22b
Commit
4e8fd22b
authored
Jul 24, 2005
by
Russell King
Committed by
Russell King
Jul 24, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] ARM SMP: Fix ARMv6 spinlock and semaphore implementations
Signed-off-by:
Russell King
<
rmk+kernel@arm.linux.org.uk
>
parent
2c2a68b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
18 deletions
+21
-18
include/asm-arm/locks.h
include/asm-arm/locks.h
+2
-2
include/asm-arm/spinlock.h
include/asm-arm/spinlock.h
+19
-16
No files found.
include/asm-arm/locks.h
View file @
4e8fd22b
...
...
@@ -61,7 +61,7 @@
" strex ip, lr, [%0]\n" \
" teq ip, #0\n" \
" bne 1b\n" \
"
teq
lr, #0\n" \
"
cmp
lr, #0\n" \
" movle ip, %0\n" \
" blle " #wake \
: \
...
...
@@ -100,7 +100,7 @@
__asm__ __volatile__( \
"@ up_op_read\n" \
"1: ldrex lr, [%0]\n" \
" add lr, lr, %1\n" \
" add
s
lr, lr, %1\n" \
" strex ip, lr, [%0]\n" \
" teq ip, #0\n" \
" bne 1b\n" \
...
...
include/asm-arm/spinlock.h
View file @
4e8fd22b
...
...
@@ -79,7 +79,8 @@ typedef struct {
}
rwlock_t
;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
#define rwlock_init(x) do { *(x) + RW_LOCK_UNLOCKED; } while (0)
#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while (0)
#define rwlock_is_locked(x) (*((volatile unsigned int *)(x)) != 0)
/*
* Write locks are easy - we just set bit 31. When unlocking, we can
...
...
@@ -100,6 +101,21 @@ static inline void _raw_write_lock(rwlock_t *rw)
:
"cc"
,
"memory"
);
}
static
inline
int
_raw_write_trylock
(
rwlock_t
*
rw
)
{
unsigned
long
tmp
;
__asm__
__volatile__
(
"1: ldrex %0, [%1]
\n
"
" teq %0, #0
\n
"
" strexeq %0, %2, [%1]"
:
"=&r"
(
tmp
)
:
"r"
(
&
rw
->
lock
),
"r"
(
0x80000000
)
:
"cc"
,
"memory"
);
return
tmp
==
0
;
}
static
inline
void
_raw_write_unlock
(
rwlock_t
*
rw
)
{
__asm__
__volatile__
(
...
...
@@ -138,6 +154,8 @@ static inline void _raw_read_lock(rwlock_t *rw)
static
inline
void
_raw_read_unlock
(
rwlock_t
*
rw
)
{
unsigned
long
tmp
,
tmp2
;
__asm__
__volatile__
(
"1: ldrex %0, [%2]
\n
"
" sub %0, %0, #1
\n
"
...
...
@@ -151,19 +169,4 @@ static inline void _raw_read_unlock(rwlock_t *rw)
#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
static
inline
int
_raw_write_trylock
(
rwlock_t
*
rw
)
{
unsigned
long
tmp
;
__asm__
__volatile__
(
"1: ldrex %0, [%1]
\n
"
" teq %0, #0
\n
"
" strexeq %0, %2, [%1]"
:
"=&r"
(
tmp
)
:
"r"
(
&
rw
->
lock
),
"r"
(
0x80000000
)
:
"cc"
,
"memory"
);
return
tmp
==
0
;
}
#endif
/* __ASM_SPINLOCK_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment