diff options
author | Richard Lowe <richlowe@richlowe.net> | 2011-05-16 00:20:09 +0100 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2011-07-02 22:13:49 -0400 |
commit | 7eb8f0442d2320b8d0de0960b74f81dbd9d05b8d (patch) | |
tree | edb5c079c81fa89e97068d97e081a23917def6a3 | |
parent | 243b3d6a853fa96c2a0432066d4c83d31e4dc9a0 (diff) | |
download | illumos-joyent-7eb8f0442d2320b8d0de0960b74f81dbd9d05b8d.tar.gz |
cpr: Don't cast pointers down to int
-rw-r--r-- | usr/src/uts/i86pc/os/cpr_impl.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/usr/src/uts/i86pc/os/cpr_impl.c b/usr/src/uts/i86pc/os/cpr_impl.c index 555ed9f842..6716e4fa0a 100644 --- a/usr/src/uts/i86pc/os/cpr_impl.c +++ b/usr/src/uts/i86pc/os/cpr_impl.c @@ -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 @@ i_cpr_pre_resume_cpus() 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 - + (uint32_t)(uintptr_t)wc_rm_start; #else code_length = 0; #endif @@ -548,19 +550,20 @@ i_cpr_power_down(int sleeptype) 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(); @@ -581,11 +584,10 @@ i_cpr_power_down(int sleeptype) * 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); + ((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 +633,8 @@ i_cpr_power_down(int sleeptype) gdt.limit = cpup->wc_gdt_limit; #if defined(__amd64) - code_length = (uint32_t)wc_long_mode_64 - - (uint32_t)wc_rm_start; + code_length = (uintptr_t)wc_long_mode_64 - + (uintptr_t)wc_rm_start; #else code_length = 0; #endif @@ -899,7 +901,7 @@ init_real_mode_platter(int cpun, uint32_t offset, uint_t cr4, wc_desctbr_t gdt) 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; |