changeset 13543:33634a52a6c1

1865 i86 cpr and gcc4 don't get along Reviewed by: Gordon Ross <gwr@nexenta.com> Reviewed by: Garrett D'Amore <garrett@nexenta.com> Approved by: Eric Schrock <eric.schrock@delphix.com>
author Richard Lowe <richlowe@richlowe.net>
date Mon, 16 May 2011 00:20:09 +0100
parents 0657a48834a9
children 4fd590021359
files usr/src/uts/i86pc/os/cpr_impl.c
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/i86pc/os/cpr_impl.c	Sat Dec 10 21:55:25 2011 +0000
+++ b/usr/src/uts/i86pc/os/cpr_impl.c	Mon May 16 00:20:09 2011 +0100
@@ -66,6 +66,7 @@
 #include <sys/acpi/acpi.h>
 #include <sys/acpica.h>
 #include <sys/fp.h>
+#include <sys/sysmacros.h>
 
 #define	AFMT	"%lx"
 
@@ -356,7 +357,8 @@
 		gdt.limit = cpup->wc_gdt_limit;
 
 #if defined(__amd64)
-		code_length = (uint32_t)wc_long_mode_64 - (uint32_t)wc_rm_start;
+		code_length = (uint32_t)((uintptr_t)wc_long_mode_64 -
+		    (uintptr_t)wc_rm_start);
 #else
 		code_length = 0;
 #endif
@@ -548,19 +550,20 @@
 	PMD(PMD_SX, ("ncpus=%d\n", ncpus))
 
 	PMD(PMD_SX, ("wc_rm_end - wc_rm_start=%lx WC_CODESIZE=%x\n",
-	    ((size_t)((uint_t)wc_rm_end - (uint_t)wc_rm_start)), WC_CODESIZE))
+	    ((size_t)((uintptr_t)wc_rm_end - (uintptr_t)wc_rm_start)),
+	    WC_CODESIZE))
 
 	PMD(PMD_SX, ("wakevirt=%p, wakephys=%x\n",
 	    (void *)wakevirt, (uint_t)wakephys))
 
-	ASSERT(((size_t)((uint_t)wc_rm_end - (uint_t)wc_rm_start)) <
+	ASSERT(((size_t)((uintptr_t)wc_rm_end - (uintptr_t)wc_rm_start)) <
 	    WC_CODESIZE);
 
 	bzero(wakevirt, PAGESIZE);
 
 	/* Copy code to rm_platter */
 	bcopy((caddr_t)wc_rm_start, wakevirt,
-	    (size_t)((uint_t)wc_rm_end - (uint_t)wc_rm_start));
+	    (size_t)((uintptr_t)wc_rm_end - (uintptr_t)wc_rm_start));
 
 	prt_other_cpus();
 
@@ -568,6 +571,7 @@
 
 	PMD(PMD_SX, ("real_mode_platter->rm_cr4=%lx, getcr4()=%lx\n",
 	    (ulong_t)real_mode_platter->rm_cr4, (ulong_t)getcr4()))
+
 	PMD(PMD_SX, ("real_mode_platter->rm_pdbr=%lx, getcr3()=%lx\n",
 	    (ulong_t)real_mode_platter->rm_pdbr, getcr3()))
 
@@ -581,11 +585,10 @@
 	 * mapped address, we need to calculate it here.
 	 */
 	real_mode_platter->rm_longmode64_addr = rm_platter_pa +
-	    ((uint32_t)wc_long_mode_64 - (uint32_t)wc_rm_start);
+	    (uint32_t)((uintptr_t)wc_long_mode_64 - (uintptr_t)wc_rm_start);
 
 	PMD(PMD_SX, ("real_mode_platter->rm_cr4=%lx, getcr4()=%lx\n",
 	    (ulong_t)real_mode_platter->rm_cr4, getcr4()))
-
 	PMD(PMD_SX, ("real_mode_platter->rm_pdbr=%lx, getcr3()=%lx\n",
 	    (ulong_t)real_mode_platter->rm_pdbr, getcr3()))
 
@@ -631,8 +634,8 @@
 		gdt.limit = cpup->wc_gdt_limit;
 
 #if defined(__amd64)
-		code_length = (uint32_t)wc_long_mode_64 -
-		    (uint32_t)wc_rm_start;
+		code_length = (uint32_t)((uintptr_t)wc_long_mode_64 -
+		    (uintptr_t)wc_rm_start);
 #else
 		code_length = 0;
 #endif
@@ -899,7 +902,7 @@
 	real_mode_platter->rm_temp_gdt_lim = (ushort_t)
 	    (sizeof (real_mode_platter->rm_temp_gdt) - 1);
 	real_mode_platter->rm_temp_gdt_base = rm_platter_pa +
-	    (uint32_t)(&((rm_platter_t *)0)->rm_temp_gdt);
+	    offsetof(rm_platter_t, rm_temp_gdt);
 
 	real_mode_platter->rm_temp_idt_lim = 0;
 	real_mode_platter->rm_temp_idt_base = 0;