static void cpu_openrisc_load_kernel(ram_addr_t ram_size,

                                     const char *kernel_filename,

                                     OpenRISCCPU *cpu)

{

    long kernel_size;

    uint64_t elf_entry;

    hwaddr entry;



    if (kernel_filename && !qtest_enabled()) {

        kernel_size = load_elf(kernel_filename, NULL, NULL,

                               &elf_entry, NULL, NULL, 1, EM_OPENRISC,

                               1, 0);

        entry = elf_entry;

        if (kernel_size < 0) {

            kernel_size = load_uimage(kernel_filename,

                                      &entry, NULL, NULL, NULL, NULL);

        }

        if (kernel_size < 0) {

            kernel_size = load_image_targphys(kernel_filename,

                                              KERNEL_LOAD_ADDR,

                                              ram_size - KERNEL_LOAD_ADDR);

            entry = KERNEL_LOAD_ADDR;

        }



        if (kernel_size < 0) {

            fprintf(stderr, "QEMU: couldn't load the kernel '%s'\n",

                    kernel_filename);

            exit(1);

        }

        cpu->env.pc = entry;

    }

}

static void cpu_openrisc_load_kernel(ram_addr_t ram_size,

                                     const char *kernel_filename,

                                     OpenRISCCPU *cpu)

{

    long kernel_size;

    uint64_t elf_entry;

    hwaddr entry;



    if (kernel_filename && !qtest_enabled()) {

        kernel_size = load_elf(kernel_filename, NULL, NULL,

                               &elf_entry, NULL, NULL, 1, EM_OPENRISC,

                               1, 0);

        entry = elf_entry;

        if (kernel_size < 0) {

            kernel_size = load_uimage(kernel_filename,

                                      &entry, NULL, NULL, NULL, NULL);

        }

        if (kernel_size < 0) {

            kernel_size = load_image_targphys(kernel_filename,

                                              KERNEL_LOAD_ADDR,

                                              ram_size - KERNEL_LOAD_ADDR);

            entry = KERNEL_LOAD_ADDR;

        }



        if (kernel_size < 0) {

            fprintf(stderr, "QEMU: couldn't load the kernel '%s'\n",

                    kernel_filename);

            exit(1);

        }

        cpu->env.pc = entry;

    }

}

static void FUNC_0(ram_addr_t VAR_0,

                                     const char *VAR_1,

                                     OpenRISCCPU *VAR_2)

{

    long VAR_3;

    uint64_t elf_entry;

    hwaddr entry;



    if (VAR_1 && !qtest_enabled()) {

        VAR_3 = load_elf(VAR_1, NULL, NULL,

                               &elf_entry, NULL, NULL, 1, EM_OPENRISC,

                               1, 0);

        entry = elf_entry;

        if (VAR_3 < 0) {

            VAR_3 = load_uimage(VAR_1,

                                      &entry, NULL, NULL, NULL, NULL);

        }

        if (VAR_3 < 0) {

            VAR_3 = load_image_targphys(VAR_1,

                                              KERNEL_LOAD_ADDR,

                                              VAR_0 - KERNEL_LOAD_ADDR);

            entry = KERNEL_LOAD_ADDR;

        }



        if (VAR_3 < 0) {

            fprintf(stderr, "QEMU: couldn't load the kernel '%s'\n",

                    VAR_1);

            exit(1);

        }

        VAR_2->env.pc = entry;

    }

}

static void FUNC_0(ram_addr_t VAR_0,
const char *VAR_1,
OpenRISCCPU *VAR_2)
{ long VAR_3; uint64_t elf_entry; hwaddr entry; if (VAR_1 && !qtest_enabled()) { VAR_3 = load_elf(VAR_1, NULL, NULL,
&elf_entry, NULL, NULL, 1, EM_OPENRISC,
1, 0); entry = elf_entry; if (VAR_3 < 0) { VAR_3 = load_uimage(VAR_1,
&entry, NULL, NULL, NULL, NULL); } if (VAR_3 < 0) { VAR_3 = load_image_targphys(VAR_1,
KERNEL_LOAD_ADDR,
VAR_0 - KERNEL_LOAD_ADDR); entry = KERNEL_LOAD_ADDR; } if (VAR_3 < 0) { fprintf(stderr, "QEMU: couldn't load the kernel '%s'\n",
VAR_1); exit(1); } VAR_2->env.pc = entry; } }