52 lines · c
1/*===--------------- usermsrintrin.h - USERMSR intrinsics -----------------===2 *3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4 * See https://llvm.org/LICENSE.txt for license information.5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6 *7 *===-----------------------------------------------------------------------===8 */9#ifndef __X86GPRINTRIN_H10#error "Never use <usermsrintrin.h> directly; include <x86gprintrin.h> instead."11#endif // __X86GPRINTRIN_H12 13#ifndef __USERMSRINTRIN_H14#define __USERMSRINTRIN_H15#ifdef __x86_64__16 17/// Reads the contents of a 64-bit MSR specified in \a __A into \a dst.18///19/// This intrinsic corresponds to the <c> URDMSR </c> instruction.20/// \param __A21/// An unsigned long long.22///23/// \code{.operation}24/// DEST := MSR[__A]25/// \endcode26static __inline__ unsigned long long27 __attribute__((__always_inline__, __nodebug__, __target__("usermsr")))28 _urdmsr(unsigned long long __A) {29 return __builtin_ia32_urdmsr(__A);30}31 32/// Writes the contents of \a __B into the 64-bit MSR specified in \a __A.33///34/// This intrinsic corresponds to the <c> UWRMSR </c> instruction.35///36/// \param __A37/// An unsigned long long.38/// \param __B39/// An unsigned long long.40///41/// \code{.operation}42/// MSR[__A] := __B43/// \endcode44static __inline__ void45 __attribute__((__always_inline__, __nodebug__, __target__("usermsr")))46 _uwrmsr(unsigned long long __A, unsigned long long __B) {47 return __builtin_ia32_uwrmsr(__A, __B);48}49 50#endif // __x86_64__51#endif // __USERMSRINTRIN_H52