tag 662658 +patch kthxbye Hi!
The patch below compiles on both linux-amd64 and kfreebsd-amd64. I have tested the resulting binary on both architectures and it seems to work. output of `x86info -a` on the same hardware (Thinkpad X220 with Intel i5 2520M) is identical (apart from 2 different register assignments). The first hunk is needed to build (header doesn't exist on !linux). The second part is taken from FreeBSD Ports as well. I haven't included the conditionals on kernel version as the "old" way is suited for pre-squeeze kernels and not relevant to us (the freebsd patch adds the new interface). Regards Christoph --- x86info-1.30.orig/mtrr.c +++ x86info-1.30/mtrr.c @@ -8,7 +8,6 @@ */ #include <stdio.h> -#include <asm/mtrr.h> #include "x86info.h" #define IA32_MTRRCAP_SMRR 0x800 @@ -25,7 +24,7 @@ static unsigned int max_phy_addr = 0; -static char * mtrr_types[MTRR_NUM_TYPES] = +static char * mtrr_types[] = { "uncacheable", "write-combining", --- x86info-1.30.orig/rdmsr.c +++ x86info-1.30/rdmsr.c @@ -18,8 +18,10 @@ #include "x86info.h" #if defined(__FreeBSD__) +# include <sys/param.h> # include <sys/ioctl.h> -# include <cpu.h> +# define CPUDEV "/dev/cpuctl%d" +# include <sys/cpuctl.h> #endif #if defined(__FreeBSD__) @@ -27,16 +29,14 @@ int read_msr(int cpu, unsigned int idx, unsigned long long *val) { char cpuname[16]; - unsigned char buffer[8]; - unsigned long lo, hi; int fh; static int nodriver=0; - cpu_msr_args_t args; + cpuctl_msr_args_t args; if (nodriver==1) return 0; - (void)snprintf(cpuname, sizeof(cpuname), "/dev/cpu%d", cpu); + (void)snprintf(cpuname, sizeof(cpuname), CPUDEV, cpu); fh = open(cpuname, O_RDONLY); if (fh==-1) { @@ -46,7 +46,7 @@ } args.msr = idx; - if (ioctl(fh, CPU_RDMSR, &args) != 0) { + if (ioctl(fh, CPUCTL_RDMSR, &args) != 0) { if (close(fh) == -1) { perror("close"); exit(EXIT_FAILURE); -- 9FED 5C6C E206 B70A 5857 70CA 9655 22B9 D49A E731 Debian Developer | Lisp Hacker | CaCert Assurer -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org