ax_cpu/x86_64/init.rs
1//! Helper functions to initialize the CPU states on systems bootstrapping.
2
3/// Initializes trap handling on the current CPU.
4///
5/// In detail, it initializes the GDT, IDT on x86_64 platforms. If the `uspace`
6/// feature is enabled, it also initializes relevant model-specific registers to
7/// configure the handler for `syscall` instruction.
8///
9/// # Notes
10/// Before calling this function, the platform entry path must have installed
11/// and verified the current CPU area. Architecture trap initialization is not
12/// a second per-CPU binder.
13pub fn init_trap() {
14 #[cfg(feature = "exception-table")]
15 crate::exception_table::init_exception_table();
16 super::gdt::init();
17 super::idt::init();
18 #[cfg(feature = "uspace")]
19 super::uspace::init_syscall();
20}