[coreboot] r3920 - trunk/util/msrtool

svn at coreboot.org svn at coreboot.org
Mon Jan 26 18:03:05 CET 2009


Author: stuge
Date: 2009-01-26 18:03:05 +0100 (Mon, 26 Jan 2009)
New Revision: 3920

Modified:
   trunk/util/msrtool/linux.c
Log:
msrtool: Linux /dev/cpu/*/msr returns the low 32 bits before the high 32 bits.

Thanks to Mart for spotting this!

Signed-off-by: Peter Stuge <peter at stuge.se>
Acked-by: Peter Stuge <peter at stuge.se>


Modified: trunk/util/msrtool/linux.c
===================================================================
--- trunk/util/msrtool/linux.c	2009-01-26 15:29:27 UTC (rev 3919)
+++ trunk/util/msrtool/linux.c	2009-01-26 17:03:05 UTC (rev 3920)
@@ -76,13 +76,16 @@
 }
 
 int linux_rdmsr(uint8_t cpu, uint32_t addr, struct msr *val) {
+	struct msr tmp;
 	if (lseek(msr_fd[cpu], addr, SEEK_SET) == -1) {
 		SYSERROR(lseek, addr);
 		return 0;
 	}
-	if (read(msr_fd[cpu], val, 8) != 8) {
+	if (read(msr_fd[cpu], &tmp, 8) != 8) {
 		SYSERROR(read, addr);
 		return 0;
 	}
+	val->hi = tmp.lo;
+	val->lo = tmp.hi;
 	return 1;
 }





More information about the coreboot mailing list