Changeset 199


Ignore:
Timestamp:
Jul 13, 2017, 12:54:18 PM (4 years ago)
Author:
max@…
Message:

map the LAPIC and IOAPIC in a separate function

Location:
trunk/hal/x86_64/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/core/hal_apic.c

    r154 r199  
    298298        size_t i;
    299299
    300         ioapic_va = hal_gpt_bootstrap_valloc(1); // XXX: should be shared
    301 
    302         hal_gpt_enter(ioapic_va, ioapic_pa, PG_V|PG_KW|PG_NX|PG_N);
    303 
    304300        ver = hal_ioapic_read(IOAPICVER);
    305301        ioapic_pins = ((ver >> 16) & 0xFF) + 1;
     
    389385static void hal_lapic_init()
    390386{
    391         lapic_va = hal_gpt_bootstrap_valloc(1); // XXX: should be shared
    392 
    393387        if ((rdmsr(MSR_APICBASE) & APICBASE_PHYSADDR) != lapic_pa) {
    394388                x86_panic("APICBASE and ACPI don't match!\n");
    395389        }
    396390        wrmsr(MSR_APICBASE, lapic_pa | APICBASE_EN);
    397 
    398         hal_gpt_enter(lapic_va, lapic_pa, PG_V|PG_KW|PG_NX|PG_N);
    399391
    400392        hal_lapic_write(LAPIC_TPR, 0);
  • trunk/hal/x86_64/core/hal_init.c

    r195 r199  
    239239/* -------------------------------------------------------------------------- */
    240240
     241static void apic_map()
     242{
     243        extern vaddr_t lapic_va, ioapic_va;
     244        extern paddr_t lapic_pa, ioapic_pa;
     245
     246        lapic_va = hal_gpt_bootstrap_valloc(1); // XXX: should be shared
     247        hal_gpt_enter(lapic_va, lapic_pa, PG_V|PG_KW|PG_NX|PG_N);
     248
     249        ioapic_va = hal_gpt_bootstrap_valloc(1); // XXX: should be shared
     250        hal_gpt_enter(ioapic_va, ioapic_pa, PG_V|PG_KW|PG_NX|PG_N);
     251}
     252
    241253void init_x86_64(paddr_t firstpa)
    242254{
     
    272284        hal_gpt_bootstrap_reset();
    273285        x86_printf("[+] hal_gpt_bootstrap_reset called\n");
     286
     287        apic_map();
     288        x86_printf("[+] apic_map called\n");
    274289
    275290        hal_apic_init();
Note: See TracChangeset for help on using the changeset viewer.