2019-08-25 10:49:17 +01:00
// SPDX-License-Identifier: GPL-2.0
2006-07-10 04:45:13 -07:00
/*
2007-10-16 01:27:00 -07:00
* Copyright ( C ) 2000 - 2007 Jeff Dike ( jdike @ { addtoit , linux . intel } . com )
2005-04-16 15:20:36 -07:00
*/
2011-08-18 20:14:10 +01:00
# include <linux/stddef.h>
# include <linux/module.h>
# include <linux/fs.h>
# include <linux/ptrace.h>
2017-02-04 00:16:44 +01:00
# include <linux/sched/mm.h>
2017-02-08 18:51:36 +01:00
# include <linux/sched/task.h>
2017-02-08 18:51:37 +01:00
# include <linux/sched/task_stack.h>
2011-08-18 20:14:10 +01:00
# include <linux/slab.h>
# include <asm/current.h>
# include <asm/processor.h>
2016-12-24 11:46:01 -08:00
# include <linux/uaccess.h>
2012-10-08 03:27:32 +01:00
# include <as-layout.h>
# include <mem_user.h>
# include <skas.h>
# include <os.h>
2005-04-16 15:20:36 -07:00
void flush_thread ( void )
{
2007-10-16 01:26:58 -07:00
void * data = NULL ;
int ret ;
2006-03-31 02:30:22 -08:00
arch_flush_thread ( & current - > thread . arch ) ;
2007-10-16 01:26:58 -07:00
2021-01-13 22:09:44 +01:00
ret = unmap ( & current - > mm - > context . id , 0 , TASK_SIZE , 1 , & data ) ;
2007-10-16 01:27:00 -07:00
if ( ret ) {
printk ( KERN_ERR " flush_thread - clearing address space failed, "
2007-10-16 01:26:58 -07:00
" err = %d \n " , ret ) ;
2019-05-23 10:17:27 -05:00
force_sig ( SIGKILL ) ;
2007-10-16 01:26:58 -07:00
}
2012-11-10 01:15:42 -05:00
get_safe_registers ( current_pt_regs ( ) - > regs . gp ,
current_pt_regs ( ) - > regs . fp ) ;
2007-10-16 01:26:58 -07:00
2007-10-16 01:27:06 -07:00
__switch_mm ( & current - > mm - > context . id ) ;
2005-04-16 15:20:36 -07:00
}
void start_thread ( struct pt_regs * regs , unsigned long eip , unsigned long esp )
{
2007-10-16 01:26:58 -07:00
PT_REGS_IP ( regs ) = eip ;
PT_REGS_SP ( regs ) = esp ;
2012-09-03 03:24:18 -04:00
current - > ptrace & = ~ PT_DTRACE ;
2006-07-10 04:45:13 -07:00
# ifdef SUBARCH_EXECVE1
2012-09-03 03:24:18 -04:00
SUBARCH_EXECVE1 ( regs - > regs ) ;
2006-07-10 04:45:13 -07:00
# endif
2005-04-16 15:20:36 -07:00
}
2012-09-03 03:24:18 -04:00
EXPORT_SYMBOL ( start_thread ) ;