zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

usermsrintrin.h (1572B) - Raw


      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-exception
      6  *
      7  *===-----------------------------------------------------------------------===
      8  */
      9 #ifndef __X86GPRINTRIN_H
     10 #error "Never use <usermsrintrin.h> directly; include <x86gprintrin.h> instead."
     11 #endif // __X86GPRINTRIN_H
     12 
     13 #ifndef __USERMSRINTRIN_H
     14 #define __USERMSRINTRIN_H
     15 #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 __A
     21 ///    An unsigned long long.
     22 ///
     23 /// \code{.operation}
     24 ///    DEST := MSR[__A]
     25 /// \endcode
     26 static __inline__ unsigned long long
     27     __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 __A
     37 ///    An unsigned long long.
     38 /// \param __B
     39 ///    An unsigned long long.
     40 ///
     41 /// \code{.operation}
     42 ///    MSR[__A] := __B
     43 /// \endcode
     44 static __inline__ void
     45     __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_H