Author: nextgens
Date: 2005-12-21 22:55:29 +0000 (Wed, 21 Dec 2005)
New Revision: 7731
Modified:
branches/freenet-freejvms/build.xml
branches/freenet-freejvms/src/freenet/support/Bucket.java
branches/freenet-freejvms/src/freenet/support/CPUInformation/CPUID.java
branches/freenet-freejvms/src/net/i2p/util/NativeBigInteger.java
Log:
Patch to disable CPUID : I'm about to give up ... it won\'t work as expected
with the current freenet-ext.jar ... Will see after Christmas ;)
Modified: branches/freenet-freejvms/build.xml
===================================================================
--- branches/freenet-freejvms/build.xml 2005-12-21 01:16:02 UTC (rev 7730)
+++ branches/freenet-freejvms/build.xml 2005-12-21 22:55:29 UTC (rev 7731)
@@ -29,6 +29,7 @@
<include name="*.class"/>
<include name="org/**/*.java"/>
<include name="com/**/*.java"/>
+ <include name="com/onionnetworks/**/*.class"/>
<include name="freenet/**/*.java"/>
<include name="net/i2p/util/*.java"/>
<include name="gnu/crypto/hash/*" />
Modified: branches/freenet-freejvms/src/freenet/support/Bucket.java
===================================================================
--- branches/freenet-freejvms/src/freenet/support/Bucket.java 2005-12-21
01:16:02 UTC (rev 7730)
+++ branches/freenet-freejvms/src/freenet/support/Bucket.java 2005-12-21
22:55:29 UTC (rev 7731)
@@ -15,6 +15,7 @@
*/
public OutputStream getOutputStream() throws IOException;
+
/**
* Returns an InputStream that reads data from this Bucket. If there is
* no data in this bucket, null is returned.
Modified:
branches/freenet-freejvms/src/freenet/support/CPUInformation/CPUID.java
===================================================================
--- branches/freenet-freejvms/src/freenet/support/CPUInformation/CPUID.java
2005-12-21 01:16:02 UTC (rev 7730)
+++ branches/freenet-freejvms/src/freenet/support/CPUInformation/CPUID.java
2005-12-21 22:55:29 UTC (rev 7731)
@@ -34,12 +34,6 @@
*/
private static final boolean _doLog = true;
private static final boolean isX86 =
System.getProperty("os.arch").toLowerCase().matches("i?[x0-9]86(_64)?");
-
- static
- {
- loadNative();
- }
-
//A class that can (amongst other things I assume) represent the state
of the
//different CPU registers after a call to the CPUID assembly method
protected static class CPUIDResult {
@@ -65,50 +59,28 @@
private static String getCPUVendorID()
{
- CPUIDResult c = doCPUID(0);
- StringBuffer sb= new StringBuffer(13);
- sb.append((char)( c.EBX & 0xFF));
- sb.append((char)((c.EBX >> 8) & 0xFF));
- sb.append((char)((c.EBX >> 16) & 0xFF));
- sb.append((char)((c.EBX >> 24) & 0xFF));
-
- sb.append((char)( c.EDX & 0xFF));
- sb.append((char)((c.EDX >> 8) & 0xFF));
- sb.append((char)((c.EDX >> 16) & 0xFF));
- sb.append((char)((c.EDX >> 24) & 0xFF));
-
- sb.append((char)( c.ECX & 0xFF));
- sb.append((char)((c.ECX >> 8) & 0xFF));
- sb.append((char)((c.ECX >> 16) & 0xFF));
- sb.append((char)((c.ECX >> 24) & 0xFF));
-
- return sb.toString();
+ return "Unknown";
}
private static int getCPUFamily()
{
- CPUIDResult c = doCPUID(1);
- return (c.EAX >> 8) & 0xf;
+ return -1;
}
private static int getCPUModel()
{
- CPUIDResult c = doCPUID(1);
- return (c.EAX >> 4) & 0xf;
+ return -1;
}
private static int getCPUExtendedFamily()
{
- CPUIDResult c = doCPUID(1);
- return (c.EAX >> 20) & 0xff;
+ return -1;
}
private static int getCPUStepping()
{
- CPUIDResult c = doCPUID(1);
- return c.EAX & 0xf;
+ return -1;
}
private static int getCPUFlags()
{
- CPUIDResult c = doCPUID(1);
- return c.EDX;
+ return -1;
}
//Returns a CPUInfo item for the current type of CPU
@@ -365,30 +337,6 @@
if(!_nativeOk){
System.out.println("**Failed to retrieve CPUInfo.
Please verify the existence of jcpuid dll/so**");
}
- System.out.println("**CPUInfo**");
- System.out.println("CPU Vendor: " + getCPUVendorID());
- System.out.println("CPU Family: " + getCPUFamily());
- System.out.println("CPU Model: " + getCPUModel());
- System.out.println("CPU Stepping: " + getCPUStepping());
- System.out.println("CPU Flags: " + getCPUFlags());
-
- CPUInfo c = getInfo();
- System.out.println(" **More CPUInfo**");
- System.out.println(" CPU model string: " +
c.getCPUModelString());
- System.out.println(" CPU has MMX: " + c.hasMMX());
- System.out.println(" CPU has SSE: " + c.hasSSE());
- System.out.println(" CPU has SSE2: " + c.hasSSE2());
- if(c instanceof IntelCPUInfo){
- System.out.println(" **Intel-info**");
- System.out.println(" Is pII-compatible:
"+((IntelCPUInfo)c).IsPentium2Compatible());
- System.out.println(" Is pIII-compatible:
"+((IntelCPUInfo)c).IsPentium3Compatible());
- System.out.println(" Is pIV-compatible:
"+((IntelCPUInfo)c).IsPentium4Compatible());
- }
- if(c instanceof AMDCPUInfo){
- System.out.println(" **AMD-info**");
- System.out.println(" Is Athlon-compatible:
"+((AMDCPUInfo)c).IsAthlonCompatible());
- }
-
}
/**
@@ -399,35 +347,7 @@
*
*/
private static final void loadNative() {
- try{
- String wantedProp = System.getProperty("jcpuid.enable", "true");
- boolean wantNative = "true".equalsIgnoreCase(wantedProp);
- if (wantNative) {
- boolean loaded = loadFromResource();
- if (loaded) {
- _nativeOk = true;
- if (_doLog)
- System.err.println("INFO: Native CPUID library
'"+getResourceName()+"' loaded from resource");
- } else {
- loaded = loadGeneric();
- if (loaded) {
- _nativeOk = true;
- if (_doLog)
- System.err.println("INFO: Native CPUID library
'"+getLibraryMiddlePart()+"' loaded from somewhere in the path");
- } else {
- _nativeOk = false;
- if (_doLog)
- System.err.println("WARN: Native CPUID library jcpuid
not loaded - will not be able to read CPU information using CPUID");
- }
- }
- } else {
- if (_doLog)
- System.err.println("INFO: Native CPUID library jcpuid not
loaded - will not be able to read CPU information using CPUID");
- }
- }catch(Exception e){
- if (_doLog)
- System.err.println("INFO: Native CPUID library jcpuid not
loaded, reason: '"+e.getMessage()+"' - will not be able to read CPU information
using CPUID");
- }
+ System.err.println("INFO: Native CPUID library jcpuid not
loaded, reason: 'DISABLED' - will not be able to read CPU information using
CPUID");
}
/**
Modified: branches/freenet-freejvms/src/net/i2p/util/NativeBigInteger.java
===================================================================
--- branches/freenet-freejvms/src/net/i2p/util/NativeBigInteger.java
2005-12-21 01:16:02 UTC (rev 7730)
+++ branches/freenet-freejvms/src/net/i2p/util/NativeBigInteger.java
2005-12-21 22:55:29 UTC (rev 7731)
@@ -119,7 +119,6 @@
static {
sCPUType = resolveCPUType();
- loadNative();
}
/** Tries to resolve the best type of CPU that we have an optimized
jbigi-dll/so for.
@@ -218,9 +217,6 @@
}
public BigInteger modPow(BigInteger exponent, BigInteger m) {
- if (_nativeOk)
- return new NativeBigInteger(nativeModPow(toByteArray(),
exponent.toByteArray(), m.toByteArray()));
- else
return new NativeBigInteger(super.modPow(exponent, m));
}
public byte[] toByteArray(){
@@ -240,9 +236,6 @@
}
public double doubleValue() {
- if (_nativeOk)
- return nativeDoubleValue(toByteArray());
- else
return super.doubleValue();
}
/**
@@ -399,38 +392,6 @@
try{
String wantedProp = System.getProperty("jbigi.enable", "true");
boolean wantNative = "true".equalsIgnoreCase(wantedProp);
- if (wantNative) {
- boolean loaded = loadFromResource(true);
- if (loaded) {
- _nativeOk = true;
- if (_doLog)
- System.err.println("INFO: Optimized native BigInteger
library '"+getResourceName(true)+"' loaded from resource");
- } else {
- loaded = loadGeneric(true);
- if (loaded) {
- _nativeOk = true;
- if (_doLog)
- System.err.println("INFO: Optimized native BigInteger
library '"+getMiddleName(true)+"' loaded from somewhere in the path");
- } else {
- loaded = loadFromResource(false);
- if (loaded) {
- _nativeOk = true;
- if (_doLog)
- System.err.println("INFO: Non-optimized native
BigInteger library '"+getResourceName(false)+"' loaded from resource");
- } else {
- loaded = loadGeneric(false);
- if (loaded) {
- _nativeOk = true;
- if (_doLog)
- System.err.println("INFO: Non-optimized native
BigInteger library '"+getMiddleName(false)+"' loaded from somewhere in the
path");
- } else {
- _nativeOk = false;
- }
- }
- }
- }
- }
- if (_doLog && !_nativeOk)
System.err.println("INFO: Native BigInteger library jbigi not
loaded - using pure java");
}catch(Exception e){
if (_doLog)