summaryrefslogtreecommitdiff
path: root/config_cpu.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2020-12-25 15:30:39 -0500
committerJeffrey Walton <noloader@gmail.com>2020-12-25 15:30:39 -0500
commitf8da0a2bb3d3b5d926345ae0ea824d1830548108 (patch)
treee572c06ab202b61e86d0834c9dfe3a7e3866d268 /config_cpu.h
parent23557a2b4403ef7847b65fd9fc2ed008a117d572 (diff)
downloadcryptopp-git-f8da0a2bb3d3b5d926345ae0ea824d1830548108.tar.gz
Set CRYPTOPP_L1_CACHE_LINE_SIZE to 128 for PowerPC cpus
Diffstat (limited to 'config_cpu.h')
-rw-r--r--config_cpu.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/config_cpu.h b/config_cpu.h
index 27007c85..700c72d8 100644
--- a/config_cpu.h
+++ b/config_cpu.h
@@ -132,6 +132,10 @@
/// \brief L1 data cache line size
/// \details CRYPTOPP_L1_CACHE_LINE_SIZE should be a lower bound on the L1
/// data cache line size. It is used for defense against some timing attacks.
+ /// \details CRYPTOPP_L1_CACHE_LINE_SIZE default value on 32-bit platforms
+ /// is 32, and the default value on 64-bit platforms is 64. On PowerPC the
+ /// default value is 128 since all PowerPC cpu's starting at PPC 970 provide
+ /// it.
/// \note The runtime library on some PowerPC platforms misreport the size
/// of the cache line size. The runtime library reports 64, while the cpu
/// has a cache line size of 128.
@@ -142,8 +146,11 @@
#else
#ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
#if defined(CRYPTOPP_BOOL_X32) || defined(CRYPTOPP_BOOL_X64) || defined(CRYPTOPP_BOOL_ARMV8) || \
- defined(CRYPTOPP_BOOL_PPC64) || defined(CRYPTOPP_BOOL_MIPS64) || defined(CRYPTOPP_BOOL_SPARC64)
+ defined(CRYPTOPP_BOOL_MIPS64) || defined(CRYPTOPP_BOOL_SPARC64)
#define CRYPTOPP_L1_CACHE_LINE_SIZE 64
+ #elif defined(CRYPTOPP_BOOL_PPC32) || defined(CRYPTOPP_BOOL_PPC64)
+ // http://lists.llvm.org/pipermail/llvm-dev/2017-March/110982.html
+ #define CRYPTOPP_L1_CACHE_LINE_SIZE 128
#else
// L1 cache line size is 32 on Pentium III and earlier
#define CRYPTOPP_L1_CACHE_LINE_SIZE 32