exec.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  3. * Licensed under the GPL
  4. */
  5. #include <linux/stddef.h>
  6. #include <linux/module.h>
  7. #include <linux/fs.h>
  8. #include <linux/ptrace.h>
  9. #include <linux/sched/mm.h>
  10. #include <linux/sched/task.h>
  11. #include <linux/sched/task_stack.h>
  12. #include <linux/slab.h>
  13. #include <asm/current.h>
  14. #include <asm/processor.h>
  15. #include <linux/uaccess.h>
  16. #include <as-layout.h>
  17. #include <mem_user.h>
  18. #include <skas.h>
  19. #include <os.h>
  20. void flush_thread(void)
  21. {
  22. void *data = NULL;
  23. int ret;
  24. arch_flush_thread(&current->thread.arch);
  25. ret = unmap(&current->mm->context.id, 0, STUB_START, 0, &data);
  26. ret = ret || unmap(&current->mm->context.id, STUB_END,
  27. host_task_size - STUB_END, 1, &data);
  28. if (ret) {
  29. printk(KERN_ERR "flush_thread - clearing address space failed, "
  30. "err = %d\n", ret);
  31. force_sig(SIGKILL, current);
  32. }
  33. get_safe_registers(current_pt_regs()->regs.gp,
  34. current_pt_regs()->regs.fp);
  35. __switch_mm(&current->mm->context.id);
  36. }
  37. void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
  38. {
  39. PT_REGS_IP(regs) = eip;
  40. PT_REGS_SP(regs) = esp;
  41. current->ptrace &= ~PT_DTRACE;
  42. #ifdef SUBARCH_EXECVE1
  43. SUBARCH_EXECVE1(regs->regs);
  44. #endif
  45. }
  46. EXPORT_SYMBOL(start_thread);