Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
9560782f
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
9560782f
编写于
7月 26, 2005
作者:
R
Russell King
提交者:
Russell King
7月 26, 2005
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PATCH] ARM SMP: Use exclusive load/store for __xchg
Signed-off-by:
N
Russell King
<
rmk+kernel@arm.linux.org.uk
>
上级
6b6a93c6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
58 addition
and
29 deletion
+58
-29
include/asm-arm/system.h
include/asm-arm/system.h
+58
-29
未找到文件。
include/asm-arm/system.h
浏览文件 @
9560782f
...
...
@@ -323,12 +323,8 @@ do { \
* NOTE that this solution won't work on an SMP system, so explcitly
* forbid it here.
*/
#ifdef CONFIG_SMP
#error SMP is not supported on SA1100/SA110
#else
#define swp_is_buggy
#endif
#endif
static
inline
unsigned
long
__xchg
(
unsigned
long
x
,
volatile
void
*
ptr
,
int
size
)
{
...
...
@@ -337,35 +333,68 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
#ifdef swp_is_buggy
unsigned
long
flags
;
#endif
#if __LINUX_ARM_ARCH__ >= 6
unsigned
int
tmp
;
#endif
switch
(
size
)
{
#ifdef swp_is_buggy
case
1
:
local_irq_save
(
flags
);
ret
=
*
(
volatile
unsigned
char
*
)
ptr
;
*
(
volatile
unsigned
char
*
)
ptr
=
x
;
local_irq_restore
(
flags
);
break
;
case
4
:
local_irq_save
(
flags
);
ret
=
*
(
volatile
unsigned
long
*
)
ptr
;
*
(
volatile
unsigned
long
*
)
ptr
=
x
;
local_irq_restore
(
flags
);
break
;
#if __LINUX_ARM_ARCH__ >= 6
case
1
:
asm
volatile
(
"@ __xchg1
\n
"
"1: ldrexb %0, [%3]
\n
"
" strexb %1, %2, [%3]
\n
"
" teq %1, #0
\n
"
" bne 1b"
:
"=&r"
(
ret
),
"=&r"
(
tmp
)
:
"r"
(
x
),
"r"
(
ptr
)
:
"memory"
,
"cc"
);
break
;
case
4
:
asm
volatile
(
"@ __xchg4
\n
"
"1: ldrex %0, [%3]
\n
"
" strex %1, %2, [%3]
\n
"
" teq %1, #0
\n
"
" bne 1b"
:
"=&r"
(
ret
),
"=&r"
(
tmp
)
:
"r"
(
x
),
"r"
(
ptr
)
:
"memory"
,
"cc"
);
break
;
#elif defined(swp_is_buggy)
#ifdef CONFIG_SMP
#error SMP is not supported on this platform
#endif
case
1
:
local_irq_save
(
flags
);
ret
=
*
(
volatile
unsigned
char
*
)
ptr
;
*
(
volatile
unsigned
char
*
)
ptr
=
x
;
local_irq_restore
(
flags
);
break
;
case
4
:
local_irq_save
(
flags
);
ret
=
*
(
volatile
unsigned
long
*
)
ptr
;
*
(
volatile
unsigned
long
*
)
ptr
=
x
;
local_irq_restore
(
flags
);
break
;
#else
case
1
:
__asm__
__volatile__
(
"swpb %0, %1, [%2]"
:
"=&r"
(
ret
)
:
"r"
(
x
),
"r"
(
ptr
)
:
"memory"
,
"cc"
);
break
;
case
4
:
__asm__
__volatile__
(
"swp %0, %1, [%2]"
:
"=&r"
(
ret
)
:
"r"
(
x
),
"r"
(
ptr
)
:
"memory"
,
"cc"
);
break
;
case
1
:
asm
volatile
(
"@ __xchg1
\n
"
" swpb %0, %1, [%2]"
:
"=&r"
(
ret
)
:
"r"
(
x
),
"r"
(
ptr
)
:
"memory"
,
"cc"
);
break
;
case
4
:
asm
volatile
(
"@ __xchg4
\n
"
" swp %0, %1, [%2]"
:
"=&r"
(
ret
)
:
"r"
(
x
),
"r"
(
ptr
)
:
"memory"
,
"cc"
);
break
;
#endif
default:
__bad_xchg
(
ptr
,
size
),
ret
=
0
;
default:
__bad_xchg
(
ptr
,
size
),
ret
=
0
;
break
;
}
return
ret
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录