init.9.txt 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. INIT(9)
  2. ========
  3. :doctype: manpage
  4. :man source: X15
  5. :man manual: X15 Kernel initialization
  6. NAME
  7. ----
  8. init - kernel initialization
  9. DESCRIPTION
  10. -----------
  11. This document describes kernel initialization, and in particular, the concept
  12. of initialization operation and their dependencies. All related declarations
  13. are provided by the module:kern/init module.
  14. Initialization operations
  15. ~~~~~~~~~~~~~~~~~~~~~~~~~
  16. An initialization operation is a function that enables the use of a specific
  17. interface. For example, The cfunction:thread_setup function enables the
  18. creation of threads. Any thread created before calling that function is
  19. invalid and leads to undefined behaviour, potentially being silent and
  20. unnoticed for a long time. This kind of relation is expressed as an
  21. initialization operation dependency. As a result, the data structure for
  22. initialization operations associates a function and its dependencies.
  23. Definition
  24. ~~~~~~~~~~
  25. Initialization operations are defined using the cmacro:INIT_OP_DEFINE()
  26. macro. The first argument is the function implementing the operation,
  27. and any additional argument is a dependency.
  28. Dependencies are built with the cmacro:INIT_OP_DEP() macro. They may
  29. be either required or optional. An optional dependency is only used
  30. to infer execution order. If it fails, the initialization operation
  31. function is run regardless.
  32. Declaration
  33. ~~~~~~~~~~~
  34. In order to build dependencies, initialization operations must be
  35. declared as part of the public interface of the module providing it.
  36. This is accomplished using the cmacro:INIT_OP_DECLARE() macro in the
  37. public header.
  38. Execution order
  39. ~~~~~~~~~~~~~~~
  40. The complete set of initialization operations and their dependencies
  41. must result in a directed acyclic graph, so that a topological sort
  42. can be applied, starting from the roots, i.e. initialization operations
  43. with no dependencies. For convenience, the topological sort is performed
  44. both at build and run time. Sorting at build time is done with the
  45. shell:{make x15.sorted_init_ops} command.
  46. Debugging
  47. ~~~~~~~~~
  48. In order to help debugging initialization issues, the module:kern/init
  49. module provides a debugging mode, that may be enabled at build time
  50. by changing an internal macro. In this mode, text buffers record
  51. various information such as the list of roots, operations with dependency
  52. cycles (in case the build time check isn't used), and the list of
  53. operations that completed. These buffers can be dumped using a debugger
  54. such as a JTAG interface. Debugging mode is enabled by setting the
  55. cmacro:INIT_DEBUG macro to a non-zero value.
  56. SEE
  57. ---
  58. manpage:intro
  59. {x15-operating-system}