summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stuge <peter@stuge.se>2009-01-26 17:03:05 +0000
committerPeter Stuge <peter@stuge.se>2009-01-26 17:03:05 +0000
commitc1d6ed9a21bc96b0d4eb778b78c65b304e5e46f9 (patch)
treeff3bfd3373e52dcb5c5dfa7eab66656e78847ea7
parenta8866243d89f5a6da3fe1558b6ac469130275d97 (diff)
downloadcoreboot-c1d6ed9a21bc96b0d4eb778b78c65b304e5e46f9.tar.xz
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@stuge.se> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3920 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r--util/msrtool/linux.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/util/msrtool/linux.c b/util/msrtool/linux.c
index efd3087061..ac94d803f9 100644
--- a/util/msrtool/linux.c
+++ b/util/msrtool/linux.c
@@ -76,13 +76,16 @@ int linux_close(uint8_t cpu) {
}
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;
}