On Tue, Apr 26, 2022, Varad Gautam wrote: > +void ap_start64(void) > +{ > + setup_gdt_tss(); > + reset_apic(); > + load_idt(); > + save_id(); > + enable_apic(); > + enable_x2apic(); > + sti(); > + asm volatile ("nop"); > + printf("setup: AP %d online\n", apic_id()); > + atomic_inc(&cpu_online_count); > + while (1) { Unnecessary curly braces. And rather then spin, let's do "hlt", that way everything from the sti onwards can be moved to a common helper, e.g. ap_online().