]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add AccessMsrDb.s for MSFT tool chain. It uses raw data to represent instructions...
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 17 Dec 2008 09:58:39 +0000 (09:58 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 17 Dec 2008 09:58:39 +0000 (09:58 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7069 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/BaseLib/BaseLib.inf
MdePkg/Library/BaseLib/Ipf/AccessMsrDb.s [new file with mode: 0644]

index 519dea10e3cd185f02b41a580ac2f0d9fc356c57..99280baaa236e615f5d290ab8f0b7fc7dfb5e8df 100644 (file)
   Ipf/AccessEicr.s\r
   Ipf/AccessDbr.s\r
   Ipf/AccessMsr.s        | INTEL\r
+  Ipf/AccessMsr.s        | GCC\r
+  Ipf/AccessMsrDb.s      | MSFT\r
   Ipf/FlushCacheRange.s\r
   Ipf/InternalSwitchStack.c\r
   Ipf/GetInterruptState.s\r
diff --git a/MdePkg/Library/BaseLib/Ipf/AccessMsrDb.s b/MdePkg/Library/BaseLib/Ipf/AccessMsrDb.s
new file mode 100644 (file)
index 0000000..5fea504
--- /dev/null
@@ -0,0 +1,121 @@
+/// @file\r
+///  IPF specific Machine Specific Registers accessing functions. \r
+///  This implementation uses raw data to prepresent the assembly instruction of \r
+/// mov msr[]= and mov =msr[].\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
+//\r
+// The follow 16 bytes stand for the bundle of \r
+//   mov    r8=msr[in0];;\r
+// since MSFT tool chain does not support mov =msr[] instruction\r
+//\r
+  data1 0x0D\r
+  data1 0x40\r
+  data1 0x00\r
+  data1 0x40\r
+  data1 0x16\r
+  data1 0x04\r
+  data1 0x00\r
+  data1 0x00\r
+  data1 0x00\r
+  data1 0x02\r
+  data1 0x00\r
+  data1 0x00\r
+  data1 0x00\r
+  data1 0x00\r
+  data1 0x04\r
+  data1 0x00\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
+//\r
+// The follow 16 bytes stand for the bundle of \r
+//  mov             msr[in0] = in1\r
+//  mov             r8 = in1;;\r
+// since MSFT tool chain does not support mov msr[]= instruction\r
+//\r
+  data1 0x0D\r
+  data1 0x00\r
+  data1 0x84\r
+  data1 0x40\r
+  data1 0x06\r
+  data1 0x04\r
+  data1 0x00\r
+  data1 0x00\r
+  data1 0x00\r
+  data1 0x02\r
+  data1 0x00\r
+  data1 0x00\r
+  data1 0x01\r
+  data1 0x08\r
+  data1 0x01\r
+  data1 0x84\r
+  srlz.d;;\r
+  br.ret.sptk     b0;;\r
+.endp   AsmWriteMsr\r
+\r