aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/process_32.c15
-rw-r--r--arch/x86/kernel/process_64.c15
-rw-r--r--include/asm-x86/processor.h29
3 files changed, 33 insertions, 26 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 2cd89b8a7050..9230ce060d09 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -512,6 +512,21 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
512 return err; 512 return err;
513} 513}
514 514
515void
516start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp)
517{
518 __asm__("movl %0, %%gs" :: "r"(0));
519 regs->fs = 0;
520 set_fs(USER_DS);
521 regs->ds = __USER_DS;
522 regs->es = __USER_DS;
523 regs->ss = __USER_DS;
524 regs->cs = __USER_CS;
525 regs->ip = new_ip;
526 regs->sp = new_sp;
527}
528EXPORT_SYMBOL_GPL(start_thread);
529
515#ifdef CONFIG_SECCOMP 530#ifdef CONFIG_SECCOMP
516static void hard_disable_TSC(void) 531static void hard_disable_TSC(void)
517{ 532{
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 46c4c546b499..1ffce14cff6e 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -528,6 +528,21 @@ out:
528 return err; 528 return err;
529} 529}
530 530
531void
532start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp)
533{
534 asm volatile("movl %0, %%fs; movl %0, %%es; movl %0, %%ds" :: "r"(0));
535 load_gs_index(0);
536 regs->ip = new_ip;
537 regs->sp = new_sp;
538 write_pda(oldrsp, new_sp);
539 regs->cs = __USER_CS;
540 regs->ss = __USER_DS;
541 regs->flags = 0x200;
542 set_fs(USER_DS);
543}
544EXPORT_SYMBOL_GPL(start_thread);
545
531/* 546/*
532 * This special macro can be used to load a debugging register 547 * This special macro can be used to load a debugging register
533 */ 548 */
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h
index 43d2cc829a94..9054734589fe 100644
--- a/include/asm-x86/processor.h
+++ b/include/asm-x86/processor.h
@@ -817,20 +817,6 @@ static inline void spin_lock_prefetch(const void *x)
817 .io_bitmap = { [0 ... IO_BITMAP_LONGS] = ~0 }, \ 817 .io_bitmap = { [0 ... IO_BITMAP_LONGS] = ~0 }, \
818} 818}
819 819
820#define start_thread(regs, new_eip, new_esp) \
821do { \
822 __asm__("movl %0,%%gs": :"r" (0)); \
823 regs->fs = 0; \
824 set_fs(USER_DS); \
825 regs->ds = __USER_DS; \
826 regs->es = __USER_DS; \
827 regs->ss = __USER_DS; \
828 regs->cs = __USER_CS; \
829 regs->ip = new_eip; \
830 regs->sp = new_esp; \
831} while (0)
832
833
834extern unsigned long thread_saved_pc(struct task_struct *tsk); 820extern unsigned long thread_saved_pc(struct task_struct *tsk);
835 821
836#define THREAD_SIZE_LONGS (THREAD_SIZE/sizeof(unsigned long)) 822#define THREAD_SIZE_LONGS (THREAD_SIZE/sizeof(unsigned long))
@@ -887,18 +873,6 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
887 .x86_tss.sp0 = (unsigned long)&init_stack + sizeof(init_stack) \ 873 .x86_tss.sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
888} 874}
889 875
890#define start_thread(regs, new_rip, new_rsp) do { \
891 asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0)); \
892 load_gs_index(0); \
893 (regs)->ip = (new_rip); \
894 (regs)->sp = (new_rsp); \
895 write_pda(oldrsp, (new_rsp)); \
896 (regs)->cs = __USER_CS; \
897 (regs)->ss = __USER_DS; \
898 (regs)->flags = 0x200; \
899 set_fs(USER_DS); \
900} while (0)
901
902/* 876/*
903 * Return saved PC of a blocked thread. 877 * Return saved PC of a blocked thread.
904 * What is this good for? it will be always the scheduler or ret_from_fork. 878 * 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);
909#define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */ 883#define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */
910#endif /* CONFIG_X86_64 */ 884#endif /* CONFIG_X86_64 */
911 885
886extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
887 unsigned long new_sp);
888
912/* 889/*
913 * This decides where the kernel will search for a free chunk of vm 890 * This decides where the kernel will search for a free chunk of vm
914 * space during mmap's. 891 * space during mmap's.