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>
diff --exclude=ChangeSet --exclude=BitKeeper --exclude='*SCCS*' -ru -b -N
xeno-unstable.orig/tools/firmware/rombios/rombios.c
xeno-unstable.mine/tools/firmware/rombios/rombios.c
--- xeno-unstable.orig/tools/firmware/rombios/rombios.c 2005-06-08
08:46:32.000000000 -0400
+++ xeno-unstable.mine/tools/firmware/rombios/rombios.c 2005-06-23
12:22:52.000000000 -0400
@@ -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 --exclude=ChangeSet --exclude=BitKeeper --exclude='*SCCS*' -ru -b -N
xeno-unstable.orig/tools/firmware/vmxassist/setup.c
xeno-unstable.mine/tools/firmware/vmxassist/setup.c
--- xeno-unstable.orig/tools/firmware/vmxassist/setup.c 2005-06-21
10:20:30.000000000 -0400
+++ xeno-unstable.mine/tools/firmware/vmxassist/setup.c 2005-06-23
12:26:59.000000000 -0400
@@ -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 --exclude=ChangeSet --exclude=BitKeeper --exclude='*SCCS*' -ru -b -N
xeno-unstable.orig/tools/firmware/vmxassist/util.c
xeno-unstable.mine/tools/firmware/vmxassist/util.c
--- xeno-unstable.orig/tools/firmware/vmxassist/util.c 2005-06-08
08:46:32.000000000 -0400
+++ xeno-unstable.mine/tools/firmware/vmxassist/util.c 2005-06-23
12:23:01.000000000 -0400
@@ -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 --exclude=ChangeSet --exclude=BitKeeper --exclude='*SCCS*' -ru -b -N
xeno-unstable.orig/tools/firmware/vmxassist/util.h
xeno-unstable.mine/tools/firmware/vmxassist/util.h
--- xeno-unstable.orig/tools/firmware/vmxassist/util.h 2005-06-08
08:46:32.000000000 -0400
+++ xeno-unstable.mine/tools/firmware/vmxassist/util.h 2005-06-23
12:23:01.000000000 -0400
@@ -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 --exclude=ChangeSet --exclude=BitKeeper --exclude='*SCCS*' -ru -b -N
xeno-unstable.orig/tools/firmware/vmxassist/vm86.c
xeno-unstable.mine/tools/firmware/vmxassist/vm86.c
--- xeno-unstable.orig/tools/firmware/vmxassist/vm86.c 2005-06-21
10:20:30.000000000 -0400
+++ xeno-unstable.mine/tools/firmware/vmxassist/vm86.c 2005-06-23
12:23:57.000000000 -0400
@@ -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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|