Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Helpers/definitions related to MSR access.
0004  */
0005 
0006 #ifndef BOOT_MSR_H
0007 #define BOOT_MSR_H
0008 
0009 #include <asm/shared/msr.h>
0010 
0011 /*
0012  * The kernel proper already defines rdmsr()/wrmsr(), but they are not for the
0013  * boot kernel since they rely on tracepoint/exception handling infrastructure
0014  * that's not available here.
0015  */
0016 static inline void boot_rdmsr(unsigned int reg, struct msr *m)
0017 {
0018     asm volatile("rdmsr" : "=a" (m->l), "=d" (m->h) : "c" (reg));
0019 }
0020 
0021 static inline void boot_wrmsr(unsigned int reg, const struct msr *m)
0022 {
0023     asm volatile("wrmsr" : : "c" (reg), "a"(m->l), "d" (m->h) : "memory");
0024 }
0025 
0026 #endif /* BOOT_MSR_H */