Skip the shitty e1000s on c89
[akaros.git] / kern / arch / x86 / pmap32.c
index 8765121..526202b 100644 (file)
@@ -211,10 +211,10 @@ vm_init(void)
 
        // APIC mapping: using PAT (but not *the* PAT flag) to make these type UC
        // IOAPIC
-       boot_map_segment(pgdir, IOAPIC_BASE, PGSIZE, IOAPIC_PBASE, 
+       boot_map_segment(pgdir, IOAPIC_BASE, APIC_SIZE, IOAPIC_PBASE,
                         PTE_PCD | PTE_PWT | PTE_W | PTE_G);
        // Local APIC
-       boot_map_segment(pgdir, LAPIC_BASE, PGSIZE, LAPIC_PBASE,
+       boot_map_segment(pgdir, LAPIC_BASE, APIC_SIZE, LAPIC_PBASE,
                         PTE_PCD | PTE_PWT | PTE_W | PTE_G);
 
        // Check that the initial page directory has been set up correctly.
@@ -276,6 +276,16 @@ vm_init(void)
 
        // Flush the TLB for good measure, to kill the pgdir[0] mapping.
        tlb_flush_global();
+       core_id_ready = TRUE;
+}
+
+void x86_cleanup_bootmem(void)
+{
+       #define trampoline_pg 0x00001000UL
+       // Remove the mapping of the page used by the trampoline
+       page_remove(boot_pgdir, (void*)trampoline_pg);
+       // Remove the page table used for that mapping
+       pagetable_remove(boot_pgdir, (void*)trampoline_pg);
 }
 
 //
@@ -637,7 +647,7 @@ int env_user_mem_walk(env_t* e, void* start, size_t len,
        physaddr_t pa;
 
        assert((uintptr_t)start % PGSIZE == 0 && len % PGSIZE == 0);
-       void* end = (char*)start+len;
+       uintptr_t end = (uintptr_t)start+len;
        uint32_t pdeno_start = PDX(start);
        uint32_t pdeno_end = PDX(ROUNDUP(end,PTSIZE));
        /* concerned about overflow.  this should catch it for now, given the above
@@ -656,9 +666,8 @@ int env_user_mem_walk(env_t* e, void* start, size_t len,
                                      PTX(end) : NPTENTRIES );
                int ret;
                for (pteno = pteno_start; pteno < pteno_end; pteno++) {
-                       if (!PAGE_UNMAPPED(pt[pteno]))
-                               if((ret = callback(e, &pt[pteno], PGADDR(pdeno, pteno, 0), arg)))
-                                       return ret;
+                       if((ret = callback(e, &pt[pteno], PGADDR(pdeno, pteno, 0), arg)))
+                               return ret;
                }
        }
        return 0;