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