From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Dec 29 21:10:02 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C8AD289 for ; Sun, 29 Dec 2013 21:10:02 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 35A4D1835 for ; Sun, 29 Dec 2013 21:10:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTLA2Jk070703 for ; Sun, 29 Dec 2013 21:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rBTLA2UG070702; Sun, 29 Dec 2013 21:10:02 GMT (envelope-from gnats) Resent-Date: Sun, 29 Dec 2013 21:10:02 GMT Resent-Message-Id: <201312292110.rBTLA2UG070702@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Valentin Nechayev Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C771B27E for ; Sun, 29 Dec 2013 21:08:37 +0000 (UTC) Received: from segfault.kiev.ua (segfault.kiev.ua [193.193.193.4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E280C182D for ; Sun, 29 Dec 2013 21:08:36 +0000 (UTC) Received: from segfault.kiev.ua (localhost.segfault.kiev.ua [127.0.0.1]) by segfault.kiev.ua (8.14.5/8.14.5/8.Who.Cares) with ESMTP id rBTL1KqM038230; Sun, 29 Dec 2013 23:01:20 +0200 (EET) (envelope-from netch@segfault.kiev.ua) Received: (from netch@localhost) by segfault.kiev.ua (8.14.5/8.14.5/Submit) id rBTL1F83038227; Sun, 29 Dec 2013 23:01:15 +0200 (EET) (envelope-from netch) Message-Id: <201312292101.rBTL1F83038227@segfault.kiev.ua> Date: Sun, 29 Dec 2013 23:01:15 +0200 (EET) From: Valentin Nechayev To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: ports/185277: misc/cpuid update with new Intel features X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Valentin Nechayev List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2013 21:10:02 -0000 >Number: 185277 >Category: ports >Synopsis: misc/cpuid update with new Intel features >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Dec 29 21:10:01 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Valentin Nechayev >Release: FreeBSD 9.1-RELEASE-p7 i386 >Organization: private >Environment: >Description: Update with new Intel features. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: Patch against the port: diff -u -rNu Makefile Makefile --- Makefile +++ Makefile @@ -3,7 +3,7 @@ PORTNAME= cpuid PORTVERSION= 3.3 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= misc MASTER_SITES= http://www.ka9q.net/code/cpuid/ diff -u -rNu files/patch-cpuid.c files/patch-cpuid.c --- files/patch-cpuid.c +++ files/patch-cpuid.c @@ -1,6 +1,6 @@ --- cpuid.c +++ cpuid.c -@@ -3,34 +3,56 @@ +@@ -3,38 +3,62 @@ * Updated 24 Apr 2001 to latest Intel CPUID spec * Updated 22 Dec 2001 to decode Intel flag 28, hyper threading * Updated 1 Jan 2002 to cover AMD Duron, Athlon @@ -65,16 +65,42 @@ }; #define cpuid(in,a,b,c,d)\ -@@ -89,7 +110,7 @@ + asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (in)); ++#define cpuidx(in,in2,a,b,c,d)\ ++ asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (in), "c" (in2)); + + int main(){ + int i; +@@ -48,8 +72,9 @@ + printf(" eax in eax ebx ecx edx\n"); + for(i=0;i<=maxi;i++){ + unsigned long eax,ebx,ecx,edx; ++ ecx = 0; /* basic query for leaves that dependent on it */ + +- cpuid(i,eax,ebx,ecx,edx); ++ cpuidx(i,ecx,eax,ebx,ecx,edx); + printf("%08x %08lx %08lx %08lx %08lx\n",i,eax,ebx,ecx,edx); + } + cpuid(0x80000000,maxei,unused,unused,unused); +@@ -89,7 +114,7 @@ exit(0); } -char *Intel_feature_flags[] = { -+char *Intel_feature_flags[32] = { ++char *Intel_feature_flags1[32] = { "FPU Floating Point Unit", "VME Virtual 8086 Mode Enhancements", "DE Debugging Extensions", -@@ -121,7 +142,64 @@ +@@ -108,7 +133,7 @@ + "CMOV Conditional Move and Compare Instructions", + "FGPAT Page Attribute Table", + "PSE-36 36-bit Page Size Extension", +- "PN Processor Serial Number present and enabled", ++ "PSN Processor Serial Number present and enabled", + "CLFSH CFLUSH instruction", + "20 reserved", + "DS Debug store", +@@ -121,7 +146,76 @@ "HT Hyper Threading", "TM Thermal monitor", "30 reserved", @@ -95,27 +121,29 @@ + "SSSE3 Supplemental Streaming SIMD Extension 3", + "CNXT-ID L1 Context ID", + NULL, -+ NULL, ++ "FMA Fused Multiply-Add", + "CX16 CMPXCHG16B", + "xTPR Send Task Priority messages", + "PDCM Perfmon and debug capability", + NULL, -+ NULL, ++ "PCID Process-Context Identifiers", + "DCA Direct Cache Access", + "SSE4.1 Streaming SIMD Extension 4.1", + "SSE4.2 Streaming SIMD Extension 4.2", + "x2APIC Extended xAPIC support", + "MOVBE MOVBE instruction", + "POPCNT POPCNT instruction", -+ NULL, ++ "TSC-Deadline", + "AESNI AES Instruction set", + "XSAVE XSAVE/XSTOR states", + "OSXSAVE OS-enabled extended state managerment", + "AVX AVX extensions", -+ NULL, NULL, NULL ++ "F16C 16-bit floating convert instructions", ++ "RDRAND RDRAND instruction", ++ NULL +}; + -+char *Intel_ext_feature_flags[32] = { ++char *Intel_ext_feature_flags1[32] = { + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, + "SYSCALL SYSCALL/SYSRET instructions", @@ -137,10 +165,20 @@ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ++}; ++ ++char *Intel_struct_ext_feature_flags_7_0_b[32] = { ++ "FSGSBASE", "IA32_TSC_ADJUST MSR", ++ NULL, "BMI1", "HLE", "AVX2", NULL, "SMEP", ++ "BMI2", "Enhanced REP MOVSB/STOSB", ++ "INVPCID", "RTM", "Quality of Service Monitoring capability", ++ "Deprecates FPU CS and FPU DS", NULL, NULL, ++ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ++ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; /* Intel-specific information */ -@@ -131,22 +209,31 @@ +@@ -131,22 +225,31 @@ if(maxi >= 1){ /* Family/model/type etc */ int clf,apic_id,feature_flags; @@ -179,7 +217,7 @@ printf("Type %d - ",type); switch(type){ -@@ -183,10 +270,6 @@ +@@ -183,10 +286,6 @@ printf("Pentium 4"); } printf("\n"); @@ -190,7 +228,7 @@ printf("Model %d - ",model); switch(family){ case 3: -@@ -253,33 +336,72 @@ +@@ -253,33 +352,72 @@ case 8: printf("Pentium III/Pentium III Xeon - internal L2 cache"); break; @@ -270,19 +308,22 @@ if(maxe >= 0x80000004){ int i; -@@ -303,12 +425,48 @@ +@@ -303,10 +441,50 @@ printf("Hyper threading siblings: %d\n",siblings); } - printf("\nFeature flags %08x:\n",feature_flags); -+ printf("\nFeature flags: %08x:\n",feature_flags); ++ printf("\nFeature flags set 1 (CPUID.01H:EDX): %08x:\n", ++ feature_flags); for(i=0;i<32;i++){ if(feature_flags & (1<> 16); + printf("-%04lX",signature & 0xffff); + printf("-%04lX",edx >> 16); +@@ -360,6 +538,72 @@ + printf("-%04lX",ecx >> 16); + printf("-%04lX\n",ecx & 0xffff); } - if(maxi >= 2){ -@@ -396,18 +554,66 @@ ++ if (maxi >= 4) { ++ unsigned long index, eax, ebx, ecx, edx, ctype; ++ unsigned long linesize, partitions, ways, sets, t; ++ for (index = 0; ; ++index) { ++ cpuidx(4,index,eax,ebx,ecx,edx); ++ ctype = eax&31; ++ if (ctype == 0) ++ break; ++ if (index==0) ++ printf("\nDeterministic Cache Parameters:\n"); ++ printf("index=%lu: eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx\n> ", ++ index, eax, ebx, ecx, edx); ++ switch (ctype) { ++ case 1: ++ printf("Data cache"); ++ break; ++ case 2: ++ printf("Instruction cache"); ++ break; ++ case 3: ++ printf("Unified cache"); ++ break; ++ default: ++ printf("Unknown cache type (%lu)", ctype); ++ } ++ printf(", level %lu", (eax>>5)&7); ++ if (eax&0x100u) ++ printf(", self initializing"); ++ if (eax&0x200u) ++ printf(", fully associative"); ++ printf("\n"); ++ sets = ecx+1; ++ ways = ((ebx>>22)&0x3ffu)+1; ++ partitions = ((ebx>>12)&0x3ffu)+1; ++ linesize = (ebx&0xfffu)+1; ++ printf("> %lu sets", sets); ++ printf(", %lu ways", ways); ++ printf(", %lu partitions", partitions); ++ printf(", line size %lu", linesize); ++ printf("\n> full size %lu bytes\n", sets*ways*partitions*linesize); ++ t = (eax>>14)&0xfffu; ++ if (t>0) ++ printf("> shared between up to %lu threads\n", t+1); ++ t = (eax>>26)&0x3fu; ++ if (index==0 && t>0) ++ printf("> NB this package has up to %lx threads\n", t+1); ++ } ++ } ++ if (maxi >= 7) { ++ unsigned i; ++ unsigned long eax, ebx, ecx, edx; ++ cpuidx(7, 0, eax, ebx, ecx, edx); ++ if (ebx != 0) { ++ printf("\nStructured feature flags CPUID.07H.00H:EBX: %08lx:\n", ++ ebx); ++ for(i=0;i<32;i++){ ++ if(ebx & (1<