apic: enable LAPIC on application processors
This commit is contained in:
parent
e7ceff19ec
commit
eaf5254b3b
3 changed files with 11 additions and 2 deletions
|
|
@ -80,6 +80,12 @@ void lapic_eoi()
|
||||||
lapic_write(lapic_addr, LAPIC_EOI, 0);
|
lapic_write(lapic_addr, LAPIC_EOI, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lapic_enable()
|
||||||
|
{
|
||||||
|
/* Set spurious interrupt vector to 0xFF and enable the LAPIC */
|
||||||
|
lapic_write(lapic_addr, 0xF0, 0x1FF);
|
||||||
|
}
|
||||||
|
|
||||||
void apic_init()
|
void apic_init()
|
||||||
{
|
{
|
||||||
if (__madt == NULL) {
|
if (__madt == NULL) {
|
||||||
|
|
@ -107,8 +113,7 @@ void apic_init()
|
||||||
lapic_id = lapic_read(lapic_addr, 0x20);
|
lapic_id = lapic_read(lapic_addr, 0x20);
|
||||||
ioapic_redirect_insert(4, 0x24, 0, 0);
|
ioapic_redirect_insert(4, 0x24, 0, 0);
|
||||||
|
|
||||||
/* Set spurious interrupt vector to 0xFF and enable the LAPIC */
|
lapic_enable();
|
||||||
lapic_write(lapic_addr, 0xF0, 0x1FF);
|
|
||||||
|
|
||||||
uint64_t msr = rdmsr(MSR_IA32_APIC_BASE);
|
uint64_t msr = rdmsr(MSR_IA32_APIC_BASE);
|
||||||
msr |= 1 << 11;
|
msr |= 1 << 11;
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,7 @@ struct apic_redirect {
|
||||||
void apic_init();
|
void apic_init();
|
||||||
void lapic_eoi();
|
void lapic_eoi();
|
||||||
int madt_parse_next_entry(int offset);
|
int madt_parse_next_entry(int offset);
|
||||||
|
void lapic_enable();
|
||||||
|
|
||||||
#endif /* __ASM__ */
|
#endif /* __ASM__ */
|
||||||
#endif /* _APIC_H_ */
|
#endif /* _APIC_H_ */
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,9 @@ void ap_kmain(struct limine_smp_info *info)
|
||||||
idt_load();
|
idt_load();
|
||||||
cr3_write(kcr3);
|
cr3_write(kcr3);
|
||||||
|
|
||||||
|
/* enable the APIC */
|
||||||
|
lapic_enable();
|
||||||
|
|
||||||
void *kstack = buddy_alloc(KSTACK_SIZE);
|
void *kstack = buddy_alloc(KSTACK_SIZE);
|
||||||
uintptr_t ptr = (uintptr_t)kstack + KSTACK_SIZE - 8;
|
uintptr_t ptr = (uintptr_t)kstack + KSTACK_SIZE - 8;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue