diff options
author | Jack Meng <Jack.Meng@Sun.COM> | 2009-12-09 11:01:30 +0800 |
---|---|---|
committer | Jack Meng <Jack.Meng@Sun.COM> | 2009-12-09 11:01:30 +0800 |
commit | 2a910fbb92dbaed71db5d7843518f08d02ebb922 (patch) | |
tree | 9032c09930b7fc73284e9f54534cf416f86b48a3 | |
parent | 388e50fc47773ff6216dc11e02d725e93cfc7e23 (diff) | |
download | illumos-gate-2a910fbb92dbaed71db5d7843518f08d02ebb922.tar.gz |
6891259 CPUID instruction support already present, duplicate code unnecessary
6795073 some issues reported by coverity for iscsi initiator
-rw-r--r-- | usr/src/common/hdcrc/hd_crc.h | 42 | ||||
-rw-r--r-- | usr/src/uts/common/io/scsi/adapters/iscsi/isns_client.c | 1 |
2 files changed, 23 insertions, 20 deletions
diff --git a/usr/src/common/hdcrc/hd_crc.h b/usr/src/common/hdcrc/hd_crc.h index a6022eca2b..7e6af954c2 100644 --- a/usr/src/common/hdcrc/hd_crc.h +++ b/usr/src/common/hdcrc/hd_crc.h @@ -50,25 +50,15 @@ extern "C" { #if defined(__i386) || defined(__amd_64) || defined(__x86_64) -#define INTEL_CPU_FEATURE_SSE42 0x0100000 - -static INLINE unsigned int #ifdef _KERNEL -/*LINTED:E_FUNC_ARG_UNUSED*/ -cpuid_ecx(unsigned int op) +#include <sys/x86_archext.h> /* x86_feature, X86_AES */ + #else -cpuid_ecx(unsigned int op) -#endif /* _KERNEL */ -{ - /*LINTED:E_FUNC_VAR_UNUSED*/ - unsigned int eax, ecx; - __asm__ __volatile__("cpuid" - : "=a" (eax), "=c" (ecx) - : "0" (op) - : "bx", "dx"); - /*LINTED:E_VAR_USED_BEFORE_SET*/ - return (ecx); -} + +#include <sys/auxv.h> /* getisax() */ +#include <sys/auxv_386.h> /* AV_386_AES bit */ + +#endif static INLINE uint32_t #ifdef _KERNEL @@ -257,15 +247,29 @@ hd_crc32_avail(uint32_t *crc32_table) 0xBE2DA0A5, 0x4C4623A6, 0x5F16D052, 0xAD7D5351 }; - if ((cpuid_ecx(1) & INTEL_CPU_FEATURE_SSE42) != 0) { +#ifdef _KERNEL + if (!(x86_feature & X86_SSE4_2)) { + return (B_FALSE); + } else { +#else + { + uint_t ui = 0; + + (void) getisax(&ui, 1); + + if (!(ui & AV_386_SSE4_2)) { + return (B_FALSE); + } +#endif /* _KERNEL */ for (i = 0; i < 256; i++) { if (crc32_table[i] != _intel_crc32_hd_table[i]) return (B_FALSE); } return (B_TRUE); } -#endif +#else return (B_FALSE); +#endif } #ifdef __cplusplus diff --git a/usr/src/uts/common/io/scsi/adapters/iscsi/isns_client.c b/usr/src/uts/common/io/scsi/adapters/iscsi/isns_client.c index 7d72d13c3c..db086d8ce9 100644 --- a/usr/src/uts/common/io/scsi/adapters/iscsi/isns_client.c +++ b/usr/src/uts/common/io/scsi/adapters/iscsi/isns_client.c @@ -594,7 +594,6 @@ discover_isns_server(uint8_t *lhba_handle, } else { kmem_free(*isns_server_addrs, list_space); *isns_server_addrs = NULL; - (*isns_server_addrs)->al_out_cnt = 0; return (ISNS_BAD_SVR_ADDR); } i++; |