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