Subject: rdmsr() function
To: None <port-i386@netbsd.org>
From: Rui Paulo <phlox-netbsd-i386@fnop.net>
List: port-i386
Date: 09/21/2004 19:21:00
Greetings.
There are some MSRs in IA-32 that are 64-bits wide. Currently, the rdmsr()
function doesn't support reading those MSRs because it only returns EAX and not 
EDX (since each register is 32-bits wide, we must combine both).
This isn't a problem right know, but I think we must make rdmsr() return both
registers to ensure future compatibility. For instance, I want to read
IA32_PLATAFORM_ID MSR (0x17) and it's 64 bits wide. Right now, I can't find
another way to do that instead of doing:
left = rdsmr(0x17); /* returns EAX */
__asm __volatile("movl %%edx, %0" : "=g" (right));

Linux handles this by using 3 function parameters.
Another solution is not to modify rdmsr() (it will be very painful to change all
those rdmsr() calls) and add a rdmsr64() function that could return u_int64_t by
combining EAX and EDX.

Comments?

-- 
Rui Paulo                          "Simplicity is the ultimate sophistication."
                                      -- Leonardo da Vinci