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....@citrix.com> > Cc: Ian Jackson <ian.jack...@eu.citrix.com> > Cc: Stefano Stabellini <stefano.stabell...@eu.citrix.com> > Cc: Ian Campbell <ian.campb...@citrix.com> > Cc: Wei Liu <wei.l...@citrix.com>
Reviewed-by: Andrew Cooper <andrew.coop...@citrix.com>, 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@lists.xen.org http://lists.xen.org/xen-devel