addl $0,$17,$0
ret ($26)
.end OPENSSL_atomic_add
-
-.globl OPENSSL_rdtsc
-.ent OPENSSL_rdtsc
-OPENSSL_rdtsc:
- .frame $30,0,$26
- .prologue 0
- rpcc $0
- ret ($26)
-.end OPENSSL_rdtsc
___
extern unsigned int OPENSSL_armcap_P;
#define ARMV7_NEON (1<<0)
-#define ARMV7_TICK (1<<1)
#endif
#endif
* ARM compilers support inline assembler...
*/
void _armv7_neon_probe(void);
-unsigned int _armv7_tick(void);
-
-unsigned int
-OPENSSL_rdtsc(void)
-{
- if (OPENSSL_armcap_P & ARMV7_TICK)
- return _armv7_tick();
- else
- return 0;
-}
#if defined(__GNUC__) && __GNUC__>=2
void OPENSSL_cpuid_setup(void) __attribute__((constructor));
_armv7_neon_probe();
OPENSSL_armcap_P |= ARMV7_NEON;
}
- if (sigsetjmp(ill_jmp, 1) == 0) {
- _armv7_tick();
- OPENSSL_armcap_P |= ARMV7_TICK;
- }
sigaction (SIGILL, &ill_oact, NULL);
sigprocmask(SIG_SETMASK, &oset, NULL);
.word 0xe12fff1e @ bx lr
.size _armv7_neon_probe,.-_armv7_neon_probe
-.global _armv7_tick
-.type _armv7_tick,%function
-_armv7_tick:
- mrc p15,0,r0,c9,c13,0
- .word 0xe12fff1e @ bx lr
-.size _armv7_tick,.-_armv7_tick
-
.global OPENSSL_atomic_add
.type OPENSSL_atomic_add,%function
OPENSSL_atomic_add:
{ .mib; br.ret.sptk.many b0 };;
.endp OPENSSL_cpuid_setup#
-.global OPENSSL_rdtsc#
-.proc OPENSSL_rdtsc#
-OPENSSL_rdtsc:
-{ .mib; mov r8=ar.itc
- br.ret.sptk.many b0 };;
-.endp OPENSSL_rdtsc#
-
.global OPENSSL_atomic_add#
.proc OPENSSL_atomic_add#
.align 32
nop
.PROCEND
- .EXPORT OPENSSL_rdtsc,ENTRY
- .ALIGN 8
-OPENSSL_rdtsc
- .PROC
- .CALLINFO NO_CALLS
- .ENTRY
- mfctl %cr16,$rv
- bv ($rp)
- .EXIT
- nop
- .PROCEND
-
.EXPORT OPENSSL_wipe_cpu,ENTRY
.ALIGN 8
OPENSSL_wipe_cpu
.long 0
.byte 0,12,0x14,0,0,0,2,0
.long 0
-
-.globl .OPENSSL_rdtsc
-.align 4
-.OPENSSL_rdtsc:
- mftb r3
- mftbu r4
- blr
- .long 0
- .byte 0,12,0x14,0,0,0,0,0
___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
br %r14
.size OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities
-.globl OPENSSL_rdtsc
-.type OPENSSL_rdtsc,@function
-.align 16
-OPENSSL_rdtsc:
- stck 16(%r15)
- lg %r2,16(%r15)
- br %r14
-.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
-
.globl OPENSSL_atomic_add
.type OPENSSL_atomic_add,@function
.align 16
sra %o0,%g0,%o0 ! we return signed int, remember?
.size OPENSSL_atomic_add,.-OPENSSL_atomic_add
-.global _sparcv9_rdtick
-.align 32
-_sparcv9_rdtick:
- subcc %g0,1,%o0
- .word 0x91408000 !rd %ccr,%o0
- cmp %o0,0x99
- bne .notick
- xor %o0,%o0,%o0
- .word 0x91410000 !rd %tick,%o0
- retl
- .word 0x93323020 !srlx %o0,32,%o1
-.notick:
- retl
- xor %o1,%o1,%o1
-.type _sparcv9_rdtick,#function
-.size _sparcv9_rdtick,.-_sparcv9_rdtick
-
.global _sparcv9_vis1_probe
.align 8
_sparcv9_vis1_probe:
#include <sys/time.h>
#include <openssl/bn.h>
-#define SPARCV9_TICK_PRIVILEGED (1<<0)
#define SPARCV9_PREFER_FPU (1<<1)
#define SPARCV9_VIS1 (1<<2)
#define SPARCV9_VIS2 (1<<3) /* reserved */
#define SPARCV9_FMADD (1<<4) /* reserved for SPARC64 V */
-static int OPENSSL_sparcv9cap_P = SPARCV9_TICK_PRIVILEGED;
+static int OPENSSL_sparcv9cap_P = 0;
int
bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
return bn_mul_mont_int(rp, ap, bp, np, n0, num);
}
-unsigned long _sparcv9_rdtick(void);
void _sparcv9_vis1_probe(void);
unsigned long _sparcv9_vis1_instrument(void);
void _sparcv9_vis2_probe(void);
void _sparcv9_fmadd_probe(void);
-unsigned long
-OPENSSL_rdtsc(void)
-{
- if (OPENSSL_sparcv9cap_P&SPARCV9_TICK_PRIVILEGED)
-#if defined(__sun) && defined(__SVR4)
- return gethrtime();
-#else
- return 0;
-#endif
- else
- return _sparcv9_rdtick();
-}
-
-#if 0 && defined(__sun) && defined(__SVR4)
-/* This code path is disabled, because of incompatibility of
- * libdevinfo.so.1 and libmalloc.so.1 (see below for details)
- */
-#include <malloc.h>
-#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);
-typedef char * (*di_node_name_t)(di_node_t);
-typedef int (*di_walk_node_t)(di_node_t, uint_t, di_node_name_t, int (*)(di_node_t, di_node_name_t));
-
-#define DLLINK(h,name) (name=(name##_t)dlsym((h),#name))
-
-static int
-walk_nodename(di_node_t node, di_node_name_t di_node_name)
-{
- char *name = (*di_node_name)(node);
-
- /* This is expected to catch all UltraSPARC flavors prior T1 */
- if (!strcmp (name, "SUNW,UltraSPARC") ||
- !strncmp(name,"SUNW,UltraSPARC-I",17)) /* covers II,III,IV */
- {
- OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU|SPARCV9_VIS1;
-
- /* %tick is privileged only on UltraSPARC-I/II, but not IIe */
- if (name[14]!='\0' && name[17]!='\0' && name[18]!='\0')
- OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-
- return DI_WALK_TERMINATE;
- }
- /* This is expected to catch remaining UltraSPARCs, such as T1 */
- else if (!strncmp(name, "SUNW,UltraSPARC", 15)) {
- OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-
- return DI_WALK_TERMINATE;
- }
-
- return DI_WALK_CONTINUE;
-}
-
-void
-OPENSSL_cpuid_setup(void)
-{
- void *h;
- char *e, si[256];
- static int trigger = 0;
-
- if (trigger)
- return;
- trigger = 1;
-
- if ((e = getenv("OPENSSL_sparcv9cap"))) {
- OPENSSL_sparcv9cap_P = strtoul(e, NULL, 0);
- 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;
- }
- }
-#ifdef M_KEEP
- /*
- * Solaris libdevinfo.so.1 is effectively incomatible with
- * libmalloc.so.1. Specifically, if application is linked with
- * -lmalloc, it crashes upon startup with SIGSEGV in
- * free(3LIBMALLOC) called by di_fini. Prior call to
- * mallopt(M_KEEP,0) somehow helps... But not always...
- */
- if ((h = dlopen(NULL, RTLD_LAZY))) {
- union { void *p;
- int (*f)(int, int);
- } sym;
- if ((sym.p = dlsym(h, "mallopt"))) (*sym.f)(M_KEEP, 0);
- dlclose(h);
- }
-#endif
- if ((h = dlopen("libdevinfo.so.1", RTLD_LAZY)))
- do {
- di_init_t di_init;
- di_fini_t di_fini;
- di_walk_node_t di_walk_node;
- di_node_name_t di_node_name;
- di_node_t root_node;
-
- if (!DLLINK(h, di_init))
- break;
- if (!DLLINK(h, di_fini))
- break;
- if (!DLLINK(h, di_walk_node))
- break;
- if (!DLLINK(h, di_node_name))
- break;
-
- if ((root_node = (*di_init)("/", DINFOSUBTREE)) !=
- DI_NODE_NIL) {
- (*di_walk_node)(root_node, DI_WALK_SIBFIRST,
- di_node_name, walk_nodename);
- (*di_fini)(root_node);
- }
- } while (0);
-
- if (h)
- dlclose(h);
-}
-
-#else
-
static sigjmp_buf common_jmp;
static void common_handler(int sig)
{
}
/* Initial value, fits UltraSPARC-I&II... */
- OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU|SPARCV9_TICK_PRIVILEGED;
+ OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU;
sigfillset(&all_masked);
sigdelset(&all_masked, SIGILL);
sigaction(SIGILL, &common_act, &ill_oact);
sigaction(SIGBUS,&common_act,&bus_oact);/* T1 fails 16-bit ldda [on Linux] */
- if (sigsetjmp(common_jmp, 1) == 0) {
- _sparcv9_rdtick();
- OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
- }
-
if (sigsetjmp(common_jmp, 1) == 0) {
_sparcv9_vis1_probe();
OPENSSL_sparcv9cap_P |= SPARCV9_VIS1;
sigprocmask(SIG_SETMASK, &oset, NULL);
}
-
-#endif
ret
.size OPENSSL_atomic_add,.-OPENSSL_atomic_add
-.globl OPENSSL_rdtsc
-.type OPENSSL_rdtsc,\@abi-omnipotent
-.align 16
-OPENSSL_rdtsc:
- rdtsc
- shl \$32,%rdx
- or %rdx,%rax
- ret
-.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
-
.globl OPENSSL_ia32_cpuid
.type OPENSSL_ia32_cpuid,\@abi-omnipotent
.align 16
&external_label("OPENSSL_ia32cap_P");
-&function_begin_B("OPENSSL_rdtsc","EXTRN\t_OPENSSL_ia32cap_P:DWORD");
- &xor ("eax","eax");
- &xor ("edx","edx");
- &picmeup("ecx","OPENSSL_ia32cap_P");
- &bt (&DWP(0,"ecx"),4);
- &jnc (&label("notsc"));
- &rdtsc ();
-&set_label("notsc");
- &ret ();
-&function_end_B("OPENSSL_rdtsc");
-
# This works in Ring 0 only [read DJGPP+MS-DOS+privileged DPMI host],
# but it's safe to call it on any [supported] 32-bit platform...
# Just check for [non-]zero return value...
addl $0,$17,$0
ret ($26)
.end OPENSSL_atomic_add
-
-.globl OPENSSL_rdtsc
-.ent OPENSSL_rdtsc
-OPENSSL_rdtsc:
- .frame $30,0,$26
- .prologue 0
- rpcc $0
- ret ($26)
-.end OPENSSL_rdtsc
___
extern unsigned int OPENSSL_armcap_P;
#define ARMV7_NEON (1<<0)
-#define ARMV7_TICK (1<<1)
#endif
#endif
* ARM compilers support inline assembler...
*/
void _armv7_neon_probe(void);
-unsigned int _armv7_tick(void);
-
-unsigned int
-OPENSSL_rdtsc(void)
-{
- if (OPENSSL_armcap_P & ARMV7_TICK)
- return _armv7_tick();
- else
- return 0;
-}
#if defined(__GNUC__) && __GNUC__>=2
void OPENSSL_cpuid_setup(void) __attribute__((constructor));
_armv7_neon_probe();
OPENSSL_armcap_P |= ARMV7_NEON;
}
- if (sigsetjmp(ill_jmp, 1) == 0) {
- _armv7_tick();
- OPENSSL_armcap_P |= ARMV7_TICK;
- }
sigaction (SIGILL, &ill_oact, NULL);
sigprocmask(SIG_SETMASK, &oset, NULL);
.word 0xe12fff1e @ bx lr
.size _armv7_neon_probe,.-_armv7_neon_probe
-.global _armv7_tick
-.type _armv7_tick,%function
-_armv7_tick:
- mrc p15,0,r0,c9,c13,0
- .word 0xe12fff1e @ bx lr
-.size _armv7_tick,.-_armv7_tick
-
.global OPENSSL_atomic_add
.type OPENSSL_atomic_add,%function
OPENSSL_atomic_add:
{ .mib; br.ret.sptk.many b0 };;
.endp OPENSSL_cpuid_setup#
-.global OPENSSL_rdtsc#
-.proc OPENSSL_rdtsc#
-OPENSSL_rdtsc:
-{ .mib; mov r8=ar.itc
- br.ret.sptk.many b0 };;
-.endp OPENSSL_rdtsc#
-
.global OPENSSL_atomic_add#
.proc OPENSSL_atomic_add#
.align 32
nop
.PROCEND
- .EXPORT OPENSSL_rdtsc,ENTRY
- .ALIGN 8
-OPENSSL_rdtsc
- .PROC
- .CALLINFO NO_CALLS
- .ENTRY
- mfctl %cr16,$rv
- bv ($rp)
- .EXIT
- nop
- .PROCEND
-
.EXPORT OPENSSL_wipe_cpu,ENTRY
.ALIGN 8
OPENSSL_wipe_cpu
.long 0
.byte 0,12,0x14,0,0,0,2,0
.long 0
-
-.globl .OPENSSL_rdtsc
-.align 4
-.OPENSSL_rdtsc:
- mftb r3
- mftbu r4
- blr
- .long 0
- .byte 0,12,0x14,0,0,0,0,0
___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
br %r14
.size OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities
-.globl OPENSSL_rdtsc
-.type OPENSSL_rdtsc,@function
-.align 16
-OPENSSL_rdtsc:
- stck 16(%r15)
- lg %r2,16(%r15)
- br %r14
-.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
-
.globl OPENSSL_atomic_add
.type OPENSSL_atomic_add,@function
.align 16
sra %o0,%g0,%o0 ! we return signed int, remember?
.size OPENSSL_atomic_add,.-OPENSSL_atomic_add
-.global _sparcv9_rdtick
-.align 32
-_sparcv9_rdtick:
- subcc %g0,1,%o0
- .word 0x91408000 !rd %ccr,%o0
- cmp %o0,0x99
- bne .notick
- xor %o0,%o0,%o0
- .word 0x91410000 !rd %tick,%o0
- retl
- .word 0x93323020 !srlx %o0,32,%o1
-.notick:
- retl
- xor %o1,%o1,%o1
-.type _sparcv9_rdtick,#function
-.size _sparcv9_rdtick,.-_sparcv9_rdtick
-
.global _sparcv9_vis1_probe
.align 8
_sparcv9_vis1_probe:
#include <sys/time.h>
#include <openssl/bn.h>
-#define SPARCV9_TICK_PRIVILEGED (1<<0)
#define SPARCV9_PREFER_FPU (1<<1)
#define SPARCV9_VIS1 (1<<2)
#define SPARCV9_VIS2 (1<<3) /* reserved */
#define SPARCV9_FMADD (1<<4) /* reserved for SPARC64 V */
-static int OPENSSL_sparcv9cap_P = SPARCV9_TICK_PRIVILEGED;
+static int OPENSSL_sparcv9cap_P = 0;
int
bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
return bn_mul_mont_int(rp, ap, bp, np, n0, num);
}
-unsigned long _sparcv9_rdtick(void);
void _sparcv9_vis1_probe(void);
unsigned long _sparcv9_vis1_instrument(void);
void _sparcv9_vis2_probe(void);
void _sparcv9_fmadd_probe(void);
-unsigned long
-OPENSSL_rdtsc(void)
-{
- if (OPENSSL_sparcv9cap_P&SPARCV9_TICK_PRIVILEGED)
-#if defined(__sun) && defined(__SVR4)
- return gethrtime();
-#else
- return 0;
-#endif
- else
- return _sparcv9_rdtick();
-}
-
-#if 0 && defined(__sun) && defined(__SVR4)
-/* This code path is disabled, because of incompatibility of
- * libdevinfo.so.1 and libmalloc.so.1 (see below for details)
- */
-#include <malloc.h>
-#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);
-typedef char * (*di_node_name_t)(di_node_t);
-typedef int (*di_walk_node_t)(di_node_t, uint_t, di_node_name_t, int (*)(di_node_t, di_node_name_t));
-
-#define DLLINK(h,name) (name=(name##_t)dlsym((h),#name))
-
-static int
-walk_nodename(di_node_t node, di_node_name_t di_node_name)
-{
- char *name = (*di_node_name)(node);
-
- /* This is expected to catch all UltraSPARC flavors prior T1 */
- if (!strcmp (name, "SUNW,UltraSPARC") ||
- !strncmp(name,"SUNW,UltraSPARC-I",17)) /* covers II,III,IV */
- {
- OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU|SPARCV9_VIS1;
-
- /* %tick is privileged only on UltraSPARC-I/II, but not IIe */
- if (name[14]!='\0' && name[17]!='\0' && name[18]!='\0')
- OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-
- return DI_WALK_TERMINATE;
- }
- /* This is expected to catch remaining UltraSPARCs, such as T1 */
- else if (!strncmp(name, "SUNW,UltraSPARC", 15)) {
- OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-
- return DI_WALK_TERMINATE;
- }
-
- return DI_WALK_CONTINUE;
-}
-
-void
-OPENSSL_cpuid_setup(void)
-{
- void *h;
- char *e, si[256];
- static int trigger = 0;
-
- if (trigger)
- return;
- trigger = 1;
-
- if ((e = getenv("OPENSSL_sparcv9cap"))) {
- OPENSSL_sparcv9cap_P = strtoul(e, NULL, 0);
- 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;
- }
- }
-#ifdef M_KEEP
- /*
- * Solaris libdevinfo.so.1 is effectively incomatible with
- * libmalloc.so.1. Specifically, if application is linked with
- * -lmalloc, it crashes upon startup with SIGSEGV in
- * free(3LIBMALLOC) called by di_fini. Prior call to
- * mallopt(M_KEEP,0) somehow helps... But not always...
- */
- if ((h = dlopen(NULL, RTLD_LAZY))) {
- union { void *p;
- int (*f)(int, int);
- } sym;
- if ((sym.p = dlsym(h, "mallopt"))) (*sym.f)(M_KEEP, 0);
- dlclose(h);
- }
-#endif
- if ((h = dlopen("libdevinfo.so.1", RTLD_LAZY)))
- do {
- di_init_t di_init;
- di_fini_t di_fini;
- di_walk_node_t di_walk_node;
- di_node_name_t di_node_name;
- di_node_t root_node;
-
- if (!DLLINK(h, di_init))
- break;
- if (!DLLINK(h, di_fini))
- break;
- if (!DLLINK(h, di_walk_node))
- break;
- if (!DLLINK(h, di_node_name))
- break;
-
- if ((root_node = (*di_init)("/", DINFOSUBTREE)) !=
- DI_NODE_NIL) {
- (*di_walk_node)(root_node, DI_WALK_SIBFIRST,
- di_node_name, walk_nodename);
- (*di_fini)(root_node);
- }
- } while (0);
-
- if (h)
- dlclose(h);
-}
-
-#else
-
static sigjmp_buf common_jmp;
static void common_handler(int sig)
{
}
/* Initial value, fits UltraSPARC-I&II... */
- OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU|SPARCV9_TICK_PRIVILEGED;
+ OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU;
sigfillset(&all_masked);
sigdelset(&all_masked, SIGILL);
sigaction(SIGILL, &common_act, &ill_oact);
sigaction(SIGBUS,&common_act,&bus_oact);/* T1 fails 16-bit ldda [on Linux] */
- if (sigsetjmp(common_jmp, 1) == 0) {
- _sparcv9_rdtick();
- OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
- }
-
if (sigsetjmp(common_jmp, 1) == 0) {
_sparcv9_vis1_probe();
OPENSSL_sparcv9cap_P |= SPARCV9_VIS1;
sigprocmask(SIG_SETMASK, &oset, NULL);
}
-
-#endif
ret
.size OPENSSL_atomic_add,.-OPENSSL_atomic_add
-.globl OPENSSL_rdtsc
-.type OPENSSL_rdtsc,\@abi-omnipotent
-.align 16
-OPENSSL_rdtsc:
- rdtsc
- shl \$32,%rdx
- or %rdx,%rax
- ret
-.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
-
.globl OPENSSL_ia32_cpuid
.type OPENSSL_ia32_cpuid,\@abi-omnipotent
.align 16
&external_label("OPENSSL_ia32cap_P");
-&function_begin_B("OPENSSL_rdtsc","EXTRN\t_OPENSSL_ia32cap_P:DWORD");
- &xor ("eax","eax");
- &xor ("edx","edx");
- &picmeup("ecx","OPENSSL_ia32cap_P");
- &bt (&DWP(0,"ecx"),4);
- &jnc (&label("notsc"));
- &rdtsc ();
-&set_label("notsc");
- &ret ();
-&function_end_B("OPENSSL_rdtsc");
-
# This works in Ring 0 only [read DJGPP+MS-DOS+privileged DPMI host],
# but it's safe to call it on any [supported] 32-bit platform...
# Just check for [non-]zero return value...