Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
4e8fd22b
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4e8fd22b
编写于
7月 24, 2005
作者:
R
Russell King
提交者:
Russell King
7月 24, 2005
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PATCH] ARM SMP: Fix ARMv6 spinlock and semaphore implementations
Signed-off-by:
N
Russell King
<
rmk+kernel@arm.linux.org.uk
>
上级
2c2a68b8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
18 deletion
+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
未找到文件。
include/asm-arm/locks.h
浏览文件 @
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
浏览文件 @
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 */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录