WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 14 of 19] tools: hvmloader: Refactor VM86 and E820 se

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 14 of 19] tools: hvmloader: Refactor VM86 and E820 setup into struct bios_config
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 12 Apr 2011 12:29:13 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Tue, 12 Apr 2011 04:54:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1302607739@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1302607739@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1302602711 -3600
# Node ID 31e9da762b1ebd22b5ed68d3a15ea56f4a41d63c
# Parent  99d1e52175a3d7770ab0cfe286133cf84954cf8d
tools: hvmloader: Refactor VM86 and E820 setup into struct bios_config

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 99d1e52175a3 -r 31e9da762b1e tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h Tue Apr 12 10:56:46 2011 +0100
+++ b/tools/firmware/hvmloader/config.h Tue Apr 12 11:05:11 2011 +0100
@@ -31,6 +31,9 @@ struct bios_config {
 
     uint32_t (*bios_high_setup)(void);
     void (*bios_info_setup)(uint32_t);
+
+    void (*vm86_setup)(void);
+    void (*e820_setup)(void);
 };
 
 extern struct bios_config rombios_config;
@@ -62,9 +65,6 @@ extern unsigned long pci_mem_start, pci_
 #define ROMBIOS_MAXOFFSET      0x0000FFFF
 #define ROMBIOS_END            (ROMBIOS_BEGIN + ROMBIOS_SIZE)
 
-#include "e820.h"
-#include "../rombios/config.h"
-
 #define SCRATCH_PHYSICAL_ADDRESS      0x00010000
 #define HYPERCALL_PHYSICAL_ADDRESS    0x00080000
 
diff -r 99d1e52175a3 -r 31e9da762b1e tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Tue Apr 12 10:56:46 2011 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c      Tue Apr 12 11:05:11 2011 +0100
@@ -338,24 +338,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;
-    struct xen_hvm_param p;
-
-    tss = mem_alloc(128, 128);
-    memset(tss, 0, 128);
-    p.domid = DOMID_SELF;
-    p.index = HVM_PARAM_VM86_TSS;
-    p.value = virt_to_phys(tss);
-    hypercall_hvm_op(HVMOP_set_param, &p);
-    printf("vm86 TSS at %08lx\n", virt_to_phys(tss));
-}
 
 static const struct bios_config *detect_bios(void)
 {
@@ -454,7 +436,8 @@ int main(void)
         hypercall_hvm_op(HVMOP_set_param, &p);
     }
 
-    init_vm86_tss();
+    if (bios->vm86_setup)
+        bios->vm86_setup();
 
     cmos_write_memory_size();
 
@@ -479,8 +462,8 @@ int main(void)
            bios->bios_address,
            bios->bios_address + bios->image_size - 1);
 
-    *E820_NR = build_e820_table(E820);
-    dump_e820_table(E820, *E820_NR);
+    if (bios->e820_setup)
+        bios->e820_setup();
 
     if (bios->bios_info_setup)
         bios->bios_info_setup(highbios);
diff -r 99d1e52175a3 -r 31e9da762b1e tools/firmware/hvmloader/rombios.c
--- a/tools/firmware/hvmloader/rombios.c        Tue Apr 12 10:56:46 2011 +0100
+++ b/tools/firmware/hvmloader/rombios.c        Tue Apr 12 11:05:11 2011 +0100
@@ -30,12 +30,38 @@
 #include "util.h"
 #include "hypercall.h"
 
+#include <xen/hvm/params.h>
 #include <xen/hvm/ioreq.h>
 #include <xen/memory.h>
 
 #define ROM_INCLUDE_ROMBIOS
 #include "roms.inc"
 
+/*
+ * 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 rombios_init_vm86_tss(void)
+{
+    void *tss;
+    struct xen_hvm_param p;
+
+    tss = mem_alloc(128, 128);
+    memset(tss, 0, 128);
+    p.domid = DOMID_SELF;
+    p.index = HVM_PARAM_VM86_TSS;
+    p.value = virt_to_phys(tss);
+    hypercall_hvm_op(HVMOP_set_param, &p);
+    printf("vm86 TSS at %08lx\n", virt_to_phys(tss));
+}
+
+static void rombios_setup_e820(void)
+{
+    *E820_NR = build_e820_table(E820);
+    dump_e820_table(E820, *E820_NR);
+}
+
 static void rombios_setup_bios_info(uint32_t bioshigh)
 {
     struct bios_info *bios_info;
@@ -301,6 +327,9 @@ struct bios_config rombios_config =  {
 
     .bios_high_setup = rombios_highbios_setup,
     .bios_info_setup = rombios_setup_bios_info,
+
+    .vm86_setup = rombios_init_vm86_tss,
+    .e820_setup = rombios_setup_e820,
 };
 
 /*

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>