[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 01/32] libxc: split x86 HVM setup_guest into smaller logical functions



On 03/07/15 12:34, Roger Pau Monne wrote:
> This is just a preparatory change to clean up the code in setup_guest.
> Should not introduce any functional changes.
>
> Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>

Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, with one note.

> @@ -576,6 +584,44 @@ static int setup_guest(xc_interface *xch,
>          goto error_out;
>      }
>  
> +    /* Insert JMP <rel32> instruction at address 0x0 to reach entry point. */
> +    entry_eip = elf_uval(&elf, elf.ehdr, e_entry);
> +    if ( entry_eip != 0 )
> +    {
> +        char *page0 = xc_map_foreign_range(
> +            xch, dom, PAGE_SIZE, PROT_READ | PROT_WRITE, 0);
> +        if ( page0 == NULL )
> +            goto error_out;
> +        page0[0] = 0xe9;
> +        *(uint32_t *)&page0[1] = entry_eip - 5;
> +        munmap(page0, PAGE_SIZE);
> +    }

With this series eventually enabling DOMCTL_setvcpucontext properly for
HVM vcpus, this above juggling can be replaced by setting the starting
eip appropriately, which is neater than stuffing a hand-coded
instruction in at 0.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.