< prev index next >

src/hotspot/os/bsd/os_bsd.cpp

Print this page
rev 59103 : imported patch hotspot


 205     init = true;
 206   }
 207   return privileges;
 208 }
 209 
 210 
 211 
 212 // Cpu architecture string
 213 #if   defined(ZERO)
 214 static char cpu_arch[] = ZERO_LIBARCH;
 215 #elif defined(IA64)
 216 static char cpu_arch[] = "ia64";
 217 #elif defined(IA32)
 218 static char cpu_arch[] = "i386";
 219 #elif defined(AMD64)
 220 static char cpu_arch[] = "amd64";
 221 #elif defined(ARM)
 222 static char cpu_arch[] = "arm";
 223 #elif defined(PPC32)
 224 static char cpu_arch[] = "ppc";
 225 #elif defined(SPARC)
 226   #ifdef _LP64
 227 static char cpu_arch[] = "sparcv9";
 228   #else
 229 static char cpu_arch[] = "sparc";
 230   #endif
 231 #else
 232   #error Add appropriate cpu_arch setting
 233 #endif
 234 
 235 // Compiler variant
 236 #ifdef COMPILER2
 237   #define COMPILER_VARIANT "server"
 238 #else
 239   #define COMPILER_VARIANT "client"
 240 #endif
 241 
 242 
 243 void os::Bsd::initialize_system_info() {
 244   int mib[2];
 245   size_t len;
 246   int cpu_val;
 247   julong mem_val;
 248 
 249   // get processors count via hw.ncpus sysctl
 250   mib[0] = CTL_HW;


1356     #define EM_PPC64        21              /* PowerPC64 */
1357   #endif
1358 
1359   #ifndef EM_S390
1360     #define EM_S390         22              /* IBM System/390 */
1361   #endif
1362 
1363   #ifndef EM_IA_64
1364     #define EM_IA_64        50              /* HP/Intel IA-64 */
1365   #endif
1366 
1367   #ifndef EM_X86_64
1368     #define EM_X86_64       62              /* AMD x86-64 */
1369   #endif
1370 
1371   static const arch_t arch_array[]={
1372     {EM_386,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
1373     {EM_486,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
1374     {EM_IA_64,       EM_IA_64,   ELFCLASS64, ELFDATA2LSB, (char*)"IA 64"},
1375     {EM_X86_64,      EM_X86_64,  ELFCLASS64, ELFDATA2LSB, (char*)"AMD 64"},
1376     {EM_SPARC,       EM_SPARC,   ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"},
1377     {EM_SPARC32PLUS, EM_SPARC,   ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"},
1378     {EM_SPARCV9,     EM_SPARCV9, ELFCLASS64, ELFDATA2MSB, (char*)"Sparc v9 64"},
1379     {EM_PPC,         EM_PPC,     ELFCLASS32, ELFDATA2MSB, (char*)"Power PC 32"},
1380     {EM_PPC64,       EM_PPC64,   ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"},
1381     {EM_ARM,         EM_ARM,     ELFCLASS32,   ELFDATA2LSB, (char*)"ARM"},
1382     {EM_S390,        EM_S390,    ELFCLASSNONE, ELFDATA2MSB, (char*)"IBM System/390"},
1383     {EM_ALPHA,       EM_ALPHA,   ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"},
1384     {EM_MIPS_RS3_LE, EM_MIPS_RS3_LE, ELFCLASS32, ELFDATA2LSB, (char*)"MIPSel"},
1385     {EM_MIPS,        EM_MIPS,    ELFCLASS32, ELFDATA2MSB, (char*)"MIPS"},
1386     {EM_PARISC,      EM_PARISC,  ELFCLASS32, ELFDATA2MSB, (char*)"PARISC"},
1387     {EM_68K,         EM_68K,     ELFCLASS32, ELFDATA2MSB, (char*)"M68k"}
1388   };
1389 
1390   #if  (defined IA32)
1391   static  Elf32_Half running_arch_code=EM_386;
1392   #elif   (defined AMD64)
1393   static  Elf32_Half running_arch_code=EM_X86_64;
1394   #elif  (defined IA64)
1395   static  Elf32_Half running_arch_code=EM_IA_64;
1396   #elif  (defined __sparc) && (defined _LP64)
1397   static  Elf32_Half running_arch_code=EM_SPARCV9;
1398   #elif  (defined __sparc) && (!defined _LP64)
1399   static  Elf32_Half running_arch_code=EM_SPARC;
1400   #elif  (defined __powerpc64__)
1401   static  Elf32_Half running_arch_code=EM_PPC64;
1402   #elif  (defined __powerpc__)
1403   static  Elf32_Half running_arch_code=EM_PPC;
1404   #elif  (defined ARM)
1405   static  Elf32_Half running_arch_code=EM_ARM;
1406   #elif  (defined S390)
1407   static  Elf32_Half running_arch_code=EM_S390;
1408   #elif  (defined ALPHA)
1409   static  Elf32_Half running_arch_code=EM_ALPHA;
1410   #elif  (defined MIPSEL)
1411   static  Elf32_Half running_arch_code=EM_MIPS_RS3_LE;
1412   #elif  (defined PARISC)
1413   static  Elf32_Half running_arch_code=EM_PARISC;
1414   #elif  (defined MIPS)
1415   static  Elf32_Half running_arch_code=EM_MIPS;
1416   #elif  (defined M68K)
1417   static  Elf32_Half running_arch_code=EM_68K;
1418   #else
1419     #error Method os::dll_load requires that one of following is defined:\
1420          IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K
1421   #endif
1422 
1423   // Identify compatability class for VM's architecture and library's architecture
1424   // Obtain string descriptions for architectures
1425 
1426   arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
1427   int running_arch_index=-1;
1428 
1429   for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
1430     if (running_arch_code == arch_array[i].code) {
1431       running_arch_index    = i;
1432     }
1433     if (lib_arch.code == arch_array[i].code) {
1434       lib_arch.compat_class = arch_array[i].compat_class;
1435       lib_arch.name         = arch_array[i].name;
1436     }
1437   }
1438 
1439   assert(running_arch_index != -1,
1440          "Didn't find running architecture code (running_arch_code) in arch_array");




 205     init = true;
 206   }
 207   return privileges;
 208 }
 209 
 210 
 211 
 212 // Cpu architecture string
 213 #if   defined(ZERO)
 214 static char cpu_arch[] = ZERO_LIBARCH;
 215 #elif defined(IA64)
 216 static char cpu_arch[] = "ia64";
 217 #elif defined(IA32)
 218 static char cpu_arch[] = "i386";
 219 #elif defined(AMD64)
 220 static char cpu_arch[] = "amd64";
 221 #elif defined(ARM)
 222 static char cpu_arch[] = "arm";
 223 #elif defined(PPC32)
 224 static char cpu_arch[] = "ppc";






 225 #else
 226   #error Add appropriate cpu_arch setting
 227 #endif
 228 
 229 // Compiler variant
 230 #ifdef COMPILER2
 231   #define COMPILER_VARIANT "server"
 232 #else
 233   #define COMPILER_VARIANT "client"
 234 #endif
 235 
 236 
 237 void os::Bsd::initialize_system_info() {
 238   int mib[2];
 239   size_t len;
 240   int cpu_val;
 241   julong mem_val;
 242 
 243   // get processors count via hw.ncpus sysctl
 244   mib[0] = CTL_HW;


1350     #define EM_PPC64        21              /* PowerPC64 */
1351   #endif
1352 
1353   #ifndef EM_S390
1354     #define EM_S390         22              /* IBM System/390 */
1355   #endif
1356 
1357   #ifndef EM_IA_64
1358     #define EM_IA_64        50              /* HP/Intel IA-64 */
1359   #endif
1360 
1361   #ifndef EM_X86_64
1362     #define EM_X86_64       62              /* AMD x86-64 */
1363   #endif
1364 
1365   static const arch_t arch_array[]={
1366     {EM_386,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
1367     {EM_486,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
1368     {EM_IA_64,       EM_IA_64,   ELFCLASS64, ELFDATA2LSB, (char*)"IA 64"},
1369     {EM_X86_64,      EM_X86_64,  ELFCLASS64, ELFDATA2LSB, (char*)"AMD 64"},



1370     {EM_PPC,         EM_PPC,     ELFCLASS32, ELFDATA2MSB, (char*)"Power PC 32"},
1371     {EM_PPC64,       EM_PPC64,   ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"},
1372     {EM_ARM,         EM_ARM,     ELFCLASS32,   ELFDATA2LSB, (char*)"ARM"},
1373     {EM_S390,        EM_S390,    ELFCLASSNONE, ELFDATA2MSB, (char*)"IBM System/390"},
1374     {EM_ALPHA,       EM_ALPHA,   ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"},
1375     {EM_MIPS_RS3_LE, EM_MIPS_RS3_LE, ELFCLASS32, ELFDATA2LSB, (char*)"MIPSel"},
1376     {EM_MIPS,        EM_MIPS,    ELFCLASS32, ELFDATA2MSB, (char*)"MIPS"},
1377     {EM_PARISC,      EM_PARISC,  ELFCLASS32, ELFDATA2MSB, (char*)"PARISC"},
1378     {EM_68K,         EM_68K,     ELFCLASS32, ELFDATA2MSB, (char*)"M68k"}
1379   };
1380 
1381   #if  (defined IA32)
1382   static  Elf32_Half running_arch_code=EM_386;
1383   #elif   (defined AMD64)
1384   static  Elf32_Half running_arch_code=EM_X86_64;
1385   #elif  (defined IA64)
1386   static  Elf32_Half running_arch_code=EM_IA_64;




1387   #elif  (defined __powerpc64__)
1388   static  Elf32_Half running_arch_code=EM_PPC64;
1389   #elif  (defined __powerpc__)
1390   static  Elf32_Half running_arch_code=EM_PPC;
1391   #elif  (defined ARM)
1392   static  Elf32_Half running_arch_code=EM_ARM;
1393   #elif  (defined S390)
1394   static  Elf32_Half running_arch_code=EM_S390;
1395   #elif  (defined ALPHA)
1396   static  Elf32_Half running_arch_code=EM_ALPHA;
1397   #elif  (defined MIPSEL)
1398   static  Elf32_Half running_arch_code=EM_MIPS_RS3_LE;
1399   #elif  (defined PARISC)
1400   static  Elf32_Half running_arch_code=EM_PARISC;
1401   #elif  (defined MIPS)
1402   static  Elf32_Half running_arch_code=EM_MIPS;
1403   #elif  (defined M68K)
1404   static  Elf32_Half running_arch_code=EM_68K;
1405   #else
1406     #error Method os::dll_load requires that one of following is defined:\
1407          IA32, AMD64, IA64, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K
1408   #endif
1409 
1410   // Identify compatability class for VM's architecture and library's architecture
1411   // Obtain string descriptions for architectures
1412 
1413   arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
1414   int running_arch_index=-1;
1415 
1416   for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
1417     if (running_arch_code == arch_array[i].code) {
1418       running_arch_index    = i;
1419     }
1420     if (lib_arch.code == arch_array[i].code) {
1421       lib_arch.compat_class = arch_array[i].compat_class;
1422       lib_arch.name         = arch_array[i].name;
1423     }
1424   }
1425 
1426   assert(running_arch_index != -1,
1427          "Didn't find running architecture code (running_arch_code) in arch_array");


< prev index next >