source: core/c/jcpuid/src/jcpuid.cpp @ f7f05cf

Last change on this file since f7f05cf was f7f05cf, checked in by zzz <zzz@…>, 16 years ago

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!)

  • Property mode set to 100644
File size: 740 bytes
Line 
1#include "jcpuid.h"
2
3//Executes the indicated subfunction of the CPUID operation
4JNIEXPORT jobject JNICALL Java_freenet_support_CPUInformation_CPUID_doCPUID
5  (JNIEnv * env, jclass cls, jint iFunction)
6{
7        int a,b,c,d;
8        jclass clsResult = env->FindClass ("freenet/support/CPUInformation/CPUID$CPUIDResult");
9        jmethodID constructor = env->GetMethodID(clsResult,"<init>","(IIII)V" );
10        #ifdef _MSC_VER
11                //Use MSVC assembler notation
12                _asm
13                {
14                        mov eax, iFunction
15                        cpuid
16                        mov a, eax
17                        mov b, ebx
18                        mov c, ecx
19                        mov d, edx
20                }
21        #else
22                //Use GCC assembler notation
23                asm 
24                (
25                        "cpuid"
26                        : "=a" (a),
27                          "=b" (b),
28                          "=c"(c),
29                          "=d"(d)
30                        :"a"(iFunction)
31                );
32        #endif
33        return env->NewObject(clsResult,constructor,a,b,c,d);
34}
35
Note: See TracBrowser for help on using the repository browser.