Project

General

Profile

Bug #8248

Updated by Toomas Soome almost 5 years ago

The bootinfo and friends are using native_ptr_t members and the current dboot code is not very consistent about type casts. 

 The double casts like: (native_ptr_t)(uintptr_t)    are needed with pointer, otherwise we will get error: 

 <pre> 
 diff --git a/usr/src/uts/i86pc/dboot/dboot_startkern.c b/usr/src/uts/i86pc/dboot/dboot_startkern.c 
 index d8bfec534d..6b62be7a97 100644 
 --- a/usr/src/uts/i86pc/dboot/dboot_startkern.c 
 +++ b/usr/src/uts/i86pc/dboot/dboot_startkern.c 
 @@ -1080,7 +1080,7 @@ dboot_find_env(void) 
                 modules[0].bm_name = (native_ptr_t)(uintptr_t)NULL; 
                 modules[0].bm_hash = (native_ptr_t)(uintptr_t)NULL; 
                 modules[0].bm_type = BMT_ENV; 
 -                 bi->bi_modules = (native_ptr_t)(uintptr_t)modules; 
 +                 bi->bi_modules = (native_ptr_t)modules; 
                 bi->bi_module_cnt = 1; 
                 return; 
         } 

 </pre> 
 And the error for this change: 
 <pre> 
 cc1: warnings being treated as errors 
 ../../i86pc/dboot/dboot_startkern.c: In function 'dboot_find_env': 
 ../../i86pc/dboot/dboot_startkern.c:1083: error: cast from pointer to integer of different size [-Wpointer-to-int-cast] 
 *** Error code 1 
 dmake: Fatal error: Command failed for target `dboot/obj64/dboot_startkern.o' 
 </pre>

Back