diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-08-31 14:16:26 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-08-31 14:16:26 +0000 |
commit | 00ca081be93b3887d48350f5cebb19f126a9f983 (patch) | |
tree | 162015d81bb96f115a53a4dc3a733704da2a76af /app-benchmarks | |
parent | Version bumped. (diff) | |
download | historical-00ca081be93b3887d48350f5cebb19f126a9f983.tar.gz historical-00ca081be93b3887d48350f5cebb19f126a9f983.tar.bz2 historical-00ca081be93b3887d48350f5cebb19f126a9f983.zip |
Fix multiple issues with cpuid().
Package-Manager: portage-2.2.0_alpha51/cvs/Linux x86_64
Diffstat (limited to 'app-benchmarks')
-rw-r--r-- | app-benchmarks/i7z/ChangeLog | 8 | ||||
-rw-r--r-- | app-benchmarks/i7z/Manifest | 12 | ||||
-rw-r--r-- | app-benchmarks/i7z/files/i7z-0.27-cpuid.patch | 127 | ||||
-rw-r--r-- | app-benchmarks/i7z/i7z-0.27-r1.ebuild | 46 |
4 files changed, 187 insertions, 6 deletions
diff --git a/app-benchmarks/i7z/ChangeLog b/app-benchmarks/i7z/ChangeLog index f28b2fd05c95..b066afd62bd3 100644 --- a/app-benchmarks/i7z/ChangeLog +++ b/app-benchmarks/i7z/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for app-benchmarks/i7z # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-benchmarks/i7z/ChangeLog,v 1.4 2011/08/14 10:21:37 jlec Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-benchmarks/i7z/ChangeLog,v 1.5 2011/08/31 14:16:25 vapier Exp $ + +*i7z-0.27-r1 (31 Aug 2011) + + 31 Aug 2011; Mike Frysinger <vapier@gentoo.org> +i7z-0.27-r1.ebuild, + +files/i7z-0.27-cpuid.patch: + Fix multiple issues with cpuid(). *i7z-0.27 (14 Aug 2011) diff --git a/app-benchmarks/i7z/Manifest b/app-benchmarks/i7z/Manifest index 6b8b29c9ed2c..c6ef5c654bd4 100644 --- a/app-benchmarks/i7z/Manifest +++ b/app-benchmarks/i7z/Manifest @@ -1,19 +1,21 @@ -----BEGIN PGP SIGNED MESSAGE----- -Hash: SHA512 +Hash: SHA256 AUX 0.26-gcc46.patch 575 RMD160 9475df63439cbfba5306bb2c41736af6e76ab3bc SHA1 46a16f3b6b576eb6c6c1941bc1c07dff7441a4d0 SHA256 461a6a3e57f54d3b67d557c69e7fdc032647d8a1c1ac54aebdfc82b812f0497b AUX 0.26-gentoo.patch 1341 RMD160 a4f8d6bb7b264133ba44f7f7a29aef6659d5a839 SHA1 16ef35271a623b16c601e12d22e1a39fcee4b329 SHA256 ea831b1aca9772c7de12e9bc6a8d7f31fa93f4fa2cb0f721a76f9004c524d884 AUX 0.27-gentoo.patch 1351 RMD160 67673a41d2a4830b37a09d5e6efb9b6d9c2eb1eb SHA1 949916e9a3170e2df7805a0d7146936b92332847 SHA256 e31dfd547d18a6b3ac1ba854f4faae858c95812aaa3fdad0bd34f5d4662e1235 +AUX i7z-0.27-cpuid.patch 4706 RMD160 e28b41933d40a3b6ed02f63dc0d30a198709a0c0 SHA1 4aca5976ee984f936c66834e853cf67e6390822d SHA256 cf12b4021dce55954ac2409473ee41b0118a097d3c31a6a9350a26cea3567041 DIST i7z-0.26.tar.gz 30539 RMD160 580a11cc820a0037e196533ab0bfae9e5f3669b8 SHA1 a0c4e00867955f00708aefcf4a7f4406e4c08423 SHA256 68cf43fc583f2da7f372644f77e83901141543fe47665c9c0148b80258782f85 DIST i7z-0.27.tar.gz 121372 RMD160 657ab3d5f8fb2a365afe1a982174cc0dd12d84e2 SHA1 1f90f0594904c96560c57dff39656180eebc7566 SHA256 a06dab9d0a7fcc4ad2bad5b603a0087ed56f96de55015471b4a29c142b0219ea EBUILD i7z-0.26.ebuild 951 RMD160 5e204396871388f4cd823681db587fef2d407666 SHA1 4341c4781e4b00524da93f4a6387f581e915992c SHA256 e06582c514161bdb8c06db2180618f34dd8b52d7c362d6df40cdc9a31a4b4c17 +EBUILD i7z-0.27-r1.ebuild 951 RMD160 8fe979c4e660ec6bad1ba599598f79c79f669a8f SHA1 0275497fb0a9daa6c1d865c63682cfd5f41d1b4a SHA256 d04cb74d05dc55f495fc29af70a09f6e37ddb2461c1050b88555701f98248e96 EBUILD i7z-0.27.ebuild 905 RMD160 edf500611859bb63f9b2b348954e729bdf828f46 SHA1 e7ee5ee5f91fcbe0a5312e95ce8790faa25fde40 SHA256 b09280e06c91a65abb649a2e0433e16201f2d236048eda79ce0839f9f3ae61c6 -MISC ChangeLog 756 RMD160 80d24ff88935157029b6cb46fa18c6a61a10c653 SHA1 5e4ee3a1464e12694c721765ef9c6eae837b8dea SHA256 c2c3074b554e1920325ba5c62b34aa973f057a0efb494c7b3e5c701304f88009 +MISC ChangeLog 925 RMD160 e8da26caaf7d1b51a1f10aa1e10b9b61e26b8738 SHA1 2822a263352c71d247c93b73c44fca26887f9198 SHA256 0b665a2959d1538cbbe9c738d77bf19cc8b53c06ffe89034f32b1ac0ca5b5070 MISC metadata.xml 223 RMD160 d103626bf675fcbd59d665e802d8854269dff731 SHA1 84c55768ecdcda816237b2784f792eb7d8777d29 SHA256 a449c2ba8a1a7c556970d16995c7735a1de3d5f65a21ae711eeec898e3767abc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) -iEYEAREKAAYFAk5HoacACgkQgAnW8HDreRZHvgCdEGYOX+mYT2ID8uKJPmHeGdrG -sZsAoKtyW6dOfwvFWRTBvXR8E9wu9Lep -=HZmg +iF4EAREIAAYFAk5eQj8ACgkQaC/OocHi7JZyZAEAmXSD4DAS22V109L99G3+3dcs +NvcPNqIjhRiJURJup2QA/jxeDPkLFKIO4HyTWpACDGzOBYQ6eYMi71vFI0/aqx92 +=zU5z -----END PGP SIGNATURE----- diff --git a/app-benchmarks/i7z/files/i7z-0.27-cpuid.patch b/app-benchmarks/i7z/files/i7z-0.27-cpuid.patch new file mode 100644 index 000000000000..16b5a097234f --- /dev/null +++ b/app-benchmarks/i7z/files/i7z-0.27-cpuid.patch @@ -0,0 +1,127 @@ +http://code.google.com/p/i7z/issues/detail?id=31 + +this makes cpuid work on 32bit and 64bit systems, both PIC and non-PIC + +the things it fixes: + - no more silent clobbering of ebx/ecx/edx + - works under 32bit pic builds (gcc doesnt like to clobber ebx) + - ebx gets saved/restored via edi register + - get_vendor incorrectly used ebx,ecx,edx when it should be ebx,edx,ecx + - unify all the cpuid implementations to make usage much simpler + +I WROTE THIS + +--- a/helper_functions.c ++++ b/helper_functions.c +@@ -87,41 +87,40 @@ print_family_info (struct family_info *proc_info) + // printf(" Extended Family %d\n", proc_info->extended_family); + } + ++static inline void cpuid (unsigned int info, unsigned int *eax, unsigned int *ebx, ++ unsigned int *ecx, unsigned int *edx) ++{ ++ unsigned int _eax = info, _ebx, _ecx, _edx; ++ asm volatile ("mov %%ebx, %%edi;" // save ebx (for PIC) ++ "cpuid;" ++ "mov %%ebx, %%esi;" // pass to caller ++ "mov %%edi, %%ebx;" // restore ebx ++ :"+a" (_eax), "=S" (_ebx), "=c" (_ecx), "=d" (_edx) ++ : /* inputs: eax is handled above */ ++ :"edi" /* clobbers: we hit edi directly */); ++ if (eax) *eax = _eax; ++ if (ebx) *ebx = _ebx; ++ if (ecx) *ecx = _ecx; ++ if (edx) *edx = _edx; ++} + +-#ifdef x64_BIT + void get_vendor (char *vendor_string) + { + //get vendor name +- unsigned int b, c, d, e; +- // int i; +- asm volatile ("mov %4, %%eax; " // 0 into eax +- "cpuid;" "mov %%eax, %0;" // eeax into b +- "mov %%ebx, %1;" // eebx into c +- "mov %%edx, %2;" // eeax into d +- "mov %%ecx, %3;" // eeax into e +- :"=r" (b), "=r" (c), "=r" (d), "=r" (e) /* output */ +- :"r" (0) /* input */ +- :"%eax", "%ebx", "%ecx", "%edx" /* clobbered register, will be modifying inside the asm routine so dont use them */ +- ); +- memcpy (vendor_string, &c, 4); ++ unsigned int a, b, c, d; ++ cpuid (0, &a, &b, &c, &d); ++ memcpy (vendor_string, &b, 4); + memcpy (vendor_string + 4, &d, 4); +- memcpy (vendor_string + 8, &e, 4); ++ memcpy (vendor_string + 8, &c, 4); + vendor_string[12] = '\0'; + // printf("Vendor %s\n",vendor_string); + } +-#endif + + int turbo_status () + { + //turbo state flag + unsigned int eax; +- // int i; +- asm volatile ("mov %1, %%eax; " // 0 into eax +- "cpuid;" "mov %%eax, %0;" // eeax into b +- :"=r" (eax) /* output */ +- :"r" (6) /* input */ +- :"%eax" /* clobbered register, will be modifying inside the asm routine so dont use them */ +- ); ++ cpuid (6, &eax, NULL, NULL, NULL); + + //printf("eax %d\n",(eax&0x2)>>1); + +@@ -132,12 +131,7 @@ void get_familyinformation (struct family_info *proc_info) + { + //get info about CPU + unsigned int b; +- asm volatile ("mov %1, %%eax; " // 0 into eax +- "cpuid;" "mov %%eax, %0;" // eeax into b +- :"=r" (b) /* output */ +- :"r" (1) /* input */ +- :"%eax" /* clobbered register, will be modifying inside the asm routine so dont use them */ +- ); ++ cpuid (1, &b, NULL, NULL, NULL); + // printf ("eax %x\n", b); + proc_info->stepping = b & 0x0000000F; //bits 3:0 + proc_info->model = (b & 0x000000F0) >> 4; //bits 7:4 +@@ -348,7 +342,6 @@ void Print_Information_Processor(bool* nehalem, bool* sandy_bridge) + { + struct family_info proc_info; + +-#ifdef x64_BIT + char vendor_string[13]; + get_vendor (vendor_string); + if (strcmp (vendor_string, "GenuineIntel") == 0) +@@ -359,14 +352,6 @@ void Print_Information_Processor(bool* nehalem, bool* sandy_bridge) + ("this was designed to be a intel proc utility. You can perhaps mod it for your machine?\n"); + exit (1); + } +-#endif +- +-#ifndef x64_BIT +- //anecdotal evidence: get_vendor doesnt seem to work on 32-bit +- printf +- ("I dont know the CPUID code to check on 32-bit OS, so i will assume that you have an Intel processor\n"); +- printf ("Don't worry if i don't find a nehalem next, i'll quit anyways\n"); +-#endif + + get_familyinformation (&proc_info); + print_family_info (&proc_info); +--- a/i7z.h ++++ b/i7z.h +@@ -106,9 +106,7 @@ __asm__ __volatile__ ("rdtsc":"=a" (lo), "=d" (hi)); + + void print_family_info (struct family_info *proc_info); + +-#ifdef x64_BIT + void get_vendor (char *vendor_string); +-#endif + + int turbo_status (); + double cpufreq_info(); diff --git a/app-benchmarks/i7z/i7z-0.27-r1.ebuild b/app-benchmarks/i7z/i7z-0.27-r1.ebuild new file mode 100644 index 000000000000..daeb55753b78 --- /dev/null +++ b/app-benchmarks/i7z/i7z-0.27-r1.ebuild @@ -0,0 +1,46 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-benchmarks/i7z/i7z-0.27-r1.ebuild,v 1.1 2011/08/31 14:16:25 vapier Exp $ + +EAPI="4" + +inherit eutils qt4-r2 toolchain-funcs + +DESCRIPTION="A better i7 (and now i3, i5) reporting tool for Linux" +HOMEPAGE="http://code.google.com/p/i7z/" +SRC_URI="http://${PN}.googlecode.com/files/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" +IUSE="X" + +RDEPEND=" + sys-libs/ncurses + X? ( x11-libs/qt-gui:4 )" +DEPEND="${RDEPEND}" + +S="${WORKDIR}"/${PN} + +src_prepare() { + epatch "${FILESDIR}"/${PV}-gentoo.patch + epatch "${FILESDIR}"/${P}-cpuid.patch + tc-export CC +} + +src_compile() { + default + if use X; then + cd GUI + eqmake4 GUI.pro + emake + fi +} + +src_install() { + emake DESTDIR="${ED}" install + if use X; then + newsbin GUI/GUI i7z_GUI + fi + dodoc put_cores_o*line.sh MAKEDEV-cpuid-msr +} |