diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-01-28 01:51:41 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-01-28 01:51:41 +0000 |
commit | 9d528e83e791de449894d39edc1e23ee0468c688 (patch) | |
tree | cd881b249c1dc3eb91421939a80c4a25f516c6c3 | |
parent | 5ce3883eea6680a651056bbc57c9f80bf1260376 (diff) |
the rest of the libs stuff; from art@ again
-rw-r--r-- | lib/libc/rpc/xdr_float.c | 4 | ||||
-rw-r--r-- | lib/libc/stdlib/strtod.c | 5 | ||||
-rw-r--r-- | lib/libkvm/kvm_x86_64.c | 209 | ||||
-rw-r--r-- | lib/libpthread/arch/amd64/_atomic_lock.c | 11 | ||||
-rw-r--r-- | lib/libpthread/arch/amd64/uthread_machdep.c | 27 | ||||
-rw-r--r-- | lib/libpthread/arch/amd64/uthread_machdep.h | 5 | ||||
-rw-r--r-- | lib/libpthread/arch/amd64/uthread_machdep_asm.S | 10 | ||||
-rw-r--r-- | lib/libpthread/arch/x86_64/_atomic_lock.c | 11 | ||||
-rw-r--r-- | lib/libpthread/arch/x86_64/uthread_machdep.c | 27 | ||||
-rw-r--r-- | lib/libpthread/arch/x86_64/uthread_machdep.h | 5 | ||||
-rw-r--r-- | lib/libpthread/arch/x86_64/uthread_machdep_asm.S | 10 | ||||
-rw-r--r-- | lib/libssl/crypto/arch/amd64/opensslconf.h | 180 | ||||
-rw-r--r-- | lib/libssl/crypto/arch/x86_64/opensslconf.h | 180 |
13 files changed, 680 insertions, 4 deletions
diff --git a/lib/libc/rpc/xdr_float.c b/lib/libc/rpc/xdr_float.c index ee137153565..4e691fa7265 100644 --- a/lib/libc/rpc/xdr_float.c +++ b/lib/libc/rpc/xdr_float.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: xdr_float.c,v 1.10 2001/09/15 13:51:01 deraadt Exp $"; +static char *rcsid = "$OpenBSD: xdr_float.c,v 1.11 2004/01/28 01:51:39 mickey Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -55,7 +55,7 @@ static char *rcsid = "$OpenBSD: xdr_float.c,v 1.10 2001/09/15 13:51:01 deraadt E #if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \ defined(__mips__) || defined(__ns32k__) || defined(__alpha__) || \ defined(__arm32__) || defined(__powerpc__) || defined(__m88k__) || \ - defined(__hppa__) + defined(__hppa__) || defined(__x86_64__) #include <machine/endian.h> #define IEEEFP #endif diff --git a/lib/libc/stdlib/strtod.c b/lib/libc/stdlib/strtod.c index 17d26a1dc33..55c455892ab 100644 --- a/lib/libc/stdlib/strtod.c +++ b/lib/libc/stdlib/strtod.c @@ -90,12 +90,13 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strtod.c,v 1.16 2002/12/02 15:38:54 millert Exp $"; +static char *rcsid = "$OpenBSD: strtod.c,v 1.17 2004/01/28 01:51:39 mickey Exp $"; #endif /* LIBC_SCCS and not lint */ #if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \ defined(__mips__) || defined(__ns32k__) || defined(__alpha__) || \ - defined(__powerpc__) || defined(__m88k__) || defined(__hppa__) + defined(__powerpc__) || defined(__m88k__) || defined(__hppa__) || \ + defined(__x86_64__) #include <sys/types.h> #if BYTE_ORDER == BIG_ENDIAN #define IEEE_BIG_ENDIAN diff --git a/lib/libkvm/kvm_x86_64.c b/lib/libkvm/kvm_x86_64.c new file mode 100644 index 00000000000..b1b4b93046d --- /dev/null +++ b/lib/libkvm/kvm_x86_64.c @@ -0,0 +1,209 @@ +/* $OpenBSD: kvm_x86_64.c,v 1.1 2004/01/28 01:51:40 mickey Exp $ */ +/* $NetBSD: kvm_x86_64.c,v 1.3 2002/06/05 22:01:55 fvdl Exp $ */ + +/*- + * Copyright (c) 1989, 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software developed by the Computer Systems + * Engineering group at Lawrence Berkeley Laboratory under DARPA contract + * BG 91-66 and contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> + +/* + * x86-64 machine dependent routines for kvm. + */ + +#include <sys/param.h> +#include <sys/user.h> +#include <sys/proc.h> +#include <sys/stat.h> +#include <sys/kcore.h> +#include <machine/kcore.h> +#include <stdlib.h> +#include <unistd.h> +#include <nlist.h> +#include <kvm.h> + +#include <uvm/uvm_extern.h> + +#include <limits.h> +#include <db.h> + +#include "kvm_private.h" + +#include <machine/pmap.h> +#include <machine/pte.h> +#include <machine/vmparam.h> + +void +_kvm_freevtop(kd) + kvm_t *kd; +{ + + /* Not actually used for anything right now, but safe. */ + if (kd->vmst != 0) + free(kd->vmst); +} + +/*ARGSUSED*/ +int +_kvm_initvtop(kd) + kvm_t *kd; +{ + + return (0); +} + +/* + * Translate a kernel virtual address to a physical address. + */ +int +_kvm_kvatop(kd, va, pa) + kvm_t *kd; + u_long va; + u_long *pa; +{ + cpu_kcore_hdr_t *cpu_kh; + u_long page_off; + pd_entry_t pde; + pt_entry_t pte; + paddr_t pde_pa, pte_pa; + + if (ISALIVE(kd)) { + _kvm_err(kd, 0, "vatop called in live kernel!"); + return (0); + } + + cpu_kh = kd->cpu_data; + page_off = va & PGOFSET; + + /* + * Find and read all entries to get to the pa. + */ + + /* + * Level 4. + */ + pde_pa = cpu_kh->ptdpaddr + (pl4_i(va) * sizeof(pd_entry_t)); + if (pread(kd->pmfd, (void *)&pde, sizeof(pde), + _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) { + _kvm_syserr(kd, 0, "could not read PT level 4 entry"); + goto lose; + } + if ((pde & PG_V) == 0) { + _kvm_err(kd, 0, "invalid translation (invalid level 4 PDE)"); + goto lose; + } + + /* + * Level 3. + */ + pde_pa = (pde_pa + PG_FRAME) + (pl3_i(va) * sizeof(pd_entry_t)); + if (pread(kd->pmfd, (void *)&pde, sizeof(pde), + _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) { + _kvm_syserr(kd, 0, "could not read PT level 3 entry"); + goto lose; + } + if ((pde & PG_V) == 0) { + _kvm_err(kd, 0, "invalid translation (invalid level 3 PDE)"); + goto lose; + } + + /* + * Level 2. + */ + pde_pa = (pde_pa & PG_FRAME) + (pl2_i(va) * sizeof(pd_entry_t)); + if (pread(kd->pmfd, (void *)&pde, sizeof(pde), + _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) { + _kvm_syserr(kd, 0, "could not read PT level 2 entry"); + goto lose; + } + if ((pde & PG_V) == 0) { + _kvm_err(kd, 0, "invalid translation (invalid level 2 PDE)"); + goto lose; + } + + + /* + * Level 1. + */ + pte_pa = (pde_pa & PG_FRAME) + (pl1_i(va) * sizeof(pt_entry_t)); + if (pread(kd->pmfd, (void *) &pte, sizeof(pte), + _kvm_pa2off(kd, pte_pa)) != sizeof(pte)) { + _kvm_syserr(kd, 0, "could not read PTE"); + goto lose; + } + /* + * Validate the PTE and return the physical address. + */ + if ((pte & PG_V) == 0) { + _kvm_err(kd, 0, "invalid translation (invalid PTE)"); + goto lose; + } + *pa = (pte & PG_FRAME) + page_off; + return (int)(NBPG - page_off); + + lose: + *pa = (u_long)~0L; + return (0); +} + +/* + * Translate a physical address to a file-offset in the crash dump. + */ +off_t +_kvm_pa2off(kd, pa) + kvm_t *kd; + u_long pa; +{ + cpu_kcore_hdr_t *cpu_kh; + phys_ram_seg_t *ramsegs; + off_t off; + int i; + + cpu_kh = kd->cpu_data; + ramsegs = (void *)((char *)(void *)cpu_kh + ALIGN(sizeof *cpu_kh)); + + off = 0; + for (i = 0; i < cpu_kh->nmemsegs; i++) { + if (pa >= ramsegs[i].start && + (pa - ramsegs[i].start) < ramsegs[i].size) { + off += (pa - ramsegs[i].start); + break; + } + off += ramsegs[i].size; + } + + return (kd->dump_off + off); +} diff --git a/lib/libpthread/arch/amd64/_atomic_lock.c b/lib/libpthread/arch/amd64/_atomic_lock.c new file mode 100644 index 00000000000..087186e2858 --- /dev/null +++ b/lib/libpthread/arch/amd64/_atomic_lock.c @@ -0,0 +1,11 @@ +/* + * Atomic lock for amd64 + */ + +#include "spinlock.h" + +int +_atomic_lock(volatile _spinlock_lock_t *lock) +{ + /* dummy for now */ +} diff --git a/lib/libpthread/arch/amd64/uthread_machdep.c b/lib/libpthread/arch/amd64/uthread_machdep.c new file mode 100644 index 00000000000..d66bfbaa853 --- /dev/null +++ b/lib/libpthread/arch/amd64/uthread_machdep.c @@ -0,0 +1,27 @@ +#include <machine/param.h> +#include <pthread.h> +#include "pthread_private.h" + +/* + * Given a stack and an entry function, initialise a state + * structure that can be later switched to. + */ +void +_thread_machdep_init(struct _machdep_state* statep, void *base, int len, + void (*entry)(void)) +{ + /* dummy */ +} + +void +_thread_machdep_save_float_state(struct _machdep_state *ms) +{ + /* dummy */ +} + +void +_thread_machdep_restore_float_state(struct _machdep_state *ms) +{ + /* dummy */ +} + diff --git a/lib/libpthread/arch/amd64/uthread_machdep.h b/lib/libpthread/arch/amd64/uthread_machdep.h new file mode 100644 index 00000000000..46f5e9e87d1 --- /dev/null +++ b/lib/libpthread/arch/amd64/uthread_machdep.h @@ -0,0 +1,5 @@ +/* dummy */ + +struct _machdep_state { +}; + diff --git a/lib/libpthread/arch/amd64/uthread_machdep_asm.S b/lib/libpthread/arch/amd64/uthread_machdep_asm.S new file mode 100644 index 00000000000..3a5f255f285 --- /dev/null +++ b/lib/libpthread/arch/amd64/uthread_machdep_asm.S @@ -0,0 +1,10 @@ +#include <machine/asm.h> + +/* + * Switch stacks + */ + +/* void _thread_machdep_switch(new, oldsave); */ +ENTRY(_thread_machdep_switch) + /* dummy */ + ret diff --git a/lib/libpthread/arch/x86_64/_atomic_lock.c b/lib/libpthread/arch/x86_64/_atomic_lock.c new file mode 100644 index 00000000000..087186e2858 --- /dev/null +++ b/lib/libpthread/arch/x86_64/_atomic_lock.c @@ -0,0 +1,11 @@ +/* + * Atomic lock for amd64 + */ + +#include "spinlock.h" + +int +_atomic_lock(volatile _spinlock_lock_t *lock) +{ + /* dummy for now */ +} diff --git a/lib/libpthread/arch/x86_64/uthread_machdep.c b/lib/libpthread/arch/x86_64/uthread_machdep.c new file mode 100644 index 00000000000..d66bfbaa853 --- /dev/null +++ b/lib/libpthread/arch/x86_64/uthread_machdep.c @@ -0,0 +1,27 @@ +#include <machine/param.h> +#include <pthread.h> +#include "pthread_private.h" + +/* + * Given a stack and an entry function, initialise a state + * structure that can be later switched to. + */ +void +_thread_machdep_init(struct _machdep_state* statep, void *base, int len, + void (*entry)(void)) +{ + /* dummy */ +} + +void +_thread_machdep_save_float_state(struct _machdep_state *ms) +{ + /* dummy */ +} + +void +_thread_machdep_restore_float_state(struct _machdep_state *ms) +{ + /* dummy */ +} + diff --git a/lib/libpthread/arch/x86_64/uthread_machdep.h b/lib/libpthread/arch/x86_64/uthread_machdep.h new file mode 100644 index 00000000000..46f5e9e87d1 --- /dev/null +++ b/lib/libpthread/arch/x86_64/uthread_machdep.h @@ -0,0 +1,5 @@ +/* dummy */ + +struct _machdep_state { +}; + diff --git a/lib/libpthread/arch/x86_64/uthread_machdep_asm.S b/lib/libpthread/arch/x86_64/uthread_machdep_asm.S new file mode 100644 index 00000000000..3a5f255f285 --- /dev/null +++ b/lib/libpthread/arch/x86_64/uthread_machdep_asm.S @@ -0,0 +1,10 @@ +#include <machine/asm.h> + +/* + * Switch stacks + */ + +/* void _thread_machdep_switch(new, oldsave); */ +ENTRY(_thread_machdep_switch) + /* dummy */ + ret diff --git a/lib/libssl/crypto/arch/amd64/opensslconf.h b/lib/libssl/crypto/arch/amd64/opensslconf.h new file mode 100644 index 00000000000..c33ccc8a0f9 --- /dev/null +++ b/lib/libssl/crypto/arch/amd64/opensslconf.h @@ -0,0 +1,180 @@ +/* opensslconf.h */ +/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ + +/* OpenSSL was configured with the following options: */ +#ifndef OPENSSL_DOING_MAKEDEPEND + +#ifndef OPENSSL_NO_KRB5 +# define OPENSSL_NO_KRB5 +#endif + +#endif /* OPENSSL_DOING_MAKEDEPEND */ + +/* The OPENSSL_NO_* macros are also defined as NO_* if the application + asks for it. This is a transient feature that is provided for those + who haven't had the time to do the appropriate changes in their + applications. */ +#ifdef OPENSSL_ALGORITHM_DEFINES +# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) +# define NO_KRB5 +# endif +#endif + +/* crypto/opensslconf.h.in */ + +/* Generate 80386 code? */ +#undef I386_ONLY + +#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ +#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +#define OPENSSLDIR "/etc/ssl" +#endif +#endif + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD <unistd.h> + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) +#define IDEA_INT unsigned int +#endif + +#if defined(HEADER_MD2_H) && !defined(MD2_INT) +#define MD2_INT unsigned int +#endif + +#if defined(HEADER_RC2_H) && !defined(RC2_INT) +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned int +#endif + +#if defined(HEADER_RC4_H) +#if !defined(RC4_INT) +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +/* + * I don't know what does "most" mean, but declaring "int" is a must on: + * - Intel P6 because partial register stalls are very expensive; + * - elder Alpha because it lacks byte load/store instructions; + */ +#define RC4_INT unsigned int +#endif +#if !defined(RC4_CHUNK) +/* + * This enables code handling data aligned at natural CPU word + * boundary. See crypto/rc4/rc4_enc.c for further details. + */ +#undef RC4_CHUNK +#endif +#endif + +#if (defined(HEADER_DES_H) || defined(HEADER_DES_OLD_H)) && !defined(DES_LONG) +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned int +#endif +#endif + +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) +#define CONFIG_HEADER_BN_H +#undef BN_LLONG + +/* Should we define BN_DIV2W here? */ + +/* Only one for the following should be defined */ +/* The prime number generation stuff may not work when + * EIGHT_BIT but I don't care since I've only used this mode + * for debuging the bignum libraries */ +#define SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#undef THIRTY_TWO_BIT +#undef SIXTEEN_BIT +#undef EIGHT_BIT +#endif + +#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) +#define CONFIG_HEADER_RC4_LOCL_H +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#undef RC4_INDEX +#endif + +#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) +#define CONFIG_HEADER_BF_LOCL_H +#undef BF_PTR +#endif /* HEADER_BF_LOCL_H */ + +#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) +#define CONFIG_HEADER_DES_LOCL_H +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#define DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#undef DES_RISC1 +#endif + +#ifndef DES_RISC2 +#define DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#undef DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman <pgut001@cs.auckland.ac.nz> + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ +# define DES_PTR +# define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ +# define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ +#endif /* HEADER_DES_LOCL_H */ diff --git a/lib/libssl/crypto/arch/x86_64/opensslconf.h b/lib/libssl/crypto/arch/x86_64/opensslconf.h new file mode 100644 index 00000000000..c33ccc8a0f9 --- /dev/null +++ b/lib/libssl/crypto/arch/x86_64/opensslconf.h @@ -0,0 +1,180 @@ +/* opensslconf.h */ +/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ + +/* OpenSSL was configured with the following options: */ +#ifndef OPENSSL_DOING_MAKEDEPEND + +#ifndef OPENSSL_NO_KRB5 +# define OPENSSL_NO_KRB5 +#endif + +#endif /* OPENSSL_DOING_MAKEDEPEND */ + +/* The OPENSSL_NO_* macros are also defined as NO_* if the application + asks for it. This is a transient feature that is provided for those + who haven't had the time to do the appropriate changes in their + applications. */ +#ifdef OPENSSL_ALGORITHM_DEFINES +# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) +# define NO_KRB5 +# endif +#endif + +/* crypto/opensslconf.h.in */ + +/* Generate 80386 code? */ +#undef I386_ONLY + +#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ +#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +#define OPENSSLDIR "/etc/ssl" +#endif +#endif + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD <unistd.h> + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) +#define IDEA_INT unsigned int +#endif + +#if defined(HEADER_MD2_H) && !defined(MD2_INT) +#define MD2_INT unsigned int +#endif + +#if defined(HEADER_RC2_H) && !defined(RC2_INT) +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned int +#endif + +#if defined(HEADER_RC4_H) +#if !defined(RC4_INT) +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +/* + * I don't know what does "most" mean, but declaring "int" is a must on: + * - Intel P6 because partial register stalls are very expensive; + * - elder Alpha because it lacks byte load/store instructions; + */ +#define RC4_INT unsigned int +#endif +#if !defined(RC4_CHUNK) +/* + * This enables code handling data aligned at natural CPU word + * boundary. See crypto/rc4/rc4_enc.c for further details. + */ +#undef RC4_CHUNK +#endif +#endif + +#if (defined(HEADER_DES_H) || defined(HEADER_DES_OLD_H)) && !defined(DES_LONG) +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned int +#endif +#endif + +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) +#define CONFIG_HEADER_BN_H +#undef BN_LLONG + +/* Should we define BN_DIV2W here? */ + +/* Only one for the following should be defined */ +/* The prime number generation stuff may not work when + * EIGHT_BIT but I don't care since I've only used this mode + * for debuging the bignum libraries */ +#define SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#undef THIRTY_TWO_BIT +#undef SIXTEEN_BIT +#undef EIGHT_BIT +#endif + +#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) +#define CONFIG_HEADER_RC4_LOCL_H +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#undef RC4_INDEX +#endif + +#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) +#define CONFIG_HEADER_BF_LOCL_H +#undef BF_PTR +#endif /* HEADER_BF_LOCL_H */ + +#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) +#define CONFIG_HEADER_DES_LOCL_H +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#define DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#undef DES_RISC1 +#endif + +#ifndef DES_RISC2 +#define DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#undef DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman <pgut001@cs.auckland.ac.nz> + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ +# define DES_PTR +# define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ +# define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ +#endif /* HEADER_DES_LOCL_H */ |