exec.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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.h>
  10. #include <linux/slab.h>
  11. #include <asm/current.h>
  12. #include <asm/processor.h>
  13. #include <asm/uaccess.h>
  14. #include <as-layout.h>
  15. #include <mem_user.h>
  16. #include <skas.h>
  17. #include <os.h>
  18. void flush_thread(void)
  19. {
  20. void *data = NULL;
  21. int ret;
  22. arch_flush_thread(&current->thread.arch);
  23. ret = unmap(&current->mm->context.id, 0, STUB_START, 0, &data);
  24. ret = ret || unmap(&current->mm->context.id, STUB_END,
  25. host_task_size - STUB_END, 1, &data);
  26. if (ret) {
  27. printk(KERN_ERR "flush_thread - clearing address space failed, "
  28. "err = %d\n", ret);
  29. force_sig(SIGKILL, current);
  30. }
  31. get_safe_registers(current_pt_regs()->regs.gp,
  32. current_pt_regs()->regs.fp);
  33. __switch_mm(&current->mm->context.id);
  34. }
  35. void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
  36. {
  37. PT_REGS_IP(regs) = eip;
  38. PT_REGS_SP(regs) = esp;
  39. current->ptrace &= ~PT_DTRACE;
  40. #ifdef SUBARCH_EXECVE1
  41. SUBARCH_EXECVE1(regs->regs);
  42. #endif
  43. }
  44. EXPORT_SYMBOL(start_thread);