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-changelog

[Xen-changelog] [PATCH] [PATCH] VMXassist print e820 table

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [PATCH] [PATCH] VMXassist print e820 table
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Tue, 28 Jun 2005 07:51:17 +0000
Cc: james@xxxxxxxxxxxxx
Delivery-date: Tue, 28 Jun 2005 08:03:00 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1763, 2005/06/28 08:51:17+01:00, leendert@xxxxxxxxxxxxxx

        [PATCH] [PATCH] VMXassist print e820 table
        
        This patch integrates some of my debug environment back into the main
        stream and it prints the e820 map as it is seen by a VMX domain.
        
                Leendert
        
        Signed-Off-By: Leendert van Doorn <leendert@xxxxxxxxxxxxxx>



 rombios/rombios.c |   14 ++++++++++++--
 vmxassist/setup.c |   27 ++++++++++++++++++++++++++-
 vmxassist/util.c  |   30 ++++++++++++++++++++++++++++++
 vmxassist/util.h  |   19 +++++++++++++++++++
 vmxassist/vm86.c  |    2 +-
 5 files changed, 88 insertions(+), 4 deletions(-)


diff -Nru a/tools/firmware/rombios/rombios.c b/tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c  2005-06-28 04:04:12 -04:00
+++ b/tools/firmware/rombios/rombios.c  2005-06-28 04:04:12 -04:00
@@ -27,6 +27,7 @@
 // ROM BIOS for use with Bochs/Plex x86 emulation environment
 
 #define VMXASSIST
+#undef VMXTEST
 
 // ROM BIOS compatability entry points:
 // ===================================
@@ -4070,10 +4071,10 @@
         switch(regs.u.r8.al)
         {
          case 0x20: // coded by osmaker aka K.J.
-            if(regs.u.r32.edx == 0x534D4150)
+            if(regs.u.r32.edx == 0x534D4150) /* SMAP */
             {
 #ifdef VMXASSIST
-               if ((regs.u.r16.bx / 0x14)* 0x14 == regs.u.r16.bx) {
+               if ((regs.u.r16.bx / 0x14) * 0x14 == regs.u.r16.bx) {
                    Bit16u e820_table_size = read_word(0xe000, 0x8) * 0x14;
 
                    if (regs.u.r16.bx + 0x14 <= e820_table_size) {
@@ -10353,8 +10354,17 @@
   HALT(__LINE__)
   iret
 
+#ifdef VMXTEST
+.org 0xffe0
+  jmp 0xf000:post;
+#endif
+
 .org 0xfff0 ; Power-up Entry Point
+#ifdef VMXTEST
+  jmp 0xd000:0x0003;
+#else
   jmp 0xf000:post
+#endif
 
 .org 0xfff5 ; ASCII Date ROM was built - 8 characters in MM/DD/YY
 .ascii BIOS_BUILD_DATE
diff -Nru a/tools/firmware/vmxassist/setup.c b/tools/firmware/vmxassist/setup.c
--- a/tools/firmware/vmxassist/setup.c  2005-06-28 04:04:12 -04:00
+++ b/tools/firmware/vmxassist/setup.c  2005-06-28 04:04:12 -04:00
@@ -46,7 +46,19 @@
 
 #ifdef TEST
 unsigned pgd[NR_PGD] __attribute__ ((aligned(PGSIZE))) = { 0 };
-#endif
+
+struct e820entry e820map[] = {
+       { 0x0000000000000000ULL, 0x000000000009F800ULL, E820_RAM },
+       { 0x000000000009F800ULL, 0x0000000000000800ULL, E820_RESERVED },
+       { 0x00000000000A0000ULL, 0x0000000000020000ULL, E820_IO },
+       { 0x00000000000C0000ULL, 0x0000000000040000ULL, E820_RESERVED },
+       { 0x0000000000100000ULL, 0x0000000000000000ULL, E820_RAM },
+       { 0x0000000000000000ULL, 0x0000000000001000ULL, E820_SHARED },
+       { 0x0000000000000000ULL, 0x0000000000003000ULL, E820_NVS },
+       { 0x0000000000003000ULL, 0x000000000000A000ULL, E820_ACPI },
+       { 0x00000000FEC00000ULL, 0x0000000001400000ULL, E820_IO },
+};
+#endif /* TEST */
 
 struct vmx_assist_context oldctx;
 struct vmx_assist_context newctx;
@@ -72,7 +84,20 @@
                    (((get_cmos(0x31) << 8) | get_cmos(0x30)) + 0x400) << 10;
        memory_size += 0x400 << 10; /* + 1MB */
 
+#ifdef TEST
+       /* Create an SMAP for our debug environment */
+       e820map[4].size = memory_size - e820map[4].addr - PGSIZE;
+       e820map[5].addr = memory_size - PGSIZE;
+       e820map[6].addr = memory_size;
+       e820map[7].addr += memory_size;
+
+       *LINUX_E820_MAP_NR = sizeof(e820map)/sizeof(e820map[0]);
+       memcpy(LINUX_E820_MAP, e820map, sizeof(e820map));
+#endif
+
        printf("Memory size %ld MB\n", memory_size >> 20);
+       printf("E820 map:\n");
+       print_e820_map(LINUX_E820_MAP, *LINUX_E820_MAP_NR);
        printf("\n");
 }
 
diff -Nru a/tools/firmware/vmxassist/util.c b/tools/firmware/vmxassist/util.c
--- a/tools/firmware/vmxassist/util.c   2005-06-28 04:04:12 -04:00
+++ b/tools/firmware/vmxassist/util.c   2005-06-28 04:04:12 -04:00
@@ -74,6 +74,36 @@
 }
 
 void
+print_e820_map(struct e820entry *map, int entries)
+{
+       struct e820entry *m;
+
+       if (entries > 32)
+               entries = 32;
+
+       for (m = map; m < &map[entries]; m++) {
+               printf("%08lx%08lx - %08lx%08lx ",
+                       (unsigned long) (m->addr >> 32),
+                       (unsigned long) (m->addr),
+                       (unsigned long) ((m->addr+m->size) >> 32),
+                       (unsigned long) ((m->addr+m->size)));
+
+               switch (m->type) {
+               case E820_RAM:
+                       printf("(RAM)\n"); break;
+               case E820_RESERVED:
+                       printf("(Reserved)\n"); break;
+               case E820_ACPI:
+                       printf("(ACPI Data)\n"); break;
+               case E820_NVS:
+                       printf("(ACPI NVS)\n"); break;
+               default:
+                       printf("(Type %ld)\n", m->type); break;
+               }
+       }
+}
+
+void
 dump_dtr(unsigned long base, unsigned long limit)
 {
        unsigned long long entry;
diff -Nru a/tools/firmware/vmxassist/util.h b/tools/firmware/vmxassist/util.h
--- a/tools/firmware/vmxassist/util.h   2005-06-28 04:04:12 -04:00
+++ b/tools/firmware/vmxassist/util.h   2005-06-28 04:04:12 -04:00
@@ -23,6 +23,24 @@
 #include <stdarg.h>
 #include <vm86.h>
 
+
+#define        LINUX_E820_MAP_NR       ((unsigned char *)0x901E8)
+#define        LINUX_E820_MAP          ((struct e820entry *)0x902D0)
+
+#define        E820_RAM        1
+#define        E820_RESERVED   2
+#define        E820_ACPI       3
+#define        E820_NVS        4
+#define        E820_IO         16
+#define        E820_SHARED     17
+
+struct e820entry {
+       unsigned long long      addr;
+       unsigned long long      size;
+       unsigned long           type;
+} __attribute__((packed));
+
+
 #define        offsetof(type, member)  ((unsigned) &((type *)0)->member)
 
 struct vmx_assist_context;
@@ -30,6 +48,7 @@
 extern void hexdump(unsigned char *, int);
 extern void dump_regs(struct regs *);
 extern void dump_vmx_context(struct vmx_assist_context *);
+extern void print_e820_map(struct e820entry *, int);
 extern void dump_dtr(unsigned long, unsigned long);
 extern void *memcpy(void *, const void *, unsigned);
 extern void *memset(void *, int, unsigned);
diff -Nru a/tools/firmware/vmxassist/vm86.c b/tools/firmware/vmxassist/vm86.c
--- a/tools/firmware/vmxassist/vm86.c   2005-06-28 04:04:12 -04:00
+++ b/tools/firmware/vmxassist/vm86.c   2005-06-28 04:04:12 -04:00
@@ -950,7 +950,7 @@
 
        default:
        invalid:
-               printf("Trap (%d) while in %s mode\n",
+               printf("Trap (0x%x) while in %s mode\n",
                    trapno, regs->eflags & EFLAGS_VM ? "real" : "protected");
                if (trapno == 14)
                        printf("Page fault address 0x%x\n", get_cr2());

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [PATCH] [PATCH] VMXassist print e820 table, BitKeeper Bot <=