Changeset 1e3e02d for core/c


Ignore:
Timestamp:
Dec 16, 2015 3:02:03 PM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
89e5e1d
Parents:
1f4a266
Message:

CPUID: Clear ECX register to ensure it will work with EAX=7
Tested on linux only
Add nativeJcpuidVersion()
Only call getCPUVendorID() once in getInfo()
Change all @since to 0.9.25 in hopes it will come true
Tab removal
Javadoc tweaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/c/jcpuid/src/jcpuid.c

    r1f4a266 r1e3e02d  
    11#include "jcpuid.h"
     2
     3/*
     4 * Versions:
     5 *
     6 * 1: Original version
     7 *
     8 * 2: (I2P 0.8.7)
     9 *    Add PIC-compatibility
     10 *
     11 * 3: (I2P 0.9.25)
     12 *    Added:
     13 *      nativeJcpuidVersion()
     14 *    Set ECX to 0 to support function 7
     15 *
     16 */
     17#define JCPUID_VERSION 3
     18
     19/* since version 3 */
     20JNIEXPORT jint JNICALL Java_net_i2p_util_NativeBigInteger_nativeJcpuidVersion
     21        (JNIEnv* env, jclass cls) {
     22    return (jint) JCPUID_VERSION;
     23}
    224
    325/**
     
    5375                {
    5476                        mov eax, iFunction
     77                        // When iFunction is 7, ECX must be 0, just set it all the time
     78                        mov ecx, 0
    5579                        cpuid
    5680                        mov a, eax
     
    77101                        : "=a" (a), "=b" (b), "=c" (c), "=d" (d)
    78102#endif
    79                         :"a"(iFunction)
     103                        /* When iFunction is 7, ECX must be 0, just set it all the time */
     104                        :"a"(iFunction), "c"(0)
    80105                        : "cc"
    81106                );
Note: See TracChangeset for help on using the changeset viewer.