init_task.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * This is where we statically allocate and initialize the initial
  4. * task.
  5. *
  6. * Copyright (C) 1999, 2002-2003 Hewlett-Packard Co
  7. * David Mosberger-Tang <davidm@hpl.hp.com>
  8. */
  9. #include <linux/init.h>
  10. #include <linux/mm.h>
  11. #include <linux/fs.h>
  12. #include <linux/module.h>
  13. #include <linux/sched.h>
  14. #include <linux/init_task.h>
  15. #include <linux/mqueue.h>
  16. #include <linux/uaccess.h>
  17. #include <asm/pgtable.h>
  18. static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
  19. static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
  20. /*
  21. * Initial task structure.
  22. *
  23. * We need to make sure that this is properly aligned due to the way process stacks are
  24. * handled. This is done by having a special ".data..init_task" section...
  25. */
  26. #define init_thread_info init_task_mem.s.thread_info
  27. #define init_stack init_task_mem.stack
  28. union {
  29. struct {
  30. struct task_struct task;
  31. struct thread_info thread_info;
  32. } s;
  33. unsigned long stack[KERNEL_STACK_SIZE/sizeof (unsigned long)];
  34. } init_task_mem asm ("init_task") __init_task_data =
  35. {{
  36. .task = INIT_TASK(init_task_mem.s.task),
  37. .thread_info = INIT_THREAD_INFO(init_task_mem.s.task)
  38. }};
  39. EXPORT_SYMBOL(init_task);