[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 18/22] libxc/xen: introduce HVM_PARAM_CMDLINE_PFN
This HVM parameter returns a PFN that contains the address of the memory page where the guest command line has been placed. 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> Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- tools/libxc/xc_dom_x86.c | 21 ++++++++++++++++++++- xen/arch/x86/hvm/hvm.c | 1 + xen/include/public/hvm/params.h | 5 ++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c index 1195400..41ff7a4 100644 --- a/tools/libxc/xc_dom_x86.c +++ b/tools/libxc/xc_dom_x86.c @@ -57,7 +57,8 @@ #define SPECIALPAGE_IOREQ 5 #define SPECIALPAGE_IDENT_PT 6 #define SPECIALPAGE_CONSOLE 7 -#define NR_SPECIAL_PAGES 8 +#define SPECIALPAGE_CMDLINE 8 +#define NR_SPECIAL_PAGES 9 #define LAST_SPECIAL_PFN 0xff000u #define NR_IOREQ_SERVER_PAGES 8 @@ -531,6 +532,7 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom) xen_pfn_t special_array[NR_SPECIAL_PAGES]; xen_pfn_t ioreq_server_array[NR_IOREQ_SERVER_PAGES]; xc_interface *xch = dom->xch; + char *cmdline; if ( dom->emulation ) { @@ -572,6 +574,23 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom) xc_hvm_param_set(xch, domid, HVM_PARAM_SHARING_RING_PFN, special_pfn(SPECIALPAGE_SHARING, dom)); + if ( dom->cmdline ) + { + cmdline = xc_map_foreign_range( + xch, domid, PAGE_SIZE, PROT_READ | PROT_WRITE, + special_pfn(SPECIALPAGE_CMDLINE, dom)); + if ( cmdline == NULL ) { + DOMPRINTF("Unable to map command line page"); + goto error_out; + } + + strncpy(cmdline, dom->cmdline, MAX_GUEST_CMDLINE); + cmdline[MAX_GUEST_CMDLINE - 1] = '\0'; + munmap(cmdline, PAGE_SIZE); + xc_hvm_param_set(xch, domid, HVM_PARAM_CMDLINE_PFN, + special_pfn(SPECIALPAGE_CMDLINE, dom)); + } + if ( dom->emulation ) { /* diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 7aefcf8..945f42e 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -5900,6 +5900,7 @@ static int hvm_allow_get_param(struct domain *d, case HVM_PARAM_STORE_EVTCHN: case HVM_PARAM_CONSOLE_PFN: case HVM_PARAM_CONSOLE_EVTCHN: + case HVM_PARAM_CMDLINE_PFN: break; /* * The following parameters must not be read by the guest diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h index 7c73089..b7f8839 100644 --- a/xen/include/public/hvm/params.h +++ b/xen/include/public/hvm/params.h @@ -187,6 +187,9 @@ /* Location of the VM Generation ID in guest physical address space. */ #define HVM_PARAM_VM_GENERATION_ID_ADDR 34 -#define HVM_NR_PARAMS 35 +/* PFN of the command line. */ +#define HVM_PARAM_CMDLINE_PFN 35 + +#define HVM_NR_PARAMS 36 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ -- 1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |