Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
533e6903
C
clone-Linux
项目概览
gsplhtlxg
/
clone-Linux
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
clone-Linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
533e6903
编写于
9月 16, 2012
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
m68k: split ret_from_fork(), simplify kernel_thread()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
0973c687
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
62 deletion
+36
-62
arch/m68k/Kconfig
arch/m68k/Kconfig
+1
-0
arch/m68k/include/asm/processor.h
arch/m68k/include/asm/processor.h
+0
-2
arch/m68k/kernel/entry.S
arch/m68k/kernel/entry.S
+11
-0
arch/m68k/kernel/process.c
arch/m68k/kernel/process.c
+24
-60
未找到文件。
arch/m68k/Kconfig
浏览文件 @
533e6903
...
...
@@ -13,6 +13,7 @@ config M68K
select FPU if MMU
select ARCH_WANT_IPC_PARSE_VERSION
select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE
select GENERIC_KERNEL_THREAD
config RWSEM_GENERIC_SPINLOCK
bool
...
...
arch/m68k/include/asm/processor.h
浏览文件 @
533e6903
...
...
@@ -154,8 +154,6 @@ static inline void release_thread(struct task_struct *dead_task)
{
}
extern
int
kernel_thread
(
int
(
*
fn
)(
void
*
),
void
*
arg
,
unsigned
long
flags
);
/*
* Free current thread data structures etc..
*/
...
...
arch/m68k/kernel/entry.S
浏览文件 @
533e6903
...
...
@@ -111,6 +111,17 @@ ENTRY(ret_from_fork)
addql
#
4
,%
sp
jra
ret_from_exception
ENTRY
(
ret_from_kernel_thread
)
|
a3
contains
the
kernel
thread
payload
,
d7
-
its
argument
movel
%
d1
,%
sp
@
-
jsr
schedule_tail
GET_CURRENT
(%
d0
)
movel
%
d7
,(%
sp
)
jsr
%a3
@
addql
#
4
,%
sp
movel
%
d0
,(%
sp
)
jra
sys_exit
#if defined(CONFIG_COLDFIRE) || !defined(CONFIG_MMU)
#ifdef TRAP_DBG_INTERRUPT
...
...
arch/m68k/kernel/process.c
浏览文件 @
533e6903
...
...
@@ -34,6 +34,7 @@
asmlinkage
void
ret_from_fork
(
void
);
asmlinkage
void
ret_from_kernel_thread
(
void
);
/*
...
...
@@ -120,51 +121,6 @@ void show_regs(struct pt_regs * regs)
printk
(
"USP: %08lx
\n
"
,
rdusp
());
}
/*
* Create a kernel thread
*/
int
kernel_thread
(
int
(
*
fn
)(
void
*
),
void
*
arg
,
unsigned
long
flags
)
{
int
pid
;
mm_segment_t
fs
;
fs
=
get_fs
();
set_fs
(
KERNEL_DS
);
{
register
long
retval
__asm__
(
"d0"
);
register
long
clone_arg
__asm__
(
"d1"
)
=
flags
|
CLONE_VM
|
CLONE_UNTRACED
;
retval
=
__NR_clone
;
__asm__
__volatile__
(
"clrl %%d2
\n\t
"
"trap #0
\n\t
"
/* Linux/m68k system call */
"tstl %0
\n\t
"
/* child or parent */
"jne 1f
\n\t
"
/* parent - jump */
#ifdef CONFIG_MMU
"lea %%sp@(%c7),%6
\n\t
"
/* reload current */
"movel %6@,%6
\n\t
"
#endif
"movel %3,%%sp@-
\n\t
"
/* push argument */
"jsr %4@
\n\t
"
/* call fn */
"movel %0,%%d1
\n\t
"
/* pass exit value */
"movel %2,%%d0
\n\t
"
/* exit */
"trap #0
\n
"
"1:"
:
"+d"
(
retval
)
:
"i"
(
__NR_clone
),
"i"
(
__NR_exit
),
"r"
(
arg
),
"a"
(
fn
),
"d"
(
clone_arg
),
"r"
(
current
),
"i"
(
-
THREAD_SIZE
)
:
"d2"
);
pid
=
retval
;
}
set_fs
(
fs
);
return
pid
;
}
EXPORT_SYMBOL
(
kernel_thread
);
void
flush_thread
(
void
)
{
current
->
thread
.
fs
=
__USER_DS
;
...
...
@@ -216,30 +172,18 @@ asmlinkage int m68k_clone(struct pt_regs *regs)
}
int
copy_thread
(
unsigned
long
clone_flags
,
unsigned
long
usp
,
unsigned
long
unused
,
unsigned
long
arg
,
struct
task_struct
*
p
,
struct
pt_regs
*
regs
)
{
struct
pt_regs
*
childregs
;
struct
switch_stack
*
childstack
,
*
stack
;
unsigned
long
*
retp
;
struct
switch_stack
*
childstack
;
childregs
=
(
struct
pt_regs
*
)
(
task_stack_page
(
p
)
+
THREAD_SIZE
)
-
1
;
*
childregs
=
*
regs
;
childregs
->
d0
=
0
;
retp
=
((
unsigned
long
*
)
regs
);
stack
=
((
struct
switch_stack
*
)
retp
)
-
1
;
childstack
=
((
struct
switch_stack
*
)
childregs
)
-
1
;
*
childstack
=
*
stack
;
childstack
->
retpc
=
(
unsigned
long
)
ret_from_fork
;
p
->
thread
.
usp
=
usp
;
p
->
thread
.
ksp
=
(
unsigned
long
)
childstack
;
if
(
clone_flags
&
CLONE_SETTLS
)
task_thread_info
(
p
)
->
tp_value
=
regs
->
d5
;
p
->
thread
.
esp0
=
(
unsigned
long
)
childregs
;
/*
* Must save the current SFC/DFC value, NOT the value when
...
...
@@ -247,6 +191,26 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
*/
p
->
thread
.
fs
=
get_fs
().
seg
;
if
(
unlikely
(
!
regs
))
{
/* kernel thread */
memset
(
childstack
,
0
,
sizeof
(
struct
switch_stack
)
+
sizeof
(
struct
pt_regs
));
childregs
->
sr
=
PS_S
;
childstack
->
a3
=
usp
;
/* function */
childstack
->
d7
=
arg
;
childstack
->
retpc
=
(
unsigned
long
)
ret_from_kernel_thread
;
p
->
thread
.
usp
=
0
;
return
0
;
}
*
childregs
=
*
regs
;
childregs
->
d0
=
0
;
*
childstack
=
((
struct
switch_stack
*
)
regs
)[
-
1
];
childstack
->
retpc
=
(
unsigned
long
)
ret_from_fork
;
if
(
clone_flags
&
CLONE_SETTLS
)
task_thread_info
(
p
)
->
tp_value
=
regs
->
d5
;
#ifdef CONFIG_FPU
if
(
!
FPU_IS_EMU
)
{
/* Copy the current fpu state */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录