static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc)

{

    void **lp, **p;



    p = (void **)l1_phys_map;

#if TARGET_PHYS_ADDR_SPACE_BITS > 32



#if TARGET_PHYS_ADDR_SPACE_BITS > (32 + L1_BITS)

#error unsupported TARGET_PHYS_ADDR_SPACE_BITS

#endif

    lp = p + ((index >> (L1_BITS + L2_BITS)) & (L1_SIZE - 1));

    p = *lp;

    if (!p) {

        /* allocate if not found */

        if (!alloc)

            return NULL;

        p = qemu_vmalloc(sizeof(void *) * L1_SIZE);

        memset(p, 0, sizeof(void *) * L1_SIZE);

        *lp = p;

    }

#endif

    lp = p + ((index >> L2_BITS) & (L1_SIZE - 1));

    p = *lp;

    if (!p) {

        /* allocate if not found */

        if (!alloc)

            return NULL;

        p = qemu_vmalloc(sizeof(PhysPageDesc) * L2_SIZE);

        memset(p, 0, sizeof(PhysPageDesc) * L2_SIZE);

        *lp = p;

    }

    return ((PhysPageDesc *)p) + (index & (L2_SIZE - 1));

}

static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc)

{

    void **lp, **p;



    p = (void **)l1_phys_map;

#if TARGET_PHYS_ADDR_SPACE_BITS > 32



#if TARGET_PHYS_ADDR_SPACE_BITS > (32 + L1_BITS)

#error unsupported TARGET_PHYS_ADDR_SPACE_BITS

#endif

    lp = p + ((index >> (L1_BITS + L2_BITS)) & (L1_SIZE - 1));

    p = *lp;

    if (!p) {

        

        if (!alloc)

            return NULL;

        p = qemu_vmalloc(sizeof(void *) * L1_SIZE);

        memset(p, 0, sizeof(void *) * L1_SIZE);

        *lp = p;

    }

#endif

    lp = p + ((index >> L2_BITS) & (L1_SIZE - 1));

    p = *lp;

    if (!p) {

        

        if (!alloc)

            return NULL;

        p = qemu_vmalloc(sizeof(PhysPageDesc) * L2_SIZE);

        memset(p, 0, sizeof(PhysPageDesc) * L2_SIZE);

        *lp = p;

    }

    return ((PhysPageDesc *)p) + (index & (L2_SIZE - 1));

}

static PhysPageDesc *FUNC_0(target_phys_addr_t index, int alloc)

{

    void **VAR_0, **VAR_1;



    VAR_1 = (void **)l1_phys_map;

#if TARGET_PHYS_ADDR_SPACE_BITS > 32



#if TARGET_PHYS_ADDR_SPACE_BITS > (32 + L1_BITS)

#error unsupported TARGET_PHYS_ADDR_SPACE_BITS

#endif

    VAR_0 = VAR_1 + ((index >> (L1_BITS + L2_BITS)) & (L1_SIZE - 1));

    VAR_1 = *VAR_0;

    if (!VAR_1) {

        

        if (!alloc)

            return NULL;

        VAR_1 = qemu_vmalloc(sizeof(void *) * L1_SIZE);

        memset(VAR_1, 0, sizeof(void *) * L1_SIZE);

        *VAR_0 = VAR_1;

    }

#endif

    VAR_0 = VAR_1 + ((index >> L2_BITS) & (L1_SIZE - 1));

    VAR_1 = *VAR_0;

    if (!VAR_1) {

        

        if (!alloc)

            return NULL;

        VAR_1 = qemu_vmalloc(sizeof(PhysPageDesc) * L2_SIZE);

        memset(VAR_1, 0, sizeof(PhysPageDesc) * L2_SIZE);

        *VAR_0 = VAR_1;

    }

    return ((PhysPageDesc *)VAR_1) + (index & (L2_SIZE - 1));

}

static PhysPageDesc *FUNC_0(target_phys_addr_t index, int alloc)
{ void **VAR_0, **VAR_1; VAR_1 = (void **)l1_phys_map; #if TARGET_PHYS_ADDR_SPACE_BITS > 32
#if TARGET_PHYS_ADDR_SPACE_BITS > (32 + L1_BITS)
#error unsupported TARGET_PHYS_ADDR_SPACE_BITS
#endif
VAR_0 = VAR_1 + ((index >> (L1_BITS + L2_BITS)) & (L1_SIZE - 1)); VAR_1 = *VAR_0; if (!VAR_1) { if (!alloc)
return NULL; VAR_1 = qemu_vmalloc(sizeof(void *) * L1_SIZE); memset(VAR_1, 0, sizeof(void *) * L1_SIZE); *VAR_0 = VAR_1; } #endif
VAR_0 = VAR_1 + ((index >> L2_BITS) & (L1_SIZE - 1)); VAR_1 = *VAR_0; if (!VAR_1) { if (!alloc)
return NULL; VAR_1 = qemu_vmalloc(sizeof(PhysPageDesc) * L2_SIZE); memset(VAR_1, 0, sizeof(PhysPageDesc) * L2_SIZE); *VAR_0 = VAR_1; } return ((PhysPageDesc *)VAR_1) + (index & (L2_SIZE - 1)); }