void *qemu_ram_ptr_length(target_phys_addr_t addr, target_phys_addr_t *size)

{

    if (xen_enabled()) {

        return xen_map_cache(addr, *size, 1);

    } else {

        RAMBlock *block;



        QLIST_FOREACH(block, &ram_list.blocks, next) {

            if (addr - block->offset < block->length) {

                if (addr - block->offset + *size > block->length)

                    *size = block->length - addr + block->offset;

                return block->host + (addr - block->offset);

            }

        }



        fprintf(stderr, "Bad ram offset %" PRIx64 "\n", (uint64_t)addr);

        abort();



        *size = 0;

        return NULL;

    }

}

void *qemu_ram_ptr_length(target_phys_addr_t addr, target_phys_addr_t *size)

{

    if (xen_enabled()) {

        return xen_map_cache(addr, *size, 1);

    } else {

        RAMBlock *block;



        QLIST_FOREACH(block, &ram_list.blocks, next) {

            if (addr - block->offset < block->length) {

                if (addr - block->offset + *size > block->length)

                    *size = block->length - addr + block->offset;

                return block->host + (addr - block->offset);

            }

        }



        fprintf(stderr, "Bad ram offset %" PRIx64 "\n", (uint64_t)addr);

        abort();



        *size = 0;

        return NULL;

    }

}

void *FUNC_0(target_phys_addr_t VAR_0, target_phys_addr_t *VAR_1)

{

    if (xen_enabled()) {

        return xen_map_cache(VAR_0, *VAR_1, 1);

    } else {

        RAMBlock *block;



        QLIST_FOREACH(block, &ram_list.blocks, next) {

            if (VAR_0 - block->offset < block->length) {

                if (VAR_0 - block->offset + *VAR_1 > block->length)

                    *VAR_1 = block->length - VAR_0 + block->offset;

                return block->host + (VAR_0 - block->offset);

            }

        }



        fprintf(stderr, "Bad ram offset %" PRIx64 "\n", (uint64_t)VAR_0);

        abort();



        *VAR_1 = 0;

        return NULL;

    }

}

void *FUNC_0(target_phys_addr_t VAR_0, target_phys_addr_t *VAR_1)
{ if (xen_enabled()) { return xen_map_cache(VAR_0, *VAR_1, 1); } else { RAMBlock *block; QLIST_FOREACH(block, &ram_list.blocks, next) { if (VAR_0 - block->offset < block->length) { if (VAR_0 - block->offset + *VAR_1 > block->length)
*VAR_1 = block->length - VAR_0 + block->offset; return block->host + (VAR_0 - block->offset); } } fprintf(stderr, "Bad ram offset %" PRIx64 "\n", (uint64_t)VAR_0); abort(); *VAR_1 = 0; return NULL; } }