process.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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/mm.h>
  7. #include <linux/sched/task_stack.h>
  8. #include <linux/sched/task.h>
  9. #include <as-layout.h>
  10. #include <kern.h>
  11. #include <os.h>
  12. #include <skas.h>
  13. extern void start_kernel(void);
  14. static int __init start_kernel_proc(void *unused)
  15. {
  16. int pid;
  17. block_signals();
  18. pid = os_getpid();
  19. cpu_tasks[0].pid = pid;
  20. cpu_tasks[0].task = current;
  21. start_kernel();
  22. return 0;
  23. }
  24. extern int userspace_pid[];
  25. extern char cpu0_irqstack[];
  26. int __init start_uml(void)
  27. {
  28. stack_protections((unsigned long) &cpu0_irqstack);
  29. set_sigstack(cpu0_irqstack, THREAD_SIZE);
  30. init_new_thread_signals();
  31. init_task.thread.request.u.thread.proc = start_kernel_proc;
  32. init_task.thread.request.u.thread.arg = NULL;
  33. return start_idle_thread(task_stack_page(&init_task),
  34. &init_task.thread.switch_buf);
  35. }
  36. unsigned long current_stub_stack(void)
  37. {
  38. if (current->mm == NULL)
  39. return 0;
  40. return current->mm->context.id.stack;
  41. }