10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52801Shyw * Common Development and Distribution License (the "License"). 62801Shyw * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 21*3446Smrj 220Sstevel@tonic-gate /* 23*3446Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 26*3446Smrj 270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 280Sstevel@tonic-gate 290Sstevel@tonic-gate /* LINTLIBRARY */ 300Sstevel@tonic-gate 310Sstevel@tonic-gate /* 320Sstevel@tonic-gate * String conversion routine for hardware capabilities types. 330Sstevel@tonic-gate */ 340Sstevel@tonic-gate #include <strings.h> 350Sstevel@tonic-gate #include <stdio.h> 360Sstevel@tonic-gate #include <ctype.h> 370Sstevel@tonic-gate #include <limits.h> 380Sstevel@tonic-gate #include <sys/machelf.h> 390Sstevel@tonic-gate #include <sys/elf.h> 400Sstevel@tonic-gate #include <sys/auxv_SPARC.h> 410Sstevel@tonic-gate #include <sys/auxv_386.h> 420Sstevel@tonic-gate #include <elfcap.h> 430Sstevel@tonic-gate 440Sstevel@tonic-gate /* 450Sstevel@tonic-gate * Define separators for val2str processing. 460Sstevel@tonic-gate */ 470Sstevel@tonic-gate static const Fmt_desc format[] = { 480Sstevel@tonic-gate {" ", 1 }, 490Sstevel@tonic-gate {" ", 2 }, 500Sstevel@tonic-gate {" | ", 3 } 510Sstevel@tonic-gate }; 520Sstevel@tonic-gate 530Sstevel@tonic-gate /* 540Sstevel@tonic-gate * Define all known capabilities as both lower and upper case strings. This 550Sstevel@tonic-gate * duplication is necessary, rather than have one string and use something 560Sstevel@tonic-gate * like toupper(), as a client such as ld.so.1 doesn't need the overhead of 570Sstevel@tonic-gate * dragging in the internationalization support of toupper(). The Intel 3DNow 580Sstevel@tonic-gate * flags are a slightly odd convention too. 590Sstevel@tonic-gate * 600Sstevel@tonic-gate * Define all known software capabilities. 610Sstevel@tonic-gate */ 620Sstevel@tonic-gate #ifdef CAP_UPPERCASE 630Sstevel@tonic-gate static const char Sf1_fpknwn[] = "FPKNWN"; 640Sstevel@tonic-gate static const char Sf1_fpused[] = "FPUSED"; 650Sstevel@tonic-gate #elif CAP_LOWERCASE 660Sstevel@tonic-gate static const char Sf1_fpknwn[] = "fpknwn"; 670Sstevel@tonic-gate static const char Sf1_fpused[] = "fpused"; 680Sstevel@tonic-gate #else 690Sstevel@tonic-gate #error "Software Capabilities - what case do you want?" 700Sstevel@tonic-gate #endif 710Sstevel@tonic-gate 720Sstevel@tonic-gate /* 730Sstevel@tonic-gate * Order the software capabilities to match their numeric value. See SF1_SUNW_ 740Sstevel@tonic-gate * values in sys/elf.h. 750Sstevel@tonic-gate */ 760Sstevel@tonic-gate static const Cap_desc sf1[] = { 770Sstevel@tonic-gate { SF1_SUNW_FPKNWN, Sf1_fpknwn, (sizeof (Sf1_fpknwn) - 1) }, 780Sstevel@tonic-gate { SF1_SUNW_FPUSED, Sf1_fpused, (sizeof (Sf1_fpused) - 1) } 790Sstevel@tonic-gate }; 800Sstevel@tonic-gate static const uint_t sf1_num = sizeof (sf1) / sizeof (Cap_desc); 810Sstevel@tonic-gate 820Sstevel@tonic-gate /* 830Sstevel@tonic-gate * Define all known SPARC hardware capabilities. 840Sstevel@tonic-gate */ 850Sstevel@tonic-gate #ifdef CAP_UPPERCASE 860Sstevel@tonic-gate static const char Hw1_s_mul32[] = "MUL32"; 870Sstevel@tonic-gate static const char Hw1_s_div32[] = "DIV32"; 880Sstevel@tonic-gate static const char Hw1_s_fsmuld[] = "FSMULD"; 890Sstevel@tonic-gate static const char Hw1_s_v8plus[] = "V8PLUS"; 900Sstevel@tonic-gate static const char Hw1_s_popc[] = "POPC"; 910Sstevel@tonic-gate static const char Hw1_s_vis[] = "VIS"; 920Sstevel@tonic-gate static const char Hw1_s_vis2[] = "VIS2"; 930Sstevel@tonic-gate static const char Hw1_s_asi_blk_init[] = "ASI_BLK_INIT"; 942801Shyw static const char Hw1_s_fmaf[] = "FMAF"; 950Sstevel@tonic-gate #elif CAP_LOWERCASE 960Sstevel@tonic-gate static const char Hw1_s_mul32[] = "mul32"; 970Sstevel@tonic-gate static const char Hw1_s_div32[] = "div32"; 980Sstevel@tonic-gate static const char Hw1_s_fsmuld[] = "fsmuld"; 990Sstevel@tonic-gate static const char Hw1_s_v8plus[] = "v8plus"; 1000Sstevel@tonic-gate static const char Hw1_s_popc[] = "popc"; 1010Sstevel@tonic-gate static const char Hw1_s_vis[] = "vis"; 1020Sstevel@tonic-gate static const char Hw1_s_vis2[] = "vis2"; 1030Sstevel@tonic-gate static const char Hw1_s_asi_blk_init[] = "asi_blk_init"; 1042801Shyw static const char Hw1_s_fmaf[] = "fmaf"; 1052801Shyw 1060Sstevel@tonic-gate #else 1070Sstevel@tonic-gate #error "Hardware Capabilities (sparc) - what case do you want?" 1080Sstevel@tonic-gate #endif 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate /* 1110Sstevel@tonic-gate * Order the SPARC hardware capabilities to match their numeric value. See 1120Sstevel@tonic-gate * AV_SPARC_ values in sys/auxv_SPARC.h. 1130Sstevel@tonic-gate */ 1140Sstevel@tonic-gate static const Cap_desc hw1_s[] = { 1150Sstevel@tonic-gate { AV_SPARC_MUL32, Hw1_s_mul32, sizeof (Hw1_s_mul32) - 1 }, 1160Sstevel@tonic-gate { AV_SPARC_DIV32, Hw1_s_div32, sizeof (Hw1_s_div32) - 1 }, 1170Sstevel@tonic-gate { AV_SPARC_FSMULD, Hw1_s_fsmuld, sizeof (Hw1_s_fsmuld) - 1 }, 1180Sstevel@tonic-gate { AV_SPARC_V8PLUS, Hw1_s_v8plus, sizeof (Hw1_s_v8plus) - 1 }, 1190Sstevel@tonic-gate { AV_SPARC_POPC, Hw1_s_popc, sizeof (Hw1_s_popc) - 1 }, 1200Sstevel@tonic-gate { AV_SPARC_VIS, Hw1_s_vis, sizeof (Hw1_s_vis) - 1 }, 1210Sstevel@tonic-gate { AV_SPARC_VIS2, Hw1_s_vis2, sizeof (Hw1_s_vis2) - 1 }, 1220Sstevel@tonic-gate { AV_SPARC_ASI_BLK_INIT, Hw1_s_asi_blk_init, 1232801Shyw sizeof (Hw1_s_asi_blk_init) - 1 }, 1242801Shyw { AV_SPARC_FMAF, Hw1_s_fmaf, sizeof (Hw1_s_fmaf) - 1 } 1250Sstevel@tonic-gate }; 1260Sstevel@tonic-gate static const uint_t hw1_s_num = sizeof (hw1_s) / sizeof (Cap_desc); 1270Sstevel@tonic-gate 1280Sstevel@tonic-gate /* 1290Sstevel@tonic-gate * Define all known Intel hardware capabilities. 1300Sstevel@tonic-gate */ 1310Sstevel@tonic-gate #ifdef CAP_UPPERCASE 1320Sstevel@tonic-gate static const char Hw1_i_fpu[] = "FPU"; 1330Sstevel@tonic-gate static const char Hw1_i_tsc[] = "TSC"; 1340Sstevel@tonic-gate static const char Hw1_i_cx8[] = "CX8"; 1350Sstevel@tonic-gate static const char Hw1_i_sep[] = "SEP"; 1360Sstevel@tonic-gate static const char Hw1_i_amd_sysc[] = "AMD_SYSC"; 1370Sstevel@tonic-gate static const char Hw1_i_cmov[] = "CMOV"; 1380Sstevel@tonic-gate static const char Hw1_i_mmx[] = "MMX"; 1390Sstevel@tonic-gate static const char Hw1_i_amd_mmx[] = "AMD_MMX"; 1400Sstevel@tonic-gate static const char Hw1_i_amd_3dnow[] = "AMD_3DNow"; 1410Sstevel@tonic-gate static const char Hw1_i_amd_3dnowx[] = "AMD_3DNowx"; 1420Sstevel@tonic-gate static const char Hw1_i_fxsr[] = "FXSR"; 1430Sstevel@tonic-gate static const char Hw1_i_sse[] = "SSE"; 1440Sstevel@tonic-gate static const char Hw1_i_sse2[] = "SSE2"; 1450Sstevel@tonic-gate static const char Hw1_i_pause[] = "PAUSE"; 1460Sstevel@tonic-gate static const char Hw1_i_sse3[] = "SSE3"; 1470Sstevel@tonic-gate static const char Hw1_i_mon[] = "MON"; 1480Sstevel@tonic-gate static const char Hw1_i_cx16[] = "CX16"; 149*3446Smrj static const char Hw1_i_ahf[] = "AHF"; 150*3446Smrj static const char Hw1_i_tscp[] = "TSCP"; 1510Sstevel@tonic-gate #elif CAP_LOWERCASE 1520Sstevel@tonic-gate static const char Hw1_i_fpu[] = "fpu"; 1530Sstevel@tonic-gate static const char Hw1_i_tsc[] = "tsc"; 1540Sstevel@tonic-gate static const char Hw1_i_cx8[] = "cx8"; 1550Sstevel@tonic-gate static const char Hw1_i_sep[] = "sep"; 1560Sstevel@tonic-gate static const char Hw1_i_amd_sysc[] = "amd_sysc"; 1570Sstevel@tonic-gate static const char Hw1_i_cmov[] = "cmov"; 1580Sstevel@tonic-gate static const char Hw1_i_mmx[] = "mmx"; 1590Sstevel@tonic-gate static const char Hw1_i_amd_mmx[] = "amd_mmx"; 1600Sstevel@tonic-gate static const char Hw1_i_amd_3dnow[] = "amd_3dnow"; 1610Sstevel@tonic-gate static const char Hw1_i_amd_3dnowx[] = "amd_3dnowx"; 1620Sstevel@tonic-gate static const char Hw1_i_fxsr[] = "fxsr"; 1630Sstevel@tonic-gate static const char Hw1_i_sse[] = "sse"; 1640Sstevel@tonic-gate static const char Hw1_i_sse2[] = "sse2"; 1650Sstevel@tonic-gate static const char Hw1_i_pause[] = "pause"; 1660Sstevel@tonic-gate static const char Hw1_i_sse3[] = "sse3"; 1670Sstevel@tonic-gate static const char Hw1_i_mon[] = "mon"; 1680Sstevel@tonic-gate static const char Hw1_i_cx16[] = "cx16"; 169*3446Smrj static const char Hw1_i_ahf[] = "ahf"; 170*3446Smrj static const char Hw1_i_tscp[] = "tscp"; 1710Sstevel@tonic-gate #else 1720Sstevel@tonic-gate #error "Hardware Capabilities (intel) - what case do you want?" 1730Sstevel@tonic-gate #endif 1740Sstevel@tonic-gate 1750Sstevel@tonic-gate /* 1760Sstevel@tonic-gate * Order the Intel hardware capabilities to match their numeric value. See 1770Sstevel@tonic-gate * AV_386_ values in sys/auxv_386.h. 1780Sstevel@tonic-gate */ 1790Sstevel@tonic-gate static const Cap_desc hw1_i[] = { 1800Sstevel@tonic-gate { AV_386_FPU, Hw1_i_fpu, sizeof (Hw1_i_fpu) - 1 }, 1810Sstevel@tonic-gate { AV_386_TSC, Hw1_i_tsc, sizeof (Hw1_i_tsc) - 1 }, 1820Sstevel@tonic-gate { AV_386_CX8, Hw1_i_cx8, sizeof (Hw1_i_cx8) - 1 }, 1830Sstevel@tonic-gate { AV_386_SEP, Hw1_i_sep, sizeof (Hw1_i_sep) - 1 }, 1840Sstevel@tonic-gate { AV_386_AMD_SYSC, Hw1_i_amd_sysc, sizeof (Hw1_i_amd_sysc) - 1 }, 1850Sstevel@tonic-gate { AV_386_CMOV, Hw1_i_cmov, sizeof (Hw1_i_cmov) - 1 }, 1860Sstevel@tonic-gate { AV_386_MMX, Hw1_i_mmx, sizeof (Hw1_i_mmx) - 1 }, 1870Sstevel@tonic-gate { AV_386_AMD_MMX, Hw1_i_amd_mmx, sizeof (Hw1_i_amd_mmx) - 1 }, 1880Sstevel@tonic-gate { AV_386_AMD_3DNow, Hw1_i_amd_3dnow, 1890Sstevel@tonic-gate sizeof (Hw1_i_amd_3dnow) - 1 }, 1900Sstevel@tonic-gate { AV_386_AMD_3DNowx, Hw1_i_amd_3dnowx, 1910Sstevel@tonic-gate sizeof (Hw1_i_amd_3dnowx) - 1 }, 1920Sstevel@tonic-gate { AV_386_FXSR, Hw1_i_fxsr, sizeof (Hw1_i_fxsr) - 1 }, 1930Sstevel@tonic-gate { AV_386_SSE, Hw1_i_sse, sizeof (Hw1_i_sse) - 1 }, 1940Sstevel@tonic-gate { AV_386_SSE2, Hw1_i_sse2, sizeof (Hw1_i_sse2) - 1 }, 1950Sstevel@tonic-gate { AV_386_PAUSE, Hw1_i_pause, sizeof (Hw1_i_pause) - 1 }, 1960Sstevel@tonic-gate { AV_386_SSE3, Hw1_i_sse3, sizeof (Hw1_i_sse3) - 1 }, 1970Sstevel@tonic-gate { AV_386_MON, Hw1_i_mon, sizeof (Hw1_i_mon) - 1 }, 198*3446Smrj { AV_386_CX16, Hw1_i_cx16, sizeof (Hw1_i_cx16) - 1 }, 199*3446Smrj { AV_386_AHF, Hw1_i_ahf, sizeof (Hw1_i_ahf) - 1 }, 200*3446Smrj { AV_386_TSCP, Hw1_i_tscp, sizeof (Hw1_i_tscp) - 1 } 2010Sstevel@tonic-gate }; 2020Sstevel@tonic-gate static const uint_t hw1_i_num = sizeof (hw1_i) / sizeof (Cap_desc); 2030Sstevel@tonic-gate 2040Sstevel@tonic-gate /* 205*3446Smrj * Concatenate a token to the string buffer. This can be a capabilities token 2060Sstevel@tonic-gate * or a separator token. 2070Sstevel@tonic-gate */ 2080Sstevel@tonic-gate static int 2090Sstevel@tonic-gate token(char **ostr, size_t *olen, const char *nstr, size_t nlen) 2100Sstevel@tonic-gate { 2110Sstevel@tonic-gate if (*olen < nlen) 2120Sstevel@tonic-gate return (CAP_ERR_BUFOVFL); 2130Sstevel@tonic-gate 2140Sstevel@tonic-gate (void) strcat(*ostr, nstr); 2150Sstevel@tonic-gate *ostr += nlen; 2160Sstevel@tonic-gate *olen -= nlen; 2170Sstevel@tonic-gate 2180Sstevel@tonic-gate return (0); 2190Sstevel@tonic-gate } 2200Sstevel@tonic-gate 2210Sstevel@tonic-gate /* 2220Sstevel@tonic-gate * Expand a capabilities value into the strings defined in the associated 2230Sstevel@tonic-gate * capabilities descriptor. 2240Sstevel@tonic-gate */ 2250Sstevel@tonic-gate static int 2260Sstevel@tonic-gate expand(uint64_t val, const Cap_desc *cdp, uint_t cnum, char *str, size_t slen, 2270Sstevel@tonic-gate int fmt) 2280Sstevel@tonic-gate { 2290Sstevel@tonic-gate uint_t cnt, mask; 2300Sstevel@tonic-gate int follow = 0, err; 2310Sstevel@tonic-gate 2320Sstevel@tonic-gate if (val == 0) 2330Sstevel@tonic-gate return (0); 2340Sstevel@tonic-gate 2350Sstevel@tonic-gate for (cnt = WORD_BIT, mask = 0x80000000; cnt; cnt--, 2360Sstevel@tonic-gate (mask = mask >> 1)) { 2370Sstevel@tonic-gate if ((val & mask) && (cnt <= cnum) && cdp[cnt - 1].c_val) { 2380Sstevel@tonic-gate if (follow++ && ((err = token(&str, &slen, 2390Sstevel@tonic-gate format[fmt].f_str, format[fmt].f_len)) != 0)) 2400Sstevel@tonic-gate return (err); 2410Sstevel@tonic-gate 2420Sstevel@tonic-gate if ((err = token(&str, &slen, cdp[cnt - 1].c_str, 2430Sstevel@tonic-gate cdp[cnt - 1].c_len)) != 0) 2440Sstevel@tonic-gate return (err); 2450Sstevel@tonic-gate 2460Sstevel@tonic-gate val = val & ~mask; 2470Sstevel@tonic-gate } 2480Sstevel@tonic-gate } 2490Sstevel@tonic-gate 2500Sstevel@tonic-gate /* 2510Sstevel@tonic-gate * If there are any unknown bits remaining display the numeric value. 2520Sstevel@tonic-gate */ 2530Sstevel@tonic-gate if (val) { 2540Sstevel@tonic-gate if (follow && ((err = token(&str, &slen, format[fmt].f_str, 2550Sstevel@tonic-gate format[fmt].f_len)) != 0)) 2560Sstevel@tonic-gate return (err); 2570Sstevel@tonic-gate 2580Sstevel@tonic-gate (void) snprintf(str, slen, "0x%llx", val); 2590Sstevel@tonic-gate } 2600Sstevel@tonic-gate return (0); 2610Sstevel@tonic-gate } 2620Sstevel@tonic-gate 2630Sstevel@tonic-gate /* 2640Sstevel@tonic-gate * Expand a CA_SUNW_HW_1 value. 2650Sstevel@tonic-gate */ 2660Sstevel@tonic-gate int 2670Sstevel@tonic-gate hwcap_1_val2str(uint64_t val, char *str, size_t len, int fmt, ushort_t mach) 2680Sstevel@tonic-gate { 2690Sstevel@tonic-gate /* 2700Sstevel@tonic-gate * Initialize the string buffer, and validate the format request. 2710Sstevel@tonic-gate */ 2720Sstevel@tonic-gate *str = '\0'; 2730Sstevel@tonic-gate if (fmt > CAP_MAX_TYPE) 2740Sstevel@tonic-gate return (CAP_ERR_INVFMT); 2750Sstevel@tonic-gate 2760Sstevel@tonic-gate if ((mach == EM_386) || (mach == EM_IA_64) || (mach == EM_AMD64)) 2770Sstevel@tonic-gate return (expand(val, &hw1_i[0], hw1_i_num, str, len, fmt)); 2780Sstevel@tonic-gate 2790Sstevel@tonic-gate if ((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) || 2800Sstevel@tonic-gate (mach == EM_SPARCV9)) 2810Sstevel@tonic-gate return (expand(val, &hw1_s[0], hw1_s_num, str, len, fmt)); 2820Sstevel@tonic-gate 2830Sstevel@tonic-gate return (CAP_ERR_UNKMACH); 2840Sstevel@tonic-gate } 2850Sstevel@tonic-gate 2860Sstevel@tonic-gate /* 2870Sstevel@tonic-gate * Expand a CA_SUNW_SF_1 value. Note, that at present these capabilities are 2880Sstevel@tonic-gate * common across all platforms. The use of "mach" is therefore redundant, but 2890Sstevel@tonic-gate * is retained for compatibility with the interface of hwcap_1_val2str(), and 2900Sstevel@tonic-gate * possible future expansion. 2910Sstevel@tonic-gate */ 2920Sstevel@tonic-gate int 2930Sstevel@tonic-gate /* ARGSUSED4 */ 2940Sstevel@tonic-gate sfcap_1_val2str(uint64_t val, char *str, size_t len, int fmt, ushort_t mach) 2950Sstevel@tonic-gate { 2960Sstevel@tonic-gate /* 2970Sstevel@tonic-gate * Initialize the string buffer, and validate the format request. 2980Sstevel@tonic-gate */ 2990Sstevel@tonic-gate *str = '\0'; 3000Sstevel@tonic-gate if (fmt > CAP_MAX_TYPE) 3010Sstevel@tonic-gate return (CAP_ERR_INVFMT); 3020Sstevel@tonic-gate 3030Sstevel@tonic-gate return (expand(val, &sf1[0], sf1_num, str, len, fmt)); 3040Sstevel@tonic-gate } 3050Sstevel@tonic-gate 3060Sstevel@tonic-gate /* 3070Sstevel@tonic-gate * Determine capability type from the capability tag. 3080Sstevel@tonic-gate */ 3090Sstevel@tonic-gate int 3100Sstevel@tonic-gate cap_val2str(uint64_t tag, uint64_t val, char *str, size_t len, int fmt, 3110Sstevel@tonic-gate ushort_t mach) 3120Sstevel@tonic-gate { 3130Sstevel@tonic-gate if (tag == CA_SUNW_HW_1) 3140Sstevel@tonic-gate return (hwcap_1_val2str(val, str, len, fmt, mach)); 3150Sstevel@tonic-gate if (tag == CA_SUNW_SF_1) 3160Sstevel@tonic-gate return (sfcap_1_val2str(val, str, len, fmt, mach)); 3170Sstevel@tonic-gate 3180Sstevel@tonic-gate return (CAP_ERR_UNKTAG); 3190Sstevel@tonic-gate } 3200Sstevel@tonic-gate 3210Sstevel@tonic-gate /* 3220Sstevel@tonic-gate * Determine a capabilities value from a capabilities string. 3230Sstevel@tonic-gate */ 3240Sstevel@tonic-gate static uint64_t 3250Sstevel@tonic-gate value(const char *str, const Cap_desc *cdp, uint_t cnum) 3260Sstevel@tonic-gate { 3270Sstevel@tonic-gate uint_t num; 3280Sstevel@tonic-gate 3290Sstevel@tonic-gate for (num = 0; num < cnum; num++) { 3300Sstevel@tonic-gate if (strcmp(str, cdp[num].c_str) == 0) 3310Sstevel@tonic-gate return (cdp[num].c_val); 3320Sstevel@tonic-gate } 3330Sstevel@tonic-gate return (0); 3340Sstevel@tonic-gate } 3350Sstevel@tonic-gate 3360Sstevel@tonic-gate uint64_t 3370Sstevel@tonic-gate sfcap_1_str2val(const char *str, ushort_t mach) 3380Sstevel@tonic-gate { 3390Sstevel@tonic-gate return (value(str, &sf1[0], sf1_num)); 3400Sstevel@tonic-gate } 3410Sstevel@tonic-gate 3420Sstevel@tonic-gate uint64_t 3430Sstevel@tonic-gate hwcap_1_str2val(const char *str, ushort_t mach) 3440Sstevel@tonic-gate { 3450Sstevel@tonic-gate if ((mach == EM_386) || (mach == EM_IA_64) || (mach == EM_AMD64)) 3460Sstevel@tonic-gate return (value(str, &hw1_i[0], hw1_i_num)); 3470Sstevel@tonic-gate 3480Sstevel@tonic-gate if ((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) || 3490Sstevel@tonic-gate (mach == EM_SPARCV9)) 3500Sstevel@tonic-gate return (value(str, &hw1_s[0], hw1_s_num)); 3510Sstevel@tonic-gate 3520Sstevel@tonic-gate return (0); 3530Sstevel@tonic-gate } 354