[Xen-devel] Re: [PATCH] vmx-x86_64-byte.patch

Leendert van Doorn
Sun, 11 Sep 2005 10:38:53 -0000

# The byte size is handled in set_reg_value(), but not in __set_reg_value(), #
and it''s true that there is a bug in set_reg_value().
# I''ve send a patch for this bug:

Yes, that fixes the problem, our patches crossed. I saw Keir already
integrated my patch and while it is harmless, it is redundant and
here is the diff to take it out.

The patch also addresses some indent problems and aligns instructions
up with the rest of the block.

<ON SOAPBOX>
While on this topic, and I know I''m starting a religious war, could we
get some agreement over the prefered indent/coding style for Xen? It
is currently a hotchpotch of styles, sometimes even within the same
function. I don''t have a strong preference for the style (the
Linux kernel style seems appropriate given the amount of Linux code
that''s incorporated), as long as it is consistent.
<OFF SOAPBOX>

	Leendert

Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com>

diff -r 21cbdb20ff4c xen/arch/x86/vmx_io.c
--- a/xen/arch/x86/vmx_io.c	Sun Sep 11 09:28:21 2005
+++ b/xen/arch/x86/vmx_io.c	Sun Sep 11 11:23:38 2005
@@ -198,7 +198,6 @@
 static inline void __set_reg_value(unsigned long *reg, int size, long value)
 {
     switch (size) {
-        case BYTE:
         case BYTE_64:
             *reg &= ~0xFF;
             *reg |= (value & 0xFF);
diff -r 21cbdb20ff4c xen/arch/x86/vmx_platform.c
--- a/xen/arch/x86/vmx_platform.c	Sun Sep 11 09:28:21 2005
+++ b/xen/arch/x86/vmx_platform.c	Sun Sep 11 11:23:38 2005
@@ -55,7 +55,6 @@
 static inline long __get_reg_value(unsigned long reg, int size)
 {
     switch(size) {
-        case BYTE:
         case BYTE_64:
             return (char)(reg & 0xFF);
         case WORD:
@@ -90,10 +89,11 @@
                 return (char)((regs->rdx & 0xFF00) >> 8);
 	case 7: /* %bh */
                 return (char)((regs->rbx & 0xFF00) >> 8);
-            default:
+	default:
 	    printf("Error: (get_reg_value) Invalid index value\n");
-                domain_crash_synchronous();
+	    domain_crash_synchronous();
         }
+    	/* NOTREACHED */
     }

     switch (index) {
@@ -114,8 +114,8 @@
         case 14: return __get_reg_value(regs->r14, size);
         case 15: return __get_reg_value(regs->r15, size);
         default:
-	printf("Error: (get_reg_value) Invalid index value\n");
-            domain_crash_synchronous();
+	    printf("Error: (get_reg_value) Invalid index value\n");
+	    domain_crash_synchronous();
     }
 }
 #elif defined (__i386__)