ia64/xen-unstable

changeset 12954:95cf2e3e7e0a

[TOOLS][POWERPC] oops, forgot load_elf_kernel()
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Wed Oct 18 11:29:57 2006 -0400 (2006-10-18)
parents 1a3c1168db6a
children b0293bc59835
files tools/libxc/powerpc64/utils.c
line diff
     1.1 --- a/tools/libxc/powerpc64/utils.c	Wed Oct 18 09:01:37 2006 -0400
     1.2 +++ b/tools/libxc/powerpc64/utils.c	Wed Oct 18 11:29:57 2006 -0400
     1.3 @@ -160,3 +160,52 @@ void *load_file(const char *path, unsign
     1.4      close(fd);
     1.5      return img;
     1.6  }
     1.7 +
     1.8 +int load_elf_kernel(
     1.9 +    int xc_handle,
    1.10 +    int domid,
    1.11 +    const char *kernel_path,
    1.12 +    struct domain_setup_info *dsi,
    1.13 +    xen_pfn_t *page_array)
    1.14 +{
    1.15 +    struct load_funcs load_funcs;
    1.16 +    char *kernel_img;
    1.17 +    unsigned long kernel_size;
    1.18 +    int rc;
    1.19 +
    1.20 +    /* load the kernel ELF file */
    1.21 +    kernel_img = load_file(kernel_path, &kernel_size);
    1.22 +    if (kernel_img == NULL) {
    1.23 +        rc = -1;
    1.24 +        goto out;
    1.25 +    }
    1.26 +
    1.27 +    DPRINTF("probe_elf\n");
    1.28 +    rc = probe_elf(kernel_img, kernel_size, &load_funcs);
    1.29 +    if (rc < 0) {
    1.30 +        rc = -1;
    1.31 +        printf("%s is not an ELF file\n", kernel_path);
    1.32 +        goto out;
    1.33 +    }
    1.34 +
    1.35 +    DPRINTF("parseimage\n");
    1.36 +    rc = (load_funcs.parseimage)(kernel_img, kernel_size, dsi);
    1.37 +    if (rc < 0) {
    1.38 +        rc = -1;
    1.39 +        goto out;
    1.40 +    }
    1.41 +
    1.42 +    DPRINTF("loadimage\n");
    1.43 +    (load_funcs.loadimage)(kernel_img, kernel_size, xc_handle, domid,
    1.44 +            page_array, dsi);
    1.45 +
    1.46 +    DPRINTF("  v_start     %016"PRIx64"\n", dsi->v_start);
    1.47 +    DPRINTF("  v_end       %016"PRIx64"\n", dsi->v_end);
    1.48 +    DPRINTF("  v_kernstart %016"PRIx64"\n", dsi->v_kernstart);
    1.49 +    DPRINTF("  v_kernend   %016"PRIx64"\n", dsi->v_kernend);
    1.50 +    DPRINTF("  v_kernentry %016"PRIx64"\n", dsi->v_kernentry);
    1.51 +
    1.52 +out:
    1.53 +    free(kernel_img);
    1.54 +    return rc;
    1.55 +}