static void map_page(uint8_t **ptr, uint64_t addr, uint32_t wanted)

{

    target_phys_addr_t len = wanted;



    if (*ptr) {

        cpu_physical_memory_unmap(*ptr, len, 1, len);

    }



    *ptr = cpu_physical_memory_map(addr, &len, 1);

    if (len < wanted) {

        cpu_physical_memory_unmap(*ptr, len, 1, len);

        *ptr = NULL;

    }

}

static void map_page(uint8_t **ptr, uint64_t addr, uint32_t wanted)

{

    target_phys_addr_t len = wanted;



    if (*ptr) {

        cpu_physical_memory_unmap(*ptr, len, 1, len);

    }



    *ptr = cpu_physical_memory_map(addr, &len, 1);

    if (len < wanted) {

        cpu_physical_memory_unmap(*ptr, len, 1, len);

        *ptr = NULL;

    }

}

static void FUNC_0(uint8_t **VAR_0, uint64_t VAR_1, uint32_t VAR_2)

{

    target_phys_addr_t len = VAR_2;



    if (*VAR_0) {

        cpu_physical_memory_unmap(*VAR_0, len, 1, len);

    }



    *VAR_0 = cpu_physical_memory_map(VAR_1, &len, 1);

    if (len < VAR_2) {

        cpu_physical_memory_unmap(*VAR_0, len, 1, len);

        *VAR_0 = NULL;

    }

}

static void FUNC_0(uint8_t **VAR_0, uint64_t VAR_1, uint32_t VAR_2)
{ target_phys_addr_t len = VAR_2; if (*VAR_0) { cpu_physical_memory_unmap(*VAR_0, len, 1, len); } *VAR_0 = cpu_physical_memory_map(VAR_1, &len, 1); if (len < VAR_2) { cpu_physical_memory_unmap(*VAR_0, len, 1, len); *VAR_0 = NULL; } }