From 38a6e6b2126b863020e1435458a6edd1bfd8c98f Mon Sep 17 00:00:00 2001 From: zzz Date: Fri, 20 May 2011 16:26:40 +0000 Subject: [PATCH] restore old cpuid assembly for x64 --- core/c/jcpuid/src/jcpuid.c | 10 ++++++++++ router/java/src/net/i2p/router/RouterVersion.java | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/c/jcpuid/src/jcpuid.c b/core/c/jcpuid/src/jcpuid.c index b82fa6775..09555002f 100644 --- a/core/c/jcpuid/src/jcpuid.c +++ b/core/c/jcpuid/src/jcpuid.c @@ -3,6 +3,7 @@ /** From: http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well +See also: http://homesource.nekomimicon.net/sourceforum/viewtopic.php?f=15&t=303 Perhaps the most accessible documentation on what PIC code is and how an ELF dynamic linker works is John Levine's Linkers and Loaders (and it has amazing sketches, too!). The Gentoo documentation also @@ -61,11 +62,20 @@ JNIEXPORT jobject JNICALL Java_freenet_support_CPUInformation_CPUID_doCPUID //Use GCC assembler notation asm volatile ( +#if (!defined(__X86_64__)) && (!defined(__x86_64__)) + /* 32 bit */ "pushl %%ebx \n\t" /* save %ebx */ +#endif "cpuid \n\t" +#if (!defined(__X86_64__)) && (!defined(__x86_64__)) + /* 32 bit */ "movl %%ebx, %1 \n\t" /* save what cpuid just put in %ebx */ "popl %%ebx \n\t" /* restore the old %ebx */ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) +#else + /* 64 bit */ + : "=a" (a), "=b" (b), "=c" (c), "=d" (d) +#endif :"a"(iFunction) : "cc" ); diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 87e5bffca..282c18b42 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 1; + public final static long BUILD = 2; /** for example "-test" */ public final static String EXTRA = "";