summaryrefslogtreecommitdiff
path: root/usr/src/common/bignum
diff options
context:
space:
mode:
authorDan OpenSolaris Anderson <opensolaris@drydog.com>2009-11-20 18:04:58 -0800
committerDan OpenSolaris Anderson <opensolaris@drydog.com>2009-11-20 18:04:58 -0800
commit8de5c4f463386063e184a851437d58080c6c626c (patch)
tree36b5ef30d7fb15bc2d9e96cb7e52775e48a4a875 /usr/src/common/bignum
parent14c2ce9048cb9407fdf675f7ef76081a1dd5e715 (diff)
downloadillumos-joyent-8de5c4f463386063e184a851437d58080c6c626c.tar.gz
6899006 Remove .byte asm directives and use new Intel Westmere opcodes
6647055 x86_64 MD5/SHA1 assembly source should use 32-bit registers when the assembler supports it
Diffstat (limited to 'usr/src/common/bignum')
-rw-r--r--usr/src/common/bignum/bignumimpl.c19
-rw-r--r--usr/src/common/bignum/sun4u/mont_mulf_kernel_v9.s45
2 files changed, 52 insertions, 12 deletions
diff --git a/usr/src/common/bignum/bignumimpl.c b/usr/src/common/bignum/bignumimpl.c
index e1cb454665..079dad8dd0 100644
--- a/usr/src/common/bignum/bignumimpl.c
+++ b/usr/src/common/bignum/bignumimpl.c
@@ -183,17 +183,28 @@ printbignum(char *aname, BIGNUM *a)
#ifdef __amd64
/*
* Return 1 if executing on Intel, otherwise 0 (e.g., AMD64).
+ * Cache the result, as the CPU can't change.
+ *
+ * Note: the userland version uses getisax() and checks for an AMD-64-only
+ * feature. The kernel version uses cpuid_getvendor().
*/
static int
bignum_on_intel(void)
{
+ static int cached_result = -1;
+
+ if (cached_result == -1) { /* first time */
#ifdef _KERNEL
- return (cpuid_getvendor(CPU) == X86_VENDOR_Intel);
+ cached_result = (cpuid_getvendor(CPU) == X86_VENDOR_Intel);
#else
- uint_t ui;
- (void) getisax(&ui, 1);
- return ((ui & AV_386_AMD_MMX) == 0);
+ uint_t ui;
+
+ (void) getisax(&ui, 1);
+ cached_result = ((ui & AV_386_AMD_MMX) == 0);
#endif /* _KERNEL */
+ }
+
+ return (cached_result);
}
#endif /* __amd64 */
diff --git a/usr/src/common/bignum/sun4u/mont_mulf_kernel_v9.s b/usr/src/common/bignum/sun4u/mont_mulf_kernel_v9.s
index ce094e37f0..4080b43f82 100644
--- a/usr/src/common/bignum/sun4u/mont_mulf_kernel_v9.s
+++ b/usr/src/common/bignum/sun4u/mont_mulf_kernel_v9.s
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This file is mostly a result of compiling the mont_mulf.c file to generate an
* assembly output and then hand-editing that output to replace the
@@ -45,8 +42,40 @@
#include <sys/machsig.h>
#if defined(lint) || defined(__lint)
- /* LINTED */
- /* Nothing to be linted in this file, its pure assembly source */
+#include <sys/types.h>
+
+/* ARGSUSED */
+uint64_t
+double2uint64_t(double* d)
+{
+ return (0ULL);
+}
+
+/* ARGSUSED */
+void
+conv_d16_to_i32(uint32_t *i32, double *d16, int64_t *tmp, int ilen)
+{
+}
+
+/* ARGSUSED */
+void
+conv_i32_to_d32(double *d32, uint32_t *i32, int len)
+{
+}
+
+/* ARGSUSED */
+void
+conv_i32_to_d16(double *d16, uint32_t *i32, int len)
+{
+}
+
+/* ARGSUSED */
+void
+mont_mulf_noconv(uint32_t *result, double *dm1, double *dm2, double *dt,
+ double *dn, uint32_t *nint, int nlen, double dn0)
+{
+}
+
#else /* lint || __lint */
.section ".text",#alloc,#execinstr