Skip to content

Commit

Permalink
1971 i86 kernel should be more careful when casting pointers
Browse files Browse the repository at this point in the history
Reviewed by: Robert Mustacchi <[email protected]>
Reviewed by: Jason King <[email protected]>
Approved by: Garrett D'Amore <[email protected]>
  • Loading branch information
richlowe committed May 15, 2011
1 parent 82dec0a commit c909a41
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
12 changes: 6 additions & 6 deletions usr/src/uts/i86pc/dboot/dboot_startkern.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ sort_physinstall(void)
memlists[i].next = 0;
memlists[i - 1].next = (native_ptr_t)(uintptr_t)(memlists + i);
}
bi->bi_phys_install = (native_ptr_t)memlists;
bi->bi_phys_install = (native_ptr_t)(uintptr_t)memlists;
DBG(bi->bi_phys_install);
}

Expand All @@ -258,7 +258,7 @@ build_rsvdmemlists(void)
rsvdmemlists[i - 1].next =
(native_ptr_t)(uintptr_t)(rsvdmemlists + i);
}
bi->bi_rsvdmem = (native_ptr_t)rsvdmemlists;
bi->bi_rsvdmem = (native_ptr_t)(uintptr_t)rsvdmemlists;
DBG(bi->bi_rsvdmem);
}

Expand Down Expand Up @@ -668,7 +668,7 @@ build_pcimemlists(mmap_t *mem, int num)
pcimemlists[i - 1].next =
(native_ptr_t)(uintptr_t)(pcimemlists + i);
}
bi->bi_pcimem = (native_ptr_t)pcimemlists;
bi->bi_pcimem = (native_ptr_t)(uintptr_t)pcimemlists;
DBG(bi->bi_pcimem);
}

Expand Down Expand Up @@ -808,7 +808,7 @@ init_mem_alloc(void)
* we'll build the module list while we're walking through here
*/
DBG_MSG("\nFinding Modules\n");
check_higher((paddr_t)&_end);
check_higher((paddr_t)(uintptr_t)&_end);
for (mod = (mb_module_t *)(mb_info->mods_addr), i = 0;
i < mb_info->mods_count;
++mod, ++i) {
Expand All @@ -826,7 +826,7 @@ init_mem_alloc(void)

check_higher(mod->mod_end);
}
bi->bi_modules = (native_ptr_t)modules;
bi->bi_modules = (native_ptr_t)(uintptr_t)modules;
DBG(bi->bi_modules);
bi->bi_module_cnt = mb_info->mods_count;
DBG(bi->bi_module_cnt);
Expand Down Expand Up @@ -911,7 +911,7 @@ init_mem_alloc(void)
pcimemlists[0].size = pci_hi_limit - pcimemlists[0].addr;
pcimemlists[0].next = 0;
pcimemlists[0].prev = 0;
bi->bi_pcimem = (native_ptr_t)pcimemlists;
bi->bi_pcimem = (native_ptr_t)(uintptr_t)pcimemlists;
DBG(bi->bi_pcimem);
} else {
dboot_panic("No memory info from boot loader!!!");
Expand Down
3 changes: 2 additions & 1 deletion usr/src/uts/i86pc/os/mp_pc.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ rmp_gdt_init(rm_platter_t *rm)
* mapped address, we need to calculate it here.
*/
rm->rm_longmode64_addr = rm_platter_pa +
((uint32_t)long_mode_64 - (uint32_t)real_mode_start_cpu);
(uint32_t)((uintptr_t)long_mode_64 -
(uintptr_t)real_mode_start_cpu);
#endif /* __amd64 */
}

Expand Down
10 changes: 5 additions & 5 deletions usr/src/uts/intel/sys/segments.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ typedef struct gate_desc {
uint32_t sgd_hioffset:16; /* code seg off 31:16 */
} gate_desc_t;

#define GATESEG_GETOFFSET(sgd) ((sgd)->sgd_looffset | \
(sgd)->sgd_hioffset << 16)
#define GATESEG_GETOFFSET(sgd) ((uintptr_t)((sgd)->sgd_looffset | \
(sgd)->sgd_hioffset << 16))

#else /* __amd64 */

Expand All @@ -380,9 +380,9 @@ typedef struct gate_desc {
uint64_t sgd_resv3:19; /* unused, ignored */
} gate_desc_t;

#define GATESEG_GETOFFSET(sgd) ((sgd)->sgd_looffset | \
(sgd)->sgd_hioffset << 16 | \
(sgd)->sgd_hi64offset << 32)
#define GATESEG_GETOFFSET(sgd) ((uintptr_t)((sgd)->sgd_looffset | \
(sgd)->sgd_hioffset << 16 | \
(uint64_t)((sgd)->sgd_hi64offset) << 32))

#endif /* __amd64 */

Expand Down

0 comments on commit c909a41

Please sign in to comment.