Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
34596dc9
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
34596dc9
编写于
9月 30, 2006
作者:
A
Andi Kleen
提交者:
Andi Kleen
9月 30, 2006
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PATCH] Define vsyscall cache as blob to make clearer that user space shouldn't use it
Signed-off-by:
N
Andi Kleen
<
ak@suse.de
>
上级
120b1142
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
13 deletion
+15
-13
arch/x86_64/kernel/vsyscall.c
arch/x86_64/kernel/vsyscall.c
+4
-4
include/linux/getcpu.h
include/linux/getcpu.h
+7
-5
kernel/sys.c
kernel/sys.c
+4
-4
未找到文件。
arch/x86_64/kernel/vsyscall.c
浏览文件 @
34596dc9
...
...
@@ -155,8 +155,8 @@ vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
We do this here because otherwise user space would do it on
its own in a likely inferior way (no access to jiffies).
If you don't like it pass NULL. */
if
(
tcache
&&
tcache
->
t0
==
(
j
=
__jiffies
))
{
p
=
tcache
->
t1
;
if
(
tcache
&&
tcache
->
blob
[
0
]
==
(
j
=
__jiffies
))
{
p
=
tcache
->
blob
[
1
]
;
}
else
if
(
__vgetcpu_mode
==
VGETCPU_RDTSCP
)
{
/* Load per CPU data from RDTSCP */
rdtscp
(
dummy
,
dummy
,
p
);
...
...
@@ -165,8 +165,8 @@ vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
asm
(
"lsl %1,%0"
:
"=r"
(
p
)
:
"r"
(
__PER_CPU_SEG
));
}
if
(
tcache
)
{
tcache
->
t0
=
j
;
tcache
->
t1
=
p
;
tcache
->
blob
[
0
]
=
j
;
tcache
->
blob
[
1
]
=
p
;
}
if
(
cpu
)
*
cpu
=
p
&
0xfff
;
...
...
include/linux/getcpu.h
浏览文件 @
34596dc9
#ifndef _LINUX_GETCPU_H
#define _LINUX_GETCPU_H 1
/* Cache for getcpu() to speed it up. Results might be
upto a jiffi
e
/* Cache for getcpu() to speed it up. Results might be
a short tim
e
out of date, but will be faster.
User programs should not refer to the contents of this structure.
It is only a cache for vgetcpu(). It might change in future kernels.
I repeat they should not refer to it. If they do they will break
in future kernels.
It is only a private cache for vgetcpu(). It will change in future kernels.
The user program must store this information per thread (__thread)
If you want 100% accurate information pass NULL instead. */
struct
getcpu_cache
{
unsigned
long
t0
;
unsigned
long
t1
;
unsigned
long
res
[
4
];
unsigned
long
blob
[
128
/
sizeof
(
long
)];
};
#endif
kernel/sys.c
浏览文件 @
34596dc9
...
...
@@ -2083,12 +2083,12 @@ asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep,
* padding
*/
unsigned
long
t0
,
t1
;
get_user
(
t0
,
&
cache
->
t0
);
get_user
(
t1
,
&
cache
->
t1
);
get_user
(
t0
,
&
cache
->
blob
[
0
]
);
get_user
(
t1
,
&
cache
->
blob
[
1
]
);
t0
++
;
t1
++
;
put_user
(
t0
,
&
cache
->
t0
);
put_user
(
t1
,
&
cache
->
t1
);
put_user
(
t0
,
&
cache
->
blob
[
0
]
);
put_user
(
t1
,
&
cache
->
blob
[
1
]
);
}
return
err
?
-
EFAULT
:
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录