Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
34596dc9
cloud-kernel
项目概览
openanolis
/
cloud-kernel
11 个月 前同步成功
通知
150
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
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)
...
@@ -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
We do this here because otherwise user space would do it on
its own in a likely inferior way (no access to jiffies).
its own in a likely inferior way (no access to jiffies).
If you don't like it pass NULL. */
If you don't like it pass NULL. */
if
(
tcache
&&
tcache
->
t0
==
(
j
=
__jiffies
))
{
if
(
tcache
&&
tcache
->
blob
[
0
]
==
(
j
=
__jiffies
))
{
p
=
tcache
->
t1
;
p
=
tcache
->
blob
[
1
]
;
}
else
if
(
__vgetcpu_mode
==
VGETCPU_RDTSCP
)
{
}
else
if
(
__vgetcpu_mode
==
VGETCPU_RDTSCP
)
{
/* Load per CPU data from RDTSCP */
/* Load per CPU data from RDTSCP */
rdtscp
(
dummy
,
dummy
,
p
);
rdtscp
(
dummy
,
dummy
,
p
);
...
@@ -165,8 +165,8 @@ vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
...
@@ -165,8 +165,8 @@ vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
asm
(
"lsl %1,%0"
:
"=r"
(
p
)
:
"r"
(
__PER_CPU_SEG
));
asm
(
"lsl %1,%0"
:
"=r"
(
p
)
:
"r"
(
__PER_CPU_SEG
));
}
}
if
(
tcache
)
{
if
(
tcache
)
{
tcache
->
t0
=
j
;
tcache
->
blob
[
0
]
=
j
;
tcache
->
t1
=
p
;
tcache
->
blob
[
1
]
=
p
;
}
}
if
(
cpu
)
if
(
cpu
)
*
cpu
=
p
&
0xfff
;
*
cpu
=
p
&
0xfff
;
...
...
include/linux/getcpu.h
浏览文件 @
34596dc9
#ifndef _LINUX_GETCPU_H
#ifndef _LINUX_GETCPU_H
#define _LINUX_GETCPU_H 1
#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.
out of date, but will be faster.
User programs should not refer to the contents of this structure.
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)
The user program must store this information per thread (__thread)
If you want 100% accurate information pass NULL instead. */
If you want 100% accurate information pass NULL instead. */
struct
getcpu_cache
{
struct
getcpu_cache
{
unsigned
long
t0
;
unsigned
long
blob
[
128
/
sizeof
(
long
)];
unsigned
long
t1
;
unsigned
long
res
[
4
];
};
};
#endif
#endif
kernel/sys.c
浏览文件 @
34596dc9
...
@@ -2083,12 +2083,12 @@ asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep,
...
@@ -2083,12 +2083,12 @@ asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep,
* padding
* padding
*/
*/
unsigned
long
t0
,
t1
;
unsigned
long
t0
,
t1
;
get_user
(
t0
,
&
cache
->
t0
);
get_user
(
t0
,
&
cache
->
blob
[
0
]
);
get_user
(
t1
,
&
cache
->
t1
);
get_user
(
t1
,
&
cache
->
blob
[
1
]
);
t0
++
;
t0
++
;
t1
++
;
t1
++
;
put_user
(
t0
,
&
cache
->
t0
);
put_user
(
t0
,
&
cache
->
blob
[
0
]
);
put_user
(
t1
,
&
cache
->
t1
);
put_user
(
t1
,
&
cache
->
blob
[
1
]
);
}
}
return
err
?
-
EFAULT
:
0
;
return
err
?
-
EFAULT
:
0
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录