]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/Ipf/AccessMsr.s
1. Simplify the implementation of AsmReadApplicationRegister() & AsmReadControlRegist...
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ipf / AccessMsr.s
diff --git a/MdePkg/Library/BaseLib/Ipf/AccessMsr.s b/MdePkg/Library/BaseLib/Ipf/AccessMsr.s
new file mode 100644 (file)
index 0000000..bb8ae34
--- /dev/null
@@ -0,0 +1,79 @@
+/// @file\r
+///  IPF specific Machine Specific Registers accessing functions.\r
+///\r
+/// Copyright (c) 2008, Intel Corporation\r
+/// All rights reserved. This program and the accompanying materials\r
+/// are licensed and made available under the terms and conditions of the BSD License\r
+/// which accompanies this distribution.  The full text of the license may be found at\r
+/// http://opensource.org/licenses/bsd-license.php\r
+///\r
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+///\r
+///\r
+///\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadMsr\r
+//\r
+// Reads the current value of a Machine Specific Register (MSR).\r
+//\r
+// Reads and returns the current value of the Machine Specific Register specified by Index.  No\r
+// parameter checking is performed on Index, and if the Index value is beyond the implemented MSR\r
+// register range, a Reserved Register/Field fault may occur.  The caller must either guarantee that\r
+// Index is valid, or the caller must set up fault handlers to catch the faults.  This function is\r
+// only available on IPF.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The 8-bit Machine Specific Register index to read.\r
+//\r
+// Return Value: The current value of the Machine Specific Register specified by Index.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type   AsmReadMsr, @function\r
+.proc   AsmReadMsr\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmReadMsr::\r
+  mov    r8=msr[in0];;\r
+  br.ret.sptk  b0;;\r
+.endp   AsmReadMsr\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteMsr\r
+//\r
+// Writes the current value of a Machine Specific Register (MSR).\r
+//\r
+// Writes Value to the Machine Specific Register specified by Index.  Value is returned.  No\r
+// parameter checking is performed on Index, and if the Index value is beyond the implemented MSR\r
+// register range, a Reserved Register/Field fault may occur.  The caller must either guarantee that\r
+// Index is valid, or the caller must set up fault handlers to catch the faults.  This function is\r
+// only available on IPF.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The 8-bit Machine Specific Register index to write.\r
+//            The 64-bit value to write to the Machine Specific Register.\r
+//\r
+// Return Value: The 64-bit value to write to the Machine Specific Register.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type   AsmWriteMsr, @function\r
+.proc   AsmWriteMsr\r
+.regstk 2, 0, 0, 0\r
+\r
+AsmWriteMsr::\r
+  mov             msr[in0] = in1\r
+  mov             r8 = in1;;\r
+  srlz.d;;\r
+  br.ret.sptk     b0;;\r
+.endp   AsmWriteMsr\r
+\r