diff options
author | Andy Polyakov <appro@openssl.org> | 2007-06-20 13:00:59 +0000 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2007-06-20 13:00:59 +0000 |
commit | f3c26535adda4ae14d826684e6c8073eeea5dce1 (patch) | |
tree | 837a0df566a23e4460caf36395e3963262989baf | |
parent | 232969422255b01006306262c46db6fe42c4ba91 (diff) |
Make some shortcuts in sparcv9cap.c. Trouble is that di_walk_node result
is inconsistent among CPU generations.
-rw-r--r-- | crypto/sparcv9cap.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/crypto/sparcv9cap.c b/crypto/sparcv9cap.c index 3ec2340241..0e662ff1c8 100644 --- a/crypto/sparcv9cap.c +++ b/crypto/sparcv9cap.c @@ -41,6 +41,7 @@ unsigned long OPENSSL_rdtsc(void) #include <dlfcn.h> #include <libdevinfo.h> +#include <sys/systeminfo.h> typedef di_node_t (*di_init_t)(const char *,uint_t); typedef void (*di_fini_t)(di_node_t); @@ -79,7 +80,7 @@ static int walk_nodename(di_node_t node, di_node_name_t di_node_name) void OPENSSL_cpuid_setup(void) { void *h; - char *e; + char *e,si[256]; static int trigger=0; if (trigger) return; @@ -91,6 +92,25 @@ void OPENSSL_cpuid_setup(void) return; } + if (sysinfo(SI_MACHINE,si,sizeof(si))>0) + { + if (strcmp(si,"sun4v")) + /* FPU is preferred for all CPUs, but US-T1/2 */ + OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU; + } + + if (sysinfo(SI_ISALIST,si,sizeof(si))>0) + { + if (strstr(si,"+vis")) + OPENSSL_sparcv9cap_P |= SPARCV9_VIS1; + if (strstr(si,"+vis2")) + { + OPENSSL_sparcv9cap_P |= SPARCV9_VIS2; + OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED; + return; + } + } + if ((h = dlopen("libdevinfo.so.1",RTLD_LAZY))) do { di_init_t di_init; |