Subject: Re: rdmsr() function
To: None <port-i386@netbsd.org>
From: Rui Paulo <phlox-netbsd-i386@fnop.net>
List: port-i386
Date: 09/23/2004 00:14:47
Thanks for you reply.
Here is the diff with the changes you suggested:
Index: cpufunc.h
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/include/cpufunc.h,v
retrieving revision 1.28
diff -u -r1.28 cpufunc.h
--- cpufunc.h 14 Jan 2004 11:31:55 -0000 1.28
+++ cpufunc.h 22 Sep 2004 23:12:48 -0000
@@ -245,6 +245,19 @@
return (rv);
}
+static __inline u_int64_t
+rdmsr64(u_int msr)
+{
+ u_int64_t rv;
+ u_int32_t regs[2];
+
+ __asm __volatile("rdmsr" : "=A" (regs[0]), "=D" (regs[1]) : "c" (msr));
+ rv = ((u_int64_t) regs[1] << 32) | regs[0];
+
+ return (rv);
+
+}
+
static __inline void
wrmsr(u_int msr, u_int64_t newval)
{
@@ -252,6 +265,13 @@
}
static __inline void
+wrmsr64(u_int msr, u_int64_t newval)
+{
+ __asm __volatile("wrmsr" : : "A" (newval >> 32),
+ "D" (newval & 0xffffffff), "c" (msr));
+}
+
+static __inline void
wbinvd(void)
{
__asm __volatile("wbinvd");
Regards.
--
Rui Paulo "Simplicity is the ultimate sophistication."
-- Leonardo da Vinci