retitle 468696 x86info: FTBFS on hurd-i386
tags 468696 patch
severity 468696 important
thanks

Hello,

With the new release of x86info the previously attached patch does not
work any longer. Attached is a new patch which works well for GNU/Hurd.
 
The patch adds a GNU specific path of supported parts for GNU/Hurd in
cpuid.c and adds hurd-i386 to the control field. The last change embeds
the creation of /dev/cpu to the GNU/Linux architecture only.
 
Attached is also the output of the patched version using the --all
switch run from a kvm guest, identifying itself as a qemu64 CPU with a
amd64 host.

A Cc: is sent to upstream to figure out the interest of adding support
for GNU/Hurd in this package. The upstream changes are solely in in
cpuid.c, the rest is Debian specific.
diff -ur x86info-1.30/cpuid.c x86info-1.30.new/cpuid.c
--- x86info-1.30/cpuid.c	2011-12-09 17:06:57.000000000 +0100
+++ x86info-1.30.new/cpuid.c	2012-06-05 09:59:36.000000000 +0200
@@ -45,9 +45,13 @@
 	unsigned int *eax, unsigned int *ebx,
 	unsigned int *ecx, unsigned int *edx)
 {
+#ifdef __GNU__
+	cpu_set_t set;
+#else
 	cpu_set_t set, tmp_set;
-	unsigned int a = 0, b = 0, c = 0, d = 0;
 	int ret;
+#endif
+	unsigned int a = 0, b = 0, c = 0, d = 0;
 
 	if (eax != NULL)
 		a = *eax;
@@ -58,6 +62,10 @@
 	if (edx != NULL)
 		d = *edx;
 
+#ifdef __GNU__
+	CPU_ZERO(&set);
+	CPU_SET(cpunr, &set);
+#else
 	ret = sched_getaffinity(getpid(), sizeof(set), &set);
 	if (ret)
 		return ret;
@@ -69,6 +77,7 @@
 	ret = sched_setaffinity(getpid(), sizeof(set), &set);
 	if (ret)
 		return ret;
+#endif
 
 	asm("cpuid"
 		: "=a" (a),
@@ -86,10 +95,12 @@
 	if (edx!=NULL)
 		*edx = d;
 
+#ifndef __GNU__
 	/* Restore initial sched affinity */
 	ret = sched_setaffinity(getpid(), sizeof(tmp_set), &tmp_set);
 	if (ret)
 		return ret;
+#endif
 	return 0;
 }
 
diff -ur x86info-1.30/debian/control x86info-1.30.new/debian/control
--- x86info-1.30/debian/control	2012-06-05 09:41:58.000000000 +0200
+++ x86info-1.30.new/debian/control	2012-06-01 21:35:56.000000000 +0200
@@ -7,7 +7,7 @@
 Standards-Version: 3.8.3
 
 Package: x86info
-Architecture: i386 amd64 kfreebsd-i386 kfreebsd-amd64
+Architecture: i386 amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386
 Depends: ${shlibs:Depends}, ${misc:Depends}, makedev (>= 2.3.1-53) | udev
 Description: Display diagnostic information about i386 compatible CPUs
  x86info displays diagnostic information about the CPUs fitted to i386
diff -ur x86info-1.30/debian/postinst x86info-1.30.new/debian/postinst
--- x86info-1.30/debian/postinst	2012-06-05 09:41:58.000000000 +0200
+++ x86info-1.30.new/debian/postinst	2012-06-05 10:01:38.000000000 +0200
@@ -4,6 +4,8 @@
 
 #DEBHELPER#
 
+if [ `uname` = Linux ]; then
 if [ ! -c /dev/cpu/0/cpuid -a -x /dev/MAKEDEV ]; then
 	(cd /dev ; ./MAKEDEV cpu )
 fi
+fi
x86info v1.30.  Dave Jones 2001-2011
Feedback to <[email protected]>.

Family: 6 Model: 2 Stepping: 3
Type: 0 (Original OEM)
CPU Model (x86info's best guess): Unknown model. 

eax in: 0x00000000, eax = 00000004 ebx = 756e6547 ecx = 6c65746e edx = 49656e69
eax in: 0x00000001, eax = 00000623 ebx = 00000800 ecx = 80002001 edx = 078bfbfd
eax in: 0x00000002, eax = 00000001 ebx = 00000000 ecx = 00000000 edx = 002c307d
eax in: 0x00000003, eax = 00000000 ebx = 00000000 ecx = 00000000 edx = 00000000
eax in: 0x00000004, eax = 00000121 ebx = 01c0003f ecx = 0000003f edx = 00000001

eax in: 0x80000000, eax = 8000000a ebx = 68747541 ecx = 444d4163 edx = 69746e65
eax in: 0x80000001, eax = 00000623 ebx = 00000000 ecx = 00000001 edx = 2191abfd
eax in: 0x80000002, eax = 554d4551 ebx = 72695620 ecx = 6c617574 edx = 55504320
eax in: 0x80000003, eax = 72657620 ebx = 6e6f6973 ecx = 302e3120 edx = 00000000
eax in: 0x80000004, eax = 00000000 ebx = 00000000 ecx = 00000000 edx = 00000000
eax in: 0x80000005, eax = 01ff01ff ebx = 01ff01ff ecx = 40020140 edx = 40020140
eax in: 0x80000006, eax = 00000000 ebx = 42004200 ecx = 02008140 edx = 00000000
eax in: 0x80000007, eax = 00000000 ebx = 00000000 ecx = 00000000 edx = 00000000
eax in: 0x80000008, eax = 00003028 ebx = 00000000 ecx = 00000000 edx = 00000000
eax in: 0x80000009, eax = 00000000 ebx = 00000000 ecx = 00000000 edx = 00000000
eax in: 0x8000000a, eax = 00000000 ebx = 00000000 ecx = 00000000 edx = 00000000

Cache info
 L1 Instruction cache: 32KB, 8-way associative. 64 byte line size.
 L1 Data cache: 32KB, 8-way associative. 64 byte line size.
 L2 cache: 2MB, 8-way associative. 64 byte line size.
TLB info
Feature flags:
 fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflsh mmx 
fxsr sse sse2 sse3 cx16 [1:ecx:31]
Extended feature flags:
 [80000001:edx:0] [80000001:edx:2] [80000001:edx:3] [80000001:edx:4] 
[80000001:edx:5] [80000001:edx:6] [80000001:edx:7] [80000001:edx:8] 
[80000001:edx:9] SYSCALL [80000001:edx:13] [80000001:edx:15] [80000001:edx:16] 
xd [80000001:edx:23] [80000001:edx:24] em64t lahf_lm
Long NOPs supported: yes

Address sizes : 40 bits physical, 48 bits virtual
2.65GHz processor (estimate).

Total processor threads: 1
This system has 1 processor running at an estimated 2.65GHz

Reply via email to