Function init

Source
pub unsafe fn init()
Expand description

Performs low-level CPU initialization.

This function installs new segmentation and interrupt handling regimes which the rest of this crate needs to function properly.

§Safety

This function must never be executed more than once.

Before calling, memory must be identity mapped. Otherwise the introduction of flat segmentation will cause the kernel’s code/data to move unexpectedly.

After this function returns, it is safe to enable interrupts. However, interrupts below number 32 must never be generated except by the CPU itself (i.e. exceptions), as doing so would interfere with the internal handler stubs. This means that before enabling interrupts, the caller must ensure that any hardware delivering external interrupts (such as the PIC/APIC) is configured to use interrupt number 32 or above.