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
513ad84b
Commit
513ad84b
authored
Feb 21, 2008
by
Ingo Molnar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x86: de-macro start_thread()
Signed-off-by:
Ingo Molnar
<
mingo@elte.hu
>
parent
1180e01d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
26 deletions
+33
-26
arch/x86/kernel/process_32.c
arch/x86/kernel/process_32.c
+15
-0
arch/x86/kernel/process_64.c
arch/x86/kernel/process_64.c
+15
-0
include/asm-x86/processor.h
include/asm-x86/processor.h
+3
-26
No files found.
arch/x86/kernel/process_32.c
View file @
513ad84b
...
...
@@ -512,6 +512,21 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
return
err
;
}
void
start_thread
(
struct
pt_regs
*
regs
,
unsigned
long
new_ip
,
unsigned
long
new_sp
)
{
__asm__
(
"movl %0, %%gs"
::
"r"
(
0
));
regs
->
fs
=
0
;
set_fs
(
USER_DS
);
regs
->
ds
=
__USER_DS
;
regs
->
es
=
__USER_DS
;
regs
->
ss
=
__USER_DS
;
regs
->
cs
=
__USER_CS
;
regs
->
ip
=
new_ip
;
regs
->
sp
=
new_sp
;
}
EXPORT_SYMBOL_GPL
(
start_thread
);
#ifdef CONFIG_SECCOMP
static
void
hard_disable_TSC
(
void
)
{
...
...
arch/x86/kernel/process_64.c
View file @
513ad84b
...
...
@@ -528,6 +528,21 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
return
err
;
}
void
start_thread
(
struct
pt_regs
*
regs
,
unsigned
long
new_ip
,
unsigned
long
new_sp
)
{
asm
volatile
(
"movl %0, %%fs; movl %0, %%es; movl %0, %%ds"
::
"r"
(
0
));
load_gs_index
(
0
);
regs
->
ip
=
new_ip
;
regs
->
sp
=
new_sp
;
write_pda
(
oldrsp
,
new_sp
);
regs
->
cs
=
__USER_CS
;
regs
->
ss
=
__USER_DS
;
regs
->
flags
=
0x200
;
set_fs
(
USER_DS
);
}
EXPORT_SYMBOL_GPL
(
start_thread
);
/*
* This special macro can be used to load a debugging register
*/
...
...
include/asm-x86/processor.h
View file @
513ad84b
...
...
@@ -817,20 +817,6 @@ static inline void spin_lock_prefetch(const void *x)
.io_bitmap = { [0 ... IO_BITMAP_LONGS] = ~0 }, \
}
#define start_thread(regs, new_eip, new_esp) \
do { \
__asm__("movl %0,%%gs": :"r" (0)); \
regs->fs = 0; \
set_fs(USER_DS); \
regs->ds = __USER_DS; \
regs->es = __USER_DS; \
regs->ss = __USER_DS; \
regs->cs = __USER_CS; \
regs->ip = new_eip; \
regs->sp = new_esp; \
} while (0)
extern
unsigned
long
thread_saved_pc
(
struct
task_struct
*
tsk
);
#define THREAD_SIZE_LONGS (THREAD_SIZE/sizeof(unsigned long))
...
...
@@ -887,18 +873,6 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
.x86_tss.sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
}
#define start_thread(regs, new_rip, new_rsp) do { \
asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0)); \
load_gs_index(0); \
(regs)->ip = (new_rip); \
(regs)->sp = (new_rsp); \
write_pda(oldrsp, (new_rsp)); \
(regs)->cs = __USER_CS; \
(regs)->ss = __USER_DS; \
(regs)->flags = 0x200; \
set_fs(USER_DS); \
} while (0)
/*
* Return saved PC of a blocked thread.
* What is this good for? it will be always the scheduler or ret_from_fork.
...
...
@@ -909,6 +883,9 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
#define KSTK_ESP(tsk) -1
/* sorry. doesn't work for syscall. */
#endif
/* CONFIG_X86_64 */
extern
void
start_thread
(
struct
pt_regs
*
regs
,
unsigned
long
new_ip
,
unsigned
long
new_sp
);
/*
* This decides where the kernel will search for a free chunk of vm
* space during mmap's.
...
...
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