Function init_early

Source
pub fn init_early(cpu_id: usize, arg: usize)
Expand description

Initializes the platform at the early stage for the primary core.

This function should be called immediately after the kernel has booted, and performed earliest platform configuration and initialization (e.g., early console, clocking).

§Arguments

  • cpu_id is the logical CPU ID (0, 1, …, N-1, N is the number of CPU cores on the platform).
  • arg is passed from the bootloader (typically the device tree blob address).

§Before calling this function

  • CPU is booted in the kernel mode.
  • Early page table is set up, virtual memory is enabled.
  • CPU-local data is initialized.

§After calling this function

  • Exception & interrupt handlers are set up.
  • Early console is initialized.
  • Current monotonic time and wall time can be obtained.