process.c 990 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  3. * Licensed under the GPL
  4. */
  5. #include <linux/init.h>
  6. #include <linux/sched.h>
  7. #include <as-layout.h>
  8. #include <kern.h>
  9. #include <os.h>
  10. #include <skas.h>
  11. extern void start_kernel(void);
  12. static int __init start_kernel_proc(void *unused)
  13. {
  14. int pid;
  15. block_signals();
  16. pid = os_getpid();
  17. cpu_tasks[0].pid = pid;
  18. cpu_tasks[0].task = current;
  19. start_kernel();
  20. return 0;
  21. }
  22. extern int userspace_pid[];
  23. extern char cpu0_irqstack[];
  24. int __init start_uml(void)
  25. {
  26. stack_protections((unsigned long) &cpu0_irqstack);
  27. set_sigstack(cpu0_irqstack, THREAD_SIZE);
  28. init_new_thread_signals();
  29. init_task.thread.request.u.thread.proc = start_kernel_proc;
  30. init_task.thread.request.u.thread.arg = NULL;
  31. return start_idle_thread(task_stack_page(&init_task),
  32. &init_task.thread.switch_buf);
  33. }
  34. unsigned long current_stub_stack(void)
  35. {
  36. if (current->mm == NULL)
  37. return 0;
  38. return current->mm->context.id.stack;
  39. }