[RFC] libx86 - AMD64 fix-ups (updated patch)

TJ ubuntu at tjworld.net
Sat Sep 22 01:35:49 BST 2007


I got slightly out-of-sync with the package modifications and diffs.
Hunk "thunk.c@@ -195,7 +200,9 @@" wasn't fully revised.

=== patch ====
diff -aur libx86-0.99.orig/thunk.c libx86-0.99/thunk.c
--- libx86-0.99.orig/thunk.c	2006-10-30 20:42:15.000000000 +0000
+++ libx86-0.99/thunk.c	2007-09-21 21:32:40.000000000 +0100
@@ -25,7 +25,10 @@
 #include "lrmi.h"
 #include "x86-common.h"
 
+/* 2007-09-21 TJ commented out to prevent compiler warning
+ *  "DEBUG" redefined 
 #define DEBUG
+*/
 #define ALLOC_ENTRIES(x) (V_RAM - 1)
 #define TRUE 1
 #define FALSE 0
@@ -163,7 +166,9 @@
 	 * Allocate a 64k stack.
 	 */
 	stack = LRMI_alloc_real(64 * 1024);
-	X86_SS = (unsigned int) stack >> 4;
+	/* 2007-09-21 TJ fixup using (u16)(unsigned long...) to prevent AMD64 
+	 * compiler warning "cast from pointer to integer of different size" */
+	X86_SS = (u16) ((unsigned long) stack >> 4);
 	X86_ESP = 0xFFF9;
 	memset (stack, 0, 64*1024);
 
@@ -195,7 +200,9 @@
         if (registers->ss != 0) {
                 X86_SS = registers->ss;
         } else {
-	        X86_SS = (unsigned int) stack >> 4;
+        	/* 2007-09-21 TJ fixup using (u16)(unsigned long...) to prevent AMD64 
+        	 * compiler warning "cast from pointer to integer of different size" */
+	        X86_SS = (u16) ((unsigned long) stack >> 4);
 	}
 
 	if (registers->ds != 0) { 
diff -aur libx86-0.99.orig/x86-common.c libx86-0.99/x86-common.c
--- libx86-0.99.orig/x86-common.c	2006-09-07 23:44:27.000000000 +0100
+++ libx86-0.99/x86-common.c	2007-09-21 17:51:54.000000000 +0100
@@ -190,14 +190,18 @@
 static inline unsigned int
 get_int_seg(int i)
 {
-	return *(unsigned short *)(i * 4 + 2);
+	/* 2007-09-21 TJ fixup using (unsigned long) to prevent AMD64 compiler
+	 * warning "cast to pointer from integer of different size" */
+	return *(unsigned short *)((unsigned long)i * 4 + 2);
 }
 
 
 static inline unsigned int
 get_int_off(int i)
 {
-	return *(unsigned short *)(i * 4);
+	/* 2007-09-21 TJ fixup using (unsigned long) to prevent AMD64 compiler
+	 * warning "cast to pointer from integer of different size" */
+	return *(unsigned short *)((unsigned long)i * 4);
 }
 
 int LRMI_common_init(void)
diff -aur libx86-0.99.orig/x86emu/include/xf86int10.h libx86-0.99/x86emu/include/xf86int10.h
--- libx86-0.99.orig/x86emu/include/xf86int10.h	2006-09-07 23:44:28.000000000 +0100
+++ libx86-0.99/x86emu/include/xf86int10.h	2007-09-21 18:26:37.000000000 +0100
@@ -18,7 +18,9 @@
 
 #define CARD8  unsigned char
 #define CARD16 unsigned short
-#define CARD32 unsigned long
+/* 2007-09-21 TJ fixup using (unsigned int) to prevent AMD64 compiler
+ * warning "initialization from incompatible pointer type" */
+#define CARD32 unsigned int
 #define pointer void *
 #define IOADDRESS void *
 #define Bool int




More information about the ubuntu-devel mailing list