summaryrefslogtreecommitdiff
path: root/kernel/src/scheduler/ap_startup.c
blob: d2baaecf25203fce68fea1bb519aaedc599ba0bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <atomic.h>
#include <apic.h>
#include <libk/stdio.h>
#include <idt.h>
#include <gdt.h>
#include <paging.h>

void ap_startup(void)
{
	load_idt(&idt_pointer);
	load_gdt(&gdt_pointer);
	load_pt_lvl4(page_table_lvl4);

	while (!bspdone) {
		__asm__ __volatile__("pause;");
	}

	/*	printf("curr_cpu_apic_id: 0x%x\n", curr_cpu_apic_id()); */
	lock(cnt_lock);
	ap_cnt++;
	unlock(cnt_lock);

	for (;;) {
		__asm__ __volatile__("hlt;");
	}
}