Revision 31ab2b4a

b/exec.c
459 459

  
460 460
static MemoryRegionSection phys_page_find(target_phys_addr_t index)
461 461
{
462
    uint16_t *p = phys_page_find_alloc(index, 0);
463
    uint16_t s_index = phys_section_unassigned;
462
    PhysPageEntry lp = phys_map;
463
    PhysPageEntry *p;
464
    int i;
464 465
    MemoryRegionSection section;
465 466
    target_phys_addr_t delta;
467
    uint16_t s_index = phys_section_unassigned;
466 468

  
467
    if (p) {
468
        s_index = *p;
469
    for (i = P_L2_LEVELS - 1; i >= 0; i--) {
470
        if (lp.u.node == PHYS_MAP_NODE_NIL) {
471
            goto not_found;
472
        }
473
        p = phys_map_nodes[lp.u.node];
474
        lp = p[(index >> (i * L2_BITS)) & (L2_SIZE - 1)];
469 475
    }
476

  
477
    s_index = lp.u.leaf;
478
not_found:
470 479
    section = phys_sections[s_index];
471 480
    index <<= TARGET_PAGE_BITS;
472 481
    assert(section.offset_within_address_space <= index

Also available in: Unified diff