Files
i2p.i2p/core/c/jcpuid/src/jcpuid.cpp
jrandom f7f05cfc8b 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!)
2004-08-21 07:56:53 +00:00

36 lines
740 B
C++

#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);
}