Skip to contentSkip to conversation

vmxassist-cleanup.patch

PATCH New Leendert van Doorn 1 participant 1 message Jun 15, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vmxassist-cleanup.patch

Some minor fixups and improved debug output.

tools/firmware/vmxassist/Makefile +2 -2
diff --exclude=ChangeSet --exclude=BitKeeper --exclude='*SCCS*' -ru -bB -N xeno-unstable.orig/tools/firmware/vmxassist/Makefile xeno-unstable.mine/tools/firmware/vmxassist/Makefile
@@ -23,9 +23,9 @@
 
 # The emulator code lives in ROM space
 TEXTADDR=0x000D0000
+
 DEFINES=-DDEBUG -DTEXTADDR=${TEXTADDR}
-XENINC=-I../../../xen/include
-#TEXTADDR=0x000E0000
+XENINC=-I$(XEN_ROOT)/xen/include
 #DEFINES=-DDEBUG -DTEST -DTEXTADDR=${TEXTADDR}
 #XENINC=-I/home/leendert/xen/xeno-unstable.bk/xen/include
 
tools/firmware/vmxassist/setup.c +2 -4
diff --exclude=ChangeSet --exclude=BitKeeper --exclude='*SCCS*' -ru -bB -N xeno-unstable.orig/tools/firmware/vmxassist/setup.c xeno-unstable.mine/tools/firmware/vmxassist/setup.c
@@ -21,11 +21,9 @@
 #include "util.h"
 #include "machine.h"
 
-#ifndef TEST
 #if (VMXASSIST_BASE != TEXTADDR)
 #error VMXAssist base mismatch
 #endif
-#endif
 
 #define	NR_PGD		(PGSIZE / sizeof(unsigned))
 
@@ -118,8 +116,8 @@
 			      "movl %%eax,%%fs;"
 			      "movl %%eax,%%gs;"
 			      "movl %%eax,%%ss" : : "a" (DATA_SELECTOR));
-/* XXX 0x10 == CODE_SELECTOR (figure out gnuas) */
-	__asm__ __volatile__ ("ljmp $0x10,$1f; 1:");
+
+	__asm__ __volatile__ ("ljmp %0,$1f; 1:" : : "i" (CODE_SELECTOR));
 
 	__asm__ __volatile__ ("ltr %%ax" : : "a" (TSS_SELECTOR));
 }
tools/firmware/vmxassist/vm86.c +8 -3
diff --exclude=ChangeSet --exclude=BitKeeper --exclude='*SCCS*' -ru -bB -N xeno-unstable.orig/tools/firmware/vmxassist/vm86.c xeno-unstable.mine/tools/firmware/vmxassist/vm86.c
@@ -39,6 +39,13 @@
 
 #ifdef DEBUG
 int traceset = 0;
+
+char *states[] = {
+	"<VM86_REAL>",
+	"<VM86_REAL_TO_PROTECTED>",
+	"<VM86_PROTECTED_TO_REAL>",
+	"<VM86_PROTECTED>"
+};
 #endif /* DEBUG */
 
 
@@ -596,7 +603,6 @@
 {
 	switch (newmode) {
 	case VM86_REAL:
-		TRACE((regs, 0, "<VM86_REAL>"));
 		if (mode == VM86_PROTECTED_TO_REAL) {
 			real_mode(regs);
 			break;
@@ -607,7 +613,6 @@
 		break;
 
 	case VM86_REAL_TO_PROTECTED:
-		TRACE((regs, 0, "<VM86_REAL_TO_PROTECTED>"));
 		if (mode == VM86_REAL) {
 			regs->eflags |= EFLAGS_TF;
 			break;
@@ -624,7 +629,6 @@
 			panic("unexpected protected-to-real mode transition");
 
 	case VM86_PROTECTED:
-		TRACE((regs, 0, "<VM86_PROTECTED>"));
 		if (mode == VM86_REAL_TO_PROTECTED) {
 			protected_mode(regs);
 			break;
@@ -634,6 +638,7 @@
 	}
 
 	mode = newmode;
+	TRACE((regs, 0, states[mode]));
 }
 
 void