Ticket #1925: 1925-page-mapper-debug-output.diff

File 1925-page-mapper-debug-output.diff, 3.0 KB (added by bonefish, 14 years ago)

patch: additional debug output in LargeMemoryPhysicalPageMapper

  • src/system/kernel/arch/x86/x86_physical_page_mapper_large_memory.cpp

     
    480480LargeMemoryPhysicalPageMapper::Init(kernel_args* args,
    481481    TranslationMapPhysicalPageMapper*& _kernelPageMapper)
    482482{
     483dprintf("%p->LargeMemoryPhysicalPageMapper::Init()\n", this);
    483484    // We reserve more, so that we can guarantee to align the base address
    484485    // to page table ranges.
    485486    addr_t virtualBase = vm_allocate_early(args,
     
    489490            "physical page pool space in virtual address space!");
    490491        return B_ERROR;
    491492    }
     493dprintf("  reserved page pool space: %#" B_PRIxADDR "\n", virtualBase);
    492494    virtualBase = (virtualBase + kPageTableAlignment - 1)
    493495        / kPageTableAlignment * kPageTableAlignment;
     496dprintf("  aligned page pool space: %#" B_PRIxADDR "\n", virtualBase);
    494497
    495498    // allocate memory for the page table and data
    496499    size_t areaSize = B_PAGE_SIZE + sizeof(PhysicalPageSlot[1024]);
    497500    page_table_entry* pageTable = (page_table_entry*)vm_allocate_early(args,
    498501        areaSize, ~0L, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, false);
     502dprintf("  allocated memory for page table and data: %p (%" B_PRIuSIZE
     503" bytes)\n", pageTable, areaSize);
    499504
    500505    // prepare the page table
    501506    x86_early_prepare_page_tables(pageTable, virtualBase,
     
    506511    fNonEmptyPools.Add(&fInitialPool);
    507512
    508513    // get the debug slot
    509     GetSlot(true, fDebugSlot);
     514    status_t error = GetSlot(true, fDebugSlot);
     515dprintf("  GetSlot() returned: %s, fDebugSlot: %p\n", strerror(error), fDebugSlot);
    510516
    511517    // init the kernel translation map physical page mapper
    512     status_t error = fKernelMapper.Init();
     518    error = fKernelMapper.Init();
    513519    if (error != B_OK) {
    514520        panic("LargeMemoryPhysicalPageMapper::Init(): Failed to init "
    515521            "kernel translation map physical page mapper!");
     
    522528    for (int32 i = 0; i < cpuCount; i++)
    523529        fPerCPUData[i].Init();
    524530
     531dprintf("LargeMemoryPhysicalPageMapper::Init() done\n");
    525532    return B_OK;
    526533}
    527534
     
    802809    PhysicalPageSlot*& slot)
    803810{
    804811    MutexLocker locker(fLock);
     812dprintf("LargeMemoryPhysicalPageMapper::GetSlot(%d)\n", canWait);
    805813
    806814    PhysicalPageSlotPool* pool = fNonEmptyPools.Head();
    807815    if (pool == NULL) {
     816dprintf("  no non-empty pool\n");
    808817        if (!canWait)
    809818            return B_WOULD_BLOCK;
    810819
     
    812821        locker.Unlock();
    813822        status_t error = _AllocatePool(pool);
    814823        if (error != B_OK)
     824{
     825dprintf("LargeMemoryPhysicalPageMapper::GetSlot(): failed to allocate new pool: %s\n", strerror(error));
    815826            return error;
     827}
    816828        locker.Lock();
     829dprintf("  allocated pool %p\n", pool);
    817830
    818831        fNonEmptyPools.Add(pool);
    819832        pool = fNonEmptyPools.Head();
    820833    }
    821834
     835dprintf("  got pool %p\n", pool);
     836
    822837    slot = pool->GetSlot();
     838dprintf("  got slot %p\n", slot);
    823839
    824840    if (pool->IsEmpty()) {
    825841        fNonEmptyPools.Remove(pool);
    826842        fEmptyPools.Add(pool);
    827843    }
    828844
     845dprintf("LargeMemoryPhysicalPageMapper::GetSlot() done: %p\n", slot);
    829846    return B_OK;
    830847}
    831848