@@ -176,21 +176,6 @@ static void cmos_write_memory_size(void)
cmos_outb(0x35, (uint8_t)( alt_mem >> 8));
}
-/*
- * Set up an empty TSS area for virtual 8086 mode to use.
- * The only important thing is that it musn't have any bits set
- * in the interrupt redirection bitmap, so all zeros will do.
- */
-static void init_vm86_tss(void)
-{
- void *tss;
-
- tss = mem_alloc(128, 128);
- memset(tss, 0, 128);
- hvm_param_set(HVM_PARAM_VM86_TSS, virt_to_phys(tss));
- printf("vm86 TSS at %08lx\n", virt_to_phys(tss));
-}
-
static void apic_setup(void)
{
/*
@@ -398,8 +383,6 @@ int main(void)
hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 1);
}
- init_vm86_tss();
-
cmos_write_memory_size();
printf("BIOS map:\n");
@@ -20,7 +20,7 @@
#include <xenguest.h>
#define INVALID_PFN ((xen_pfn_t)-1)
-#define X86_HVM_NR_SPECIAL_PAGES 8
+#define X86_HVM_NR_SPECIAL_PAGES 9
#define X86_HVM_END_SPECIAL_REGION 0xff000u
/* --- typedefs and structs ---------------------------------------- */
@@ -59,6 +59,7 @@
#define SPECIALPAGE_IOREQ 5
#define SPECIALPAGE_IDENT_PT 6
#define SPECIALPAGE_CONSOLE 7
+#define SPECIALPAGE_VM86TSS 8
#define special_pfn(x) \
(X86_HVM_END_SPECIAL_REGION - X86_HVM_NR_SPECIAL_PAGES + (x))
@@ -590,6 +591,7 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom)
{
unsigned long i;
uint32_t *ident_pt, domid = dom->guest_domid;
+ void *tss;
int rc;
xen_pfn_t special_array[X86_HVM_NR_SPECIAL_PAGES];
xen_pfn_t ioreq_server_array[NR_IOREQ_SERVER_PAGES];
@@ -699,6 +701,20 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom)
xc_hvm_param_set(xch, domid, HVM_PARAM_IDENT_PT,
special_pfn(SPECIALPAGE_IDENT_PT) << PAGE_SHIFT);
+ /*
+ * Set up an empty TSS area for virtual 8086 mode to use.
+ * The only important thing is that it musn't have any bits set
+ * in the interrupt redirection bitmap, so all zeros will do.
+ */
+ if ( (tss = xc_map_foreign_range(
+ xch, domid, PAGE_SIZE, PROT_READ | PROT_WRITE,
+ special_pfn(SPECIALPAGE_VM86TSS))) == NULL )
+ goto error_out;
+ memset(tss, 0, 128);
+ munmap(tss, PAGE_SIZE);
+ xc_hvm_param_set(xch, domid, HVM_PARAM_VM86_TSS,
+ special_pfn(SPECIALPAGE_VM86TSS) << PAGE_SHIFT);
+
dom->console_pfn = special_pfn(SPECIALPAGE_CONSOLE);
dom->xenstore_pfn = special_pfn(SPECIALPAGE_XENSTORE);
dom->parms.virt_hypercall = -1;
This is also required for PVHv2 guests if they want to use real-mode, and hvmloader is not executed for those kind of guests. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Cc: Jan Beulich <jbeulich@suse.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Wei Liu <wei.liu2@citrix.com> --- tools/firmware/hvmloader/hvmloader.c | 17 ----------------- tools/libxc/include/xc_dom.h | 2 +- tools/libxc/xc_dom_x86.c | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 18 deletions(-)