Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
255461c5
Commit
255461c5
authored
Sep 19, 2012
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mn10300: split ret_from_fork, simplify kernel_thread()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
49ed3398
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
71 deletions
+27
-71
arch/mn10300/kernel/Makefile
arch/mn10300/kernel/Makefile
+1
-1
arch/mn10300/kernel/entry.S
arch/mn10300/kernel/entry.S
+7
-0
arch/mn10300/kernel/internal.h
arch/mn10300/kernel/internal.h
+1
-5
arch/mn10300/kernel/kthread.S
arch/mn10300/kernel/kthread.S
+0
-31
arch/mn10300/kernel/process.c
arch/mn10300/kernel/process.c
+18
-34
No files found.
arch/mn10300/kernel/Makefile
View file @
255461c5
...
...
@@ -7,7 +7,7 @@ fpu-obj-y := fpu-nofpu.o fpu-nofpu-low.o
fpu-obj-$(CONFIG_FPU)
:=
fpu.o fpu-low.o
obj-y
:=
process.o signal.o entry.o traps.o irq.o
\
ptrace.o setup.o time.o sys_mn10300.o io.o
kthread.o
\
ptrace.o setup.o time.o sys_mn10300.o io.o
\
switch_to.o mn10300_ksyms.o kernel_execve.o
$
(
fpu-obj-y
)
\
csrc-mn10300.o cevt-mn10300.o
...
...
arch/mn10300/kernel/entry.S
View file @
255461c5
...
...
@@ -55,6 +55,13 @@ ENTRY(ret_from_fork)
mov
d0
,(
REG_D0
,
fp
)
jmp
syscall_exit
ENTRY
(
ret_from_kernel_thread
)
call
schedule_tail
[],
0
mov
(
REG_D0
,
fp
),
d0
mov
(
REG_A0
,
fp
),
a0
calls
(
a0
)
jmp
sys_exit
###############################################################################
#
#
system
call
handler
...
...
arch/mn10300/kernel/internal.h
View file @
255461c5
...
...
@@ -14,15 +14,11 @@
struct
clocksource
;
struct
clock_event_device
;
/*
* kthread.S
*/
extern
int
kernel_thread_helper
(
int
);
/*
* entry.S
*/
extern
void
ret_from_fork
(
struct
task_struct
*
)
__attribute__
((
noreturn
));
extern
void
ret_from_kernel_thread
(
struct
task_struct
*
)
__attribute__
((
noreturn
));
/*
* smp-low.S
...
...
arch/mn10300/kernel/kthread.S
deleted
100644 → 0
View file @
49ed3398
/*
MN10300
Kernel
thread
trampoline
function
*
*
Copyright
(
C
)
2007
Red
Hat
,
Inc
.
All
Rights
Reserved
.
*
Written
by
Mark
Salter
(
msalter
@
redhat
.
com
)
*
*
This
program
is
free
software
; you can redistribute it and/or
*
modify
it
under
the
terms
of
the
GNU
General
Public
Licence
*
as
published
by
the
Free
Software
Foundation
; either version
*
2
of
the
Licence
,
or
(
at
your
option
)
any
later
version
.
*/
.
text
###############################################################################
#
#
kernel_thread_helper
-
trampoline
for
kernel_thread
()
#
#
On
entry
:
#
A2
=
address
of
function
to
call
#
D2
=
function
argument
#
###############################################################################
.
globl
kernel_thread_helper
.
type
kernel_thread_helper
,
@
function
kernel_thread_helper
:
mov
do_exit
,
d1
mov
d1
,(
sp
)
mov
d1
,
mdr
mov
d2
,
d0
jmp
(
a2
)
.
size
kernel_thread_helper
,
.
-
kernel_thread_helper
arch/mn10300/kernel/process.c
View file @
255461c5
...
...
@@ -166,13 +166,11 @@ void show_regs(struct pt_regs *regs)
*/
int
kernel_thread
(
int
(
*
fn
)(
void
*
),
void
*
arg
,
unsigned
long
flags
)
{
struct
pt_regs
regs
;
struct
pt_regs
regs
=
{
.
a0
=
(
unsigned
long
)
fn
;
.
d0
=
(
unsigned
long
)
arg
;
};
memset
(
&
regs
,
0
,
sizeof
(
regs
));
regs
.
a2
=
(
unsigned
long
)
fn
;
regs
.
d2
=
(
unsigned
long
)
arg
;
regs
.
pc
=
(
unsigned
long
)
kernel_thread_helper
;
local_save_flags
(
regs
.
epsw
);
regs
.
epsw
|=
EPSW_IE
|
EPSW_IM_7
;
...
...
@@ -180,7 +178,6 @@ int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
return
do_fork
(
flags
|
CLONE_VM
|
CLONE_UNTRACED
,
0
,
&
regs
,
0
,
NULL
,
NULL
);
}
EXPORT_SYMBOL
(
kernel_thread
);
/*
* free current thread data structures etc..
...
...
@@ -227,49 +224,36 @@ int copy_thread(unsigned long clone_flags,
struct
task_struct
*
p
,
struct
pt_regs
*
kregs
)
{
struct
thread_info
*
ti
=
task_thread_info
(
p
);
struct
pt_regs
*
c_
uregs
,
*
c_kregs
,
*
u
regs
;
struct
pt_regs
*
c_regs
;
unsigned
long
c_ksp
;
uregs
=
current
->
thread
.
uregs
;
c_ksp
=
(
unsigned
long
)
task_stack_page
(
p
)
+
THREAD_SIZE
;
/* allocate the userspace exception frame and set it up */
c_ksp
-=
sizeof
(
struct
pt_regs
);
c_
u
regs
=
(
struct
pt_regs
*
)
c_ksp
;
c_regs
=
(
struct
pt_regs
*
)
c_ksp
;
p
->
thread
.
uregs
=
c_
u
regs
;
*
c_
uregs
=
*
u
regs
;
c_
u
regs
->
sp
=
c_usp
;
c_
u
regs
->
epsw
&=
~
EPSW_FE
;
/* my FPU */
p
->
thread
.
uregs
=
c_regs
;
*
c_
regs
=
*
k
regs
;
c_regs
->
sp
=
c_usp
;
c_regs
->
epsw
&=
~
EPSW_FE
;
/* my FPU */
c_ksp
-=
12
;
/* allocate function call ABI slack */
/* the new TLS pointer is passed in as arg #5 to sys_clone() */
if
(
clone_flags
&
CLONE_SETTLS
)
c_uregs
->
e2
=
current_frame
()
->
d3
;
/* set up the return kernel frame if called from kernel_thread() */
c_kregs
=
c_uregs
;
if
(
kregs
!=
uregs
)
{
c_ksp
-=
sizeof
(
struct
pt_regs
);
c_kregs
=
(
struct
pt_regs
*
)
c_ksp
;
*
c_kregs
=
*
kregs
;
c_kregs
->
sp
=
c_usp
;
c_kregs
->
next
=
c_uregs
;
#ifdef CONFIG_MN10300_CURRENT_IN_E2
c_kregs
->
e2
=
(
unsigned
long
)
p
;
/* current */
#endif
c_regs
->
e2
=
current_frame
()
->
d3
;
c_ksp
-=
12
;
/* allocate function call ABI slack */
}
if
(
unlikely
(
!
user_mode
(
kregs
)))
p
->
thread
.
pc
=
(
unsigned
long
)
ret_from_kernel_thread
;
else
p
->
thread
.
pc
=
(
unsigned
long
)
ret_from_fork
;
/* set up things up so the scheduler can start the new task */
ti
->
frame
=
c_
k
regs
;
p
->
thread
.
a3
=
(
unsigned
long
)
c_
k
regs
;
ti
->
frame
=
c_regs
;
p
->
thread
.
a3
=
(
unsigned
long
)
c_regs
;
p
->
thread
.
sp
=
c_ksp
;
p
->
thread
.
pc
=
(
unsigned
long
)
ret_from_fork
;
p
->
thread
.
wchan
=
(
unsigned
long
)
ret_from_fork
;
p
->
thread
.
wchan
=
p
->
thread
.
pc
;
p
->
thread
.
usp
=
c_usp
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment