imported Iakin's public domain jcpuid library allowing the detection of CPU types from java

imported Iakin's modifications to jbigi to use the jcpuid library in detecting what jbigi implementation to load
imported and slightly updated Iakin's scripts to build jbigi for lots of architectures
(yay iakin!)
This commit is contained in:
jrandom
2004-08-21 07:56:53 +00:00
committed by zzz
parent f4754d7481
commit f7f05cfc8b
20 changed files with 1362 additions and 35 deletions

View File

@@ -0,0 +1,35 @@
#include "jcpuid.h"
//Executes the indicated subfunction of the CPUID operation
JNIEXPORT jobject JNICALL Java_freenet_support_CPUInformation_CPUID_doCPUID
(JNIEnv * env, jclass cls, jint iFunction)
{
int a,b,c,d;
jclass clsResult = env->FindClass ("freenet/support/CPUInformation/CPUID$CPUIDResult");
jmethodID constructor = env->GetMethodID(clsResult,"<init>","(IIII)V" );
#ifdef _MSC_VER
//Use MSVC assembler notation
_asm
{
mov eax, iFunction
cpuid
mov a, eax
mov b, ebx
mov c, ecx
mov d, edx
}
#else
//Use GCC assembler notation
asm
(
"cpuid"
: "=a" (a),
"=b" (b),
"=c"(c),
"=d"(d)
:"a"(iFunction)
);
#endif
return env->NewObject(clsResult,constructor,a,b,c,d);
}