Fixed support for Atom CPUs.

This commit is contained in:
dev
2015-12-08 00:36:49 +00:00
parent eec87bd814
commit 5df3f404f8
3 changed files with 30 additions and 7 deletions

View File

@@ -15,33 +15,44 @@ package freenet.support.CPUInformation;
* @author Iakin
*/
public interface IntelCPUInfo extends CPUInfo {
/**
* @return true if the CPU is at least a Pentium CPU.
*/
public boolean IsPentiumCompatible();
/**
* @return true if the CPU is at least a Pentium which implements the MMX instruction/feature set.
*/
public boolean IsPentiumMMXCompatible();
/**
* @return true if the CPU implements at least the p6 instruction set (Pentium II or better).
* Please note that an PentimPro CPU causes/should cause this method to return false (due to that CPU using a
* very early implementation of the p6 instruction set. No MMX etc.)
*/
public boolean IsPentium2Compatible();
/**
* @return true if the CPU implements at least a Pentium III level of the p6 instruction/feature set.
*/
public boolean IsPentium3Compatible();
/**
* Supports the SSE 2 instructions. Does not necessarily support SSE 3.
* https://en.wikipedia.org/wiki/Pentium_4
* @return true if the CPU implements at least a Pentium IV level instruction/feature set.
*/
public boolean IsPentium4Compatible();
/**
* @return true if the CPU implements at least a Pentium M level instruction/feature set.
*/
public boolean IsPentiumMCompatible();
/**
* Supports the SSE 2 and SSE 3 instructions.
* https://en.wikipedia.org/wiki/Atom_processor
* @return true if the CPU implements at least a Atom level instruction/feature set.
*/
public boolean IsAtomCompatible();

View File

@@ -320,6 +320,13 @@ class IntelInfoImpl extends CPUIDCPUInfo implements IntelCPUInfo
isCoreiCompatible = false;
modelString = "Atom";
break;
// Silvermont 22 nm Celeron
case 0x37:
isAtomCompatible = true;
isCore2Compatible = false;
isCoreiCompatible = false;
modelString = "Atom";
break;
// Ivy Bridge 22 nm
case 0x3a:
isSandyCompatible = true;

View File

@@ -19,6 +19,7 @@ import java.math.BigInteger;
import java.net.URL;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -219,9 +220,9 @@ public class NativeBigInteger extends BigInteger {
private final static String[] JBIGI_COMPAT_LIST_AMD_APU = {JBIGI_OPTIMIZATION_JAGUAR, JBIGI_OPTIMIZATION_BOBCAT, JBIGI_OPTIMIZATION_ATHLON64};
private final static String[] JBIGI_COMPAT_LIST_AMD_BULLDOZER = {JBIGI_OPTIMIZATION_EXCAVATOR, JBIGI_OPTIMIZATION_STEAMROLLER, JBIGI_OPTIMIZATION_PILEDRIVER,
JBIGI_OPTIMIZATION_BULLDOZER, JBIGI_OPTIMIZATION_ATHLON64, JBIGI_OPTIMIZATION_X86};
private final static String[] JBIGI_COMPAT_LIST_INTEL_ATOM = {JBIGI_OPTIMIZATION_ATOM, JBIGI_OPTIMIZATION_PENTIUM4, JBIGI_OPTIMIZATION_PENTIUM3,
JBIGI_OPTIMIZATION_PENTIUM2, JBIGI_OPTIMIZATION_PENTIUMMMX, JBIGI_OPTIMIZATION_PENTIUM,
JBIGI_OPTIMIZATION_X86};
private final static String[] JBIGI_COMPAT_LIST_INTEL_ATOM = {JBIGI_OPTIMIZATION_ATOM, JBIGI_OPTIMIZATION_PENTIUM3, JBIGI_OPTIMIZATION_PENTIUM2,
JBIGI_OPTIMIZATION_PENTIUMMMX, JBIGI_OPTIMIZATION_PENTIUM, JBIGI_OPTIMIZATION_X86,
JBIGI_OPTIMIZATION_PENTIUM4};
private final static String[] JBIGI_COMPAT_LIST_INTEL_PENTIUM = {JBIGI_OPTIMIZATION_PENTIUM4, JBIGI_OPTIMIZATION_PENTIUMM, JBIGI_OPTIMIZATION_PENTIUM3,
JBIGI_OPTIMIZATION_PENTIUM2, JBIGI_OPTIMIZATION_PENTIUMMMX, JBIGI_OPTIMIZATION_PENTIUM,
JBIGI_OPTIMIZATION_X86};
@@ -264,7 +265,7 @@ public class NativeBigInteger extends BigInteger {
put(JBIGI_OPTIMIZATION_STEAMROLLER, JBIGI_COMPAT_LIST_AMD_BULLDOZER);
put(JBIGI_OPTIMIZATION_EXCAVATOR, JBIGI_COMPAT_LIST_AMD_BULLDOZER);
put(JBIGI_OPTIMIZATION_ATOM, JBIGI_COMPAT_LIST_INTEL_CORE);
put(JBIGI_OPTIMIZATION_ATOM, JBIGI_COMPAT_LIST_INTEL_ATOM);
put(JBIGI_OPTIMIZATION_PENTIUM, JBIGI_COMPAT_LIST_INTEL_PENTIUM);
put(JBIGI_OPTIMIZATION_PENTIUMMMX, JBIGI_COMPAT_LIST_INTEL_PENTIUM);
@@ -382,10 +383,13 @@ public class NativeBigInteger extends BigInteger {
return JBIGI_OPTIMIZATION_COREI;
if (intelcpu.IsCore2Compatible())
return JBIGI_OPTIMIZATION_CORE2;
if (intelcpu.IsPentium4Compatible())
return JBIGI_OPTIMIZATION_PENTIUM4;
// The isAtomCompatible check should be done before the Pentium4
// check since they are compatible, but Atom performs better with
// the JBIGI_OPTIMIZATION_ATOM compability list.
if (intelcpu.IsAtomCompatible())
return JBIGI_OPTIMIZATION_ATOM;
if (intelcpu.IsPentium4Compatible())
return JBIGI_OPTIMIZATION_PENTIUM4;
if (intelcpu.IsPentiumMCompatible())
return JBIGI_OPTIMIZATION_PENTIUMM;
if (intelcpu.IsPentium3Compatible())
@@ -1157,7 +1161,8 @@ public class NativeBigInteger extends BigInteger {
}
if (rv.isEmpty()) {
error("Couldn't find the arch \"" + primary + "\" in its compatibility map \"" + compatList.toString() + "\"");
error("Couldn't find the arch \"" + primary + "\" in its compatibility map \"" +
primary + ": " + Arrays.toString(compatList) + "\"");
}
}