1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Helpers/definitions related to MSR access.
9 #include <asm/shared/msr.h>
12 * The kernel proper already defines rdmsr()/wrmsr(), but they are not for the
13 * boot kernel since they rely on tracepoint/exception handling infrastructure
14 * that's not available here.
16 static inline void boot_rdmsr(unsigned int reg, struct msr *m)
18 asm volatile("rdmsr" : "=a" (m->l), "=d" (m->h) : "c" (reg));
21 static inline void boot_wrmsr(unsigned int reg, const struct msr *m)
23 asm volatile("wrmsr" : : "c" (reg), "a"(m->l), "d" (m->h) : "memory");
26 #endif /* BOOT_MSR_H */