Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
8f54bcac
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
8f54bcac
编写于
10月 09, 2012
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mips: switch to generic kernel_thread()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
ddffeb8c
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
30 addition
and
44 deletion
+30
-44
arch/mips/Kconfig
arch/mips/Kconfig
+1
-0
arch/mips/include/asm/processor.h
arch/mips/include/asm/processor.h
+0
-2
arch/mips/kernel/entry.S
arch/mips/kernel/entry.S
+7
-0
arch/mips/kernel/mips_ksyms.c
arch/mips/kernel/mips_ksyms.c
+0
-2
arch/mips/kernel/process.c
arch/mips/kernel/process.c
+22
-40
未找到文件。
arch/mips/Kconfig
浏览文件 @
8f54bcac
...
...
@@ -40,6 +40,7 @@ config MIPS
select HAVE_MOD_ARCH_SPECIFIC
select MODULES_USE_ELF_REL
select MODULES_USE_ELF_RELA if 64BIT
select GENERIC_KERNEL_THREAD
menu "Machine selection"
...
...
arch/mips/include/asm/processor.h
浏览文件 @
8f54bcac
...
...
@@ -310,8 +310,6 @@ struct task_struct;
/* Free all resources held by a thread. */
#define release_thread(thread) do { } while(0)
extern
long
kernel_thread
(
int
(
*
fn
)(
void
*
),
void
*
arg
,
unsigned
long
flags
);
extern
unsigned
long
thread_saved_pc
(
struct
task_struct
*
tsk
);
/*
...
...
arch/mips/kernel/entry.S
浏览文件 @
8f54bcac
...
...
@@ -65,6 +65,13 @@ need_resched:
b
need_resched
#endif
FEXPORT
(
ret_from_kernel_thread
)
jal
schedule_tail
#
a0
=
struct
task_struct
*
prev
move
a0
,
s1
jal
s0
li
a0
,
0
j
sys_exit
FEXPORT
(
ret_from_fork
)
jal
schedule_tail
#
a0
=
struct
task_struct
*
prev
...
...
arch/mips/kernel/mips_ksyms.c
浏览文件 @
8f54bcac
...
...
@@ -32,8 +32,6 @@ EXPORT_SYMBOL(memset);
EXPORT_SYMBOL
(
memcpy
);
EXPORT_SYMBOL
(
memmove
);
EXPORT_SYMBOL
(
kernel_thread
);
/*
* Functions that operate on entire pages. Mostly used by memory management.
*/
...
...
arch/mips/kernel/process.c
浏览文件 @
8f54bcac
...
...
@@ -84,6 +84,7 @@ void __noreturn cpu_idle(void)
}
asmlinkage
void
ret_from_fork
(
void
);
asmlinkage
void
ret_from_kernel_thread
(
void
);
void
start_thread
(
struct
pt_regs
*
regs
,
unsigned
long
pc
,
unsigned
long
sp
)
{
...
...
@@ -113,7 +114,7 @@ void flush_thread(void)
}
int
copy_thread
(
unsigned
long
clone_flags
,
unsigned
long
usp
,
unsigned
long
unused
,
struct
task_struct
*
p
,
struct
pt_regs
*
regs
)
unsigned
long
arg
,
struct
task_struct
*
p
,
struct
pt_regs
*
regs
)
{
struct
thread_info
*
ti
=
task_thread_info
(
p
);
struct
pt_regs
*
childregs
;
...
...
@@ -136,19 +137,30 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
childregs
=
(
struct
pt_regs
*
)
childksp
-
1
;
/* Put the stack after the struct pt_regs. */
childksp
=
(
unsigned
long
)
childregs
;
p
->
thread
.
cp0_status
=
read_c0_status
()
&
~
(
ST0_CU2
|
ST0_CU1
);
if
(
unlikely
(
p
->
flags
&
PF_KTHREAD
))
{
unsigned
long
status
=
p
->
thread
.
cp0_status
;
memset
(
childregs
,
0
,
sizeof
(
struct
pt_regs
));
ti
->
addr_limit
=
KERNEL_DS
;
p
->
thread
.
reg16
=
usp
;
/* fn */
p
->
thread
.
reg17
=
arg
;
p
->
thread
.
reg29
=
childksp
;
p
->
thread
.
reg31
=
(
unsigned
long
)
ret_from_kernel_thread
;
#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
status
=
(
status
&
~
(
ST0_KUP
|
ST0_IEP
|
ST0_IEC
))
|
((
status
&
(
ST0_KUC
|
ST0_IEC
))
<<
2
);
#else
status
|=
ST0_EXL
;
#endif
childregs
->
cp0_status
=
status
;
return
0
;
}
*
childregs
=
*
regs
;
childregs
->
regs
[
7
]
=
0
;
/* Clear error flag */
childregs
->
regs
[
2
]
=
0
;
/* Child gets zero as return value */
if
(
childregs
->
cp0_status
&
ST0_CU0
)
{
childregs
->
regs
[
28
]
=
(
unsigned
long
)
ti
;
childregs
->
regs
[
29
]
=
childksp
;
ti
->
addr_limit
=
KERNEL_DS
;
}
else
{
childregs
->
regs
[
29
]
=
usp
;
ti
->
addr_limit
=
USER_DS
;
}
p
->
thread
.
reg29
=
(
unsigned
long
)
childregs
;
p
->
thread
.
reg31
=
(
unsigned
long
)
ret_from_fork
;
...
...
@@ -156,7 +168,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
* New tasks lose permission to use the fpu. This accelerates context
* switching for most programs since they don't use the fpu.
*/
p
->
thread
.
cp0_status
=
read_c0_status
()
&
~
(
ST0_CU2
|
ST0_CU1
);
childregs
->
cp0_status
&=
~
(
ST0_CU2
|
ST0_CU1
);
#ifdef CONFIG_MIPS_MT_SMTC
...
...
@@ -221,35 +232,6 @@ int dump_task_fpu(struct task_struct *t, elf_fpregset_t *fpr)
return
1
;
}
/*
* Create a kernel thread
*/
static
void
__noreturn
kernel_thread_helper
(
void
*
arg
,
int
(
*
fn
)(
void
*
))
{
do_exit
(
fn
(
arg
));
}
long
kernel_thread
(
int
(
*
fn
)(
void
*
),
void
*
arg
,
unsigned
long
flags
)
{
struct
pt_regs
regs
;
memset
(
&
regs
,
0
,
sizeof
(
regs
));
regs
.
regs
[
4
]
=
(
unsigned
long
)
arg
;
regs
.
regs
[
5
]
=
(
unsigned
long
)
fn
;
regs
.
cp0_epc
=
(
unsigned
long
)
kernel_thread_helper
;
regs
.
cp0_status
=
read_c0_status
();
#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
regs
.
cp0_status
=
(
regs
.
cp0_status
&
~
(
ST0_KUP
|
ST0_IEP
|
ST0_IEC
))
|
((
regs
.
cp0_status
&
(
ST0_KUC
|
ST0_IEC
))
<<
2
);
#else
regs
.
cp0_status
|=
ST0_EXL
;
#endif
/* Ok, create the new process.. */
return
do_fork
(
flags
|
CLONE_VM
|
CLONE_UNTRACED
,
0
,
&
regs
,
0
,
NULL
,
NULL
);
}
/*
*
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录