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