process.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  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_trace();
  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. }