Re: [PATCH 2/3] x86, msr: rewrite AMD rd/wrmsr variants

H. Peter Anvin
2009-08-30T20:05:25Z

On 08/30/2009 04:50 AM, Borislav Petkov wrote:
> +
> +#define memset(d,c,l) __builtin_memset(d,c,l)
> static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
> {
> - int err;
> + u32 gprs[8];
> + int err, i;
> +
> + memset(gprs, 0, sizeof(u32) * 8);
> +
> + gprs[1] = msr;
> + gprs[7] = 0x9c5a203a;
> +
> + err = native_rdmsr_safe_regs(gprs);
> +
> + *p = gprs[0] | ((u64)gprs[2] << 32);
>
> - *p = native_read_msr_amd_safe(msr, &err);
> return err;
> }
>

In file included from
/home/hpa/kernel/linux-2.6-tip.msr/arch/x86/include/asm/processor.h:21,
from
/home/hpa/kernel/linux-2.6-tip.msr/include/linux/prefetch.h:14,
from
/home/hpa/kernel/linux-2.6-tip.msr/include/linux/list.h:6,
from
/home/hpa/kernel/linux-2.6-tip.msr/include/linux/smp.h:11,
from
/home/hpa/kernel/linux-2.6-tip.msr/include/linux/kernel_stat.h:4,
from
/home/hpa/kernel/linux-2.6-tip.msr/arch/x86/kernel/irq_64.c:11:
/home/hpa/kernel/linux-2.6-tip.msr/arch/x86/include/asm/msr.h: In
function ‘rdmsrl_amd_safe’:
/home/hpa/kernel/linux-2.6-tip.msr/arch/x86/include/asm/msr.h:176:
warning: unused variable ‘i’

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.