diff --git a/core/c/jcpuid/src/jcpuid.c b/core/c/jcpuid/src/jcpuid.c index b5792575f..7276697d5 100644 --- a/core/c/jcpuid/src/jcpuid.c +++ b/core/c/jcpuid/src/jcpuid.c @@ -17,7 +17,7 @@ #define JCPUID_VERSION 3 /* since version 3 */ -JNIEXPORT jint JNICALL Java_net_i2p_util_NativeBigInteger_nativeJcpuidVersion +JNIEXPORT jint JNICALL Java_freenet_support_CPUInformation_CPUID_nativeJcpuidVersion (JNIEnv* env, jclass cls) { return (jint) JCPUID_VERSION; } diff --git a/core/java/src/freenet/support/CPUInformation/CPUID.java b/core/java/src/freenet/support/CPUInformation/CPUID.java index 832a8c567..de0fb1008 100644 --- a/core/java/src/freenet/support/CPUInformation/CPUID.java +++ b/core/java/src/freenet/support/CPUInformation/CPUID.java @@ -34,6 +34,7 @@ public class CPUID { /** did we load the native lib correctly? */ private static boolean _nativeOk = false; + private static int _jcpuidVersion; /** * do we want to dump some basic success/failure info to stderr during @@ -105,6 +106,27 @@ public class CPUID { */ private static native CPUIDResult doCPUID(int iFunction); + /** + * Get the jbigi version, only available since jbigi version 3 + * Caller must catch Throwable + * @since 0.9.25 + */ + private native static int nativeJcpuidVersion(); + + /** + * Get the jcpuid version + * @return 0 if no jcpuid available, 2 if version not supported + * @since 0.9.25 + */ + private static int fetchJcpuidVersion() { + if (!_nativeOk) + return 0; + try { + return nativeJcpuidVersion(); + } catch (Throwable t) { + return 2; + } + } static String getCPUVendorID() { @@ -293,6 +315,7 @@ public class CPUID { if(!_nativeOk){ System.out.println("**Failed to retrieve CPUInfo. Please verify the existence of jcpuid dll/so**"); } + System.out.println("JCPUID Version: " + _jcpuidVersion); System.out.println(" **CPUInfo**"); String mname = getCPUModelName(); if (mname != null) @@ -396,6 +419,7 @@ public class CPUID { System.err.println("WARNING: Native CPUID library jcpuid not loaded - will not be able to read CPU information using CPUID"); } } + _jcpuidVersion = fetchJcpuidVersion(); } else { if (_doLog) System.err.println("INFO: Native CPUID library jcpuid not loaded - will not be able to read CPU information using CPUID"); diff --git a/core/java/src/freenet/support/CPUInformation/CPUIDCPUInfo.java b/core/java/src/freenet/support/CPUInformation/CPUIDCPUInfo.java index 1c2d0fb08..5af66a46d 100644 --- a/core/java/src/freenet/support/CPUInformation/CPUIDCPUInfo.java +++ b/core/java/src/freenet/support/CPUInformation/CPUIDCPUInfo.java @@ -5,7 +5,7 @@ package freenet.support.CPUInformation; * Ref: http://en.wikipedia.org/wiki/CPUID * @since 0.8.7 */ -public class CPUIDCPUInfo implements CPUInfo +class CPUIDCPUInfo implements CPUInfo { public String getVendor() { diff --git a/core/java/src/net/i2p/util/NativeBigInteger.java b/core/java/src/net/i2p/util/NativeBigInteger.java index 2c85bbe79..5c1f15e6a 100644 --- a/core/java/src/net/i2p/util/NativeBigInteger.java +++ b/core/java/src/net/i2p/util/NativeBigInteger.java @@ -502,51 +502,51 @@ public class NativeBigInteger extends BigInteger { * big endian twos complement representation of the modulus * @return big endian twos complement representation of (base ^ exponent) % modulus * @throws ArithmeticException if modulus <= 0 - * @since 0.9.18 and libjbigi version 3 + * @since 0.9.25 and libjbigi version 3 */ private native static byte[] nativeModPowCT(byte base[], byte exponent[], byte modulus[]); /** - * @since 0.9.18 and libjbigi version 3 + * @since 0.9.25 and libjbigi version 3 * @throws ArithmeticException */ private native static byte[] nativeModInverse(byte base[], byte d[]); /** * Only for testing jbigi's negative conversion functions! - * @since 0.9.18 + * @since 0.9.25 */ //private native static byte[] nativeNeg(byte d[]); /** * Get the jbigi version, only available since jbigi version 3 * Caller must catch Throwable - * @since 0.9.18 + * @since 0.9.25 */ private native static int nativeJbigiVersion(); /** * Get the libmp version, only available since jbigi version 3 - * @since 0.9.18 + * @since 0.9.25 */ private native static int nativeGMPMajorVersion(); /** * Get the libmp version, only available since jbigi version 3 - * @since 0.9.18 + * @since 0.9.25 */ private native static int nativeGMPMinorVersion(); /** * Get the libmp version, only available since jbigi version 3 - * @since 0.9.18 + * @since 0.9.25 */ private native static int nativeGMPPatchVersion(); /** * Get the jbigi version * @return 0 if no jbigi available, 2 if version not supported - * @since 0.9.18 + * @since 0.9.25 */ private static int fetchJbigiVersion() { if (!_nativeOk) @@ -583,7 +583,7 @@ public class NativeBigInteger extends BigInteger { /** * Get the jbigi version * @return 0 if no jbigi available, 2 if version info not supported - * @since 0.9.18 + * @since 0.9.25 */ public static int getJbigiVersion() { return _jbigiVersion; @@ -592,7 +592,7 @@ public class NativeBigInteger extends BigInteger { /** * Get the libgmp version * @return "unknown" if no jbigi available or if version not supported - * @since 0.9.18 + * @since 0.9.25 */ public static String getLibGMPVersion() { return _libGMPVersion; @@ -649,7 +649,7 @@ public class NativeBigInteger extends BigInteger { /** * @throws ArithmeticException if m <= 0 - * @since 0.9.18 and libjbigi version 3 and GMP version 5 + * @since 0.9.25 and libjbigi version 3 and GMP version 5 */ public BigInteger modPowCT(BigInteger exponent, BigInteger m) { if (_nativeCTOk) @@ -660,7 +660,7 @@ public class NativeBigInteger extends BigInteger { /** * @throws ArithmeticException if not coprime with m, or m <= 0 - * @since 0.9.18 and libjbigi version 3 + * @since 0.9.25 and libjbigi version 3 */ @Override public BigInteger modInverse(BigInteger m) {