]> git.proxmox.com Git - mirror_edk2.git/commitdiff
created a CpuLib for CpuSleep and CpuFlushTlb from BaseLib to remove circular depende...
authorvprabhal <vprabhal@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 5 Oct 2007 18:47:03 +0000 (18:47 +0000)
committervprabhal <vprabhal@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 5 Oct 2007 18:47:03 +0000 (18:47 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4020 6f19259b-4bc3-4df7-8a09-765794883524

20 files changed:
MdePkg/Library/CpuLib/CpuLib.inf [new file with mode: 0644]
MdePkg/Library/CpuLib/Ebc/CpuSleepFlushTlb.c [new file with mode: 0644]
MdePkg/Library/CpuLib/Ia32/CpuFlushTlb.S [new file with mode: 0644]
MdePkg/Library/CpuLib/Ia32/CpuFlushTlb.asm [new file with mode: 0644]
MdePkg/Library/CpuLib/Ia32/CpuFlushTlb.c [new file with mode: 0644]
MdePkg/Library/CpuLib/Ia32/CpuPause.S [new file with mode: 0644]
MdePkg/Library/CpuLib/Ia32/CpuPause.asm [new file with mode: 0644]
MdePkg/Library/CpuLib/Ia32/CpuPause.c [new file with mode: 0644]
MdePkg/Library/CpuLib/Ia32/CpuSleep.S [new file with mode: 0644]
MdePkg/Library/CpuLib/Ia32/CpuSleep.asm [new file with mode: 0644]
MdePkg/Library/CpuLib/Ia32/CpuSleep.c [new file with mode: 0644]
MdePkg/Library/CpuLib/Ipf/CpuFlushTlb.s [new file with mode: 0644]
MdePkg/Library/CpuLib/Ipf/CpuPause.s [new file with mode: 0644]
MdePkg/Library/CpuLib/Ipf/CpuSleep.c [new file with mode: 0644]
MdePkg/Library/CpuLib/X64/CpuFlushTlb.S [new file with mode: 0644]
MdePkg/Library/CpuLib/X64/CpuFlushTlb.asm [new file with mode: 0644]
MdePkg/Library/CpuLib/X64/CpuPause.S [new file with mode: 0644]
MdePkg/Library/CpuLib/X64/CpuPause.asm [new file with mode: 0644]
MdePkg/Library/CpuLib/X64/CpuSleep.S [new file with mode: 0644]
MdePkg/Library/CpuLib/X64/CpuSleep.asm [new file with mode: 0644]

diff --git a/MdePkg/Library/CpuLib/CpuLib.inf b/MdePkg/Library/CpuLib/CpuLib.inf
new file mode 100644 (file)
index 0000000..13e660d
--- /dev/null
@@ -0,0 +1,68 @@
+#/** @file\r
+# Component description file for Base Library\r
+#\r
+# Base Library implementation.\r
+# Copyright (c) 2007, Intel Corporation.\r
+#\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
+#  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
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = CpuLib\r
+  FILE_GUID                      = 4FBD2538-249C-4b50-8F4A-A9E66609CBF6\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = CpuLib \r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+\r
+\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources.common]\r
+\r
+[Sources.Ia32]\r
+  Ia32/CpuSleep.c | MSFT \r
+  Ia32/CpuFlushTlb.c | MSFT \r
+\r
+  Ia32/CpuSleep.asm | INTEL \r
+  Ia32/CpuFlushTlb.asm | INTEL \r
+\r
+  Ia32/CpuSleep.S | GCC \r
+  Ia32/CpuFlushTlb.S | GCC \r
+\r
+[Sources.X64]\r
+  X64/CpuFlushTlb.asm\r
+  X64/CpuSleep.asm\r
+\r
+  X64/CpuSleep.S | GCC \r
+  X64/CpuFlushTlb.S | GCC \r
+\r
+[Sources.IPF]\r
+  Ipf/CpuFlushTlb.s\r
+  Ipf/CpuSleep.c\r
+\r
+[Sources.EBC]\r
+  Ebc/CpuSleepFlushTlb.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+\r
+\r
+[LibraryClasses.Ipf]\r
+PalCallLib\r
+\r
+\r
+[Pcd.common]\r
+\r
diff --git a/MdePkg/Library/CpuLib/Ebc/CpuSleepFlushTlb.c b/MdePkg/Library/CpuLib/Ebc/CpuSleepFlushTlb.c
new file mode 100644 (file)
index 0000000..f249d1a
--- /dev/null
@@ -0,0 +1,45 @@
+/** @file\r
+  Base Library CPU Functions for EBC\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\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
+  Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.\r
+\r
+  Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuFlushTlb (\r
+  VOID\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+  Places the CPU in a sleep state until an interrupt is received.\r
+\r
+  Places the CPU in a sleep state until an interrupt is received. If interrupts\r
+  are disabled prior to calling this function, then the CPU will be placed in a\r
+  sleep state indefinitely.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuSleep (\r
+  VOID\r
+  )\r
+{\r
+}\r
diff --git a/MdePkg/Library/CpuLib/Ia32/CpuFlushTlb.S b/MdePkg/Library/CpuLib/Ia32/CpuFlushTlb.S
new file mode 100644 (file)
index 0000000..f8b1cdc
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------ ;\r
+# Copyright (c) 2006, 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
+# Module Name:\r
+#\r
+#   CpuFlushTlb.Asm\r
+#\r
+# Abstract:\r
+#\r
+#   CpuFlushTlb function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl ASM_PFX(CpuFlushTlb)\r
+\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# CpuFlushTlb (\r
+#   VOID\r
+#   );\r
+#------------------------------------------------------------------------------\r
+ASM_PFX(CpuFlushTlb):\r
+    movl    %cr3, %eax\r
+    movl    %eax, %cr3\r
+    ret\r
diff --git a/MdePkg/Library/CpuLib/Ia32/CpuFlushTlb.asm b/MdePkg/Library/CpuLib/Ia32/CpuFlushTlb.asm
new file mode 100644 (file)
index 0000000..4f0c4f9
--- /dev/null
@@ -0,0 +1,40 @@
+;------------------------------------------------------------------------------ ;\r
+; Copyright (c) 2006, 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
+; Module Name:\r
+;\r
+;   CpuFlushTlb.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   CpuFlushTlb function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .386p\r
+    .model  flat,C\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; CpuFlushTlb (\r
+;   VOID\r
+;   );\r
+;------------------------------------------------------------------------------\r
+CpuFlushTlb PROC\r
+    mov     eax, cr3\r
+    mov     cr3, eax                    ; moving to CR3 flushes TLB\r
+    ret\r
+CpuFlushTlb ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/CpuLib/Ia32/CpuFlushTlb.c b/MdePkg/Library/CpuLib/Ia32/CpuFlushTlb.c
new file mode 100644 (file)
index 0000000..e785095
--- /dev/null
@@ -0,0 +1,31 @@
+/** @file\r
+  CpuFlushTlb function.\r
+\r
+  Copyright (c) 2006 - 2007, Intel Corporation<BR>\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
+// Include common header file for this module.\r
+//\r
+\r
+\r
+VOID\r
+EFIAPI\r
+CpuFlushTlb (\r
+  VOID\r
+  )\r
+{\r
+  _asm {\r
+    mov     eax, cr3\r
+    mov     cr3, eax\r
+  }\r
+}\r
+\r
diff --git a/MdePkg/Library/CpuLib/Ia32/CpuPause.S b/MdePkg/Library/CpuLib/Ia32/CpuPause.S
new file mode 100644 (file)
index 0000000..5fef9c8
--- /dev/null
@@ -0,0 +1,34 @@
+#------------------------------------------------------------------------------ ;\r
+# Copyright (c) 2006, 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
+# Module Name:\r
+#\r
+#   CpuPause.Asm\r
+#\r
+# Abstract:\r
+#\r
+#   CpuPause function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl ASM_PFX(CpuPause)\r
+\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# CpuPause (\r
+#   VOID\r
+#   );\r
+#------------------------------------------------------------------------------\r
+ASM_PFX(CpuPause):\r
+    pause\r
+    ret\r
diff --git a/MdePkg/Library/CpuLib/Ia32/CpuPause.asm b/MdePkg/Library/CpuLib/Ia32/CpuPause.asm
new file mode 100644 (file)
index 0000000..4c7135f
--- /dev/null
@@ -0,0 +1,40 @@
+;------------------------------------------------------------------------------ ;\r
+; Copyright (c) 2006, 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
+; Module Name:\r
+;\r
+;   CpuPause.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   CpuPause function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .686\r
+    .model  flat,C\r
+    .xmm\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; CpuPause (\r
+;   VOID\r
+;   );\r
+;------------------------------------------------------------------------------\r
+CpuPause    PROC\r
+    pause\r
+    ret\r
+CpuPause    ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/CpuLib/Ia32/CpuPause.c b/MdePkg/Library/CpuLib/Ia32/CpuPause.c
new file mode 100644 (file)
index 0000000..ee7c967
--- /dev/null
@@ -0,0 +1,30 @@
+/** @file\r
+  CpuPause function.\r
+\r
+  Copyright (c) 2006 - 2007, Intel Corporation<BR>\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
+// Include common header file for this module.\r
+//\r
+\r
+\r
+VOID\r
+EFIAPI\r
+CpuPause (\r
+  VOID\r
+  )\r
+{\r
+  _asm {\r
+    pause\r
+  }\r
+}\r
+\r
diff --git a/MdePkg/Library/CpuLib/Ia32/CpuSleep.S b/MdePkg/Library/CpuLib/Ia32/CpuSleep.S
new file mode 100644 (file)
index 0000000..ac39e8f
--- /dev/null
@@ -0,0 +1,34 @@
+#------------------------------------------------------------------------------ ;\r
+# Copyright (c) 2006, 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
+# Module Name:\r
+#\r
+#   CpuSleep.Asm\r
+#\r
+# Abstract:\r
+#\r
+#   CpuSleep function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.globl ASM_PFX(CpuSleep)\r
+\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# CpuSleep (\r
+#   VOID\r
+#   );\r
+#------------------------------------------------------------------------------\r
+ASM_PFX(CpuSleep):\r
+    hlt\r
+    ret\r
diff --git a/MdePkg/Library/CpuLib/Ia32/CpuSleep.asm b/MdePkg/Library/CpuLib/Ia32/CpuSleep.asm
new file mode 100644 (file)
index 0000000..8a779f7
--- /dev/null
@@ -0,0 +1,39 @@
+;------------------------------------------------------------------------------ ;\r
+; Copyright (c) 2006, 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
+; Module Name:\r
+;\r
+;   CpuSleep.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   CpuSleep function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .386\r
+    .model  flat,C\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; CpuSleep (\r
+;   VOID\r
+;   );\r
+;------------------------------------------------------------------------------\r
+CpuSleep    PROC\r
+    hlt\r
+    ret\r
+CpuSleep    ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/CpuLib/Ia32/CpuSleep.c b/MdePkg/Library/CpuLib/Ia32/CpuSleep.c
new file mode 100644 (file)
index 0000000..690f9b3
--- /dev/null
@@ -0,0 +1,30 @@
+/** @file\r
+  CpuSleep function.\r
+\r
+  Copyright (c) 2006 - 2007, Intel Corporation<BR>\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
+// Include common header file for this module.\r
+//\r
+\r
+\r
+VOID\r
+EFIAPI\r
+CpuSleep (\r
+  VOID\r
+  )\r
+{\r
+  _asm {\r
+    hlt\r
+  }\r
+}\r
+\r
diff --git a/MdePkg/Library/CpuLib/Ipf/CpuFlushTlb.s b/MdePkg/Library/CpuLib/Ipf/CpuFlushTlb.s
new file mode 100644 (file)
index 0000000..5546990
--- /dev/null
@@ -0,0 +1,58 @@
+/// @file\r
+///   CpuFlushTlb() function for Itanium-based architecture.\r
+///\r
+/// Copyright (c) 2006, 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
+/// Module Name:  CpuFlushTlb.s\r
+///\r
+///\r
+\r
+.auto\r
+.text\r
+\r
+.globl PalCall\r
+.type   PalCall, @function\r
+\r
+.proc   CpuFlushTlb\r
+.type   CpuFlushTlb, @function\r
+CpuFlushTlb::\r
+        alloc               loc0 = ar.pfs, 0, 3, 5, 0\r
+        mov                 out0 = 0\r
+        mov                 out1 = 6\r
+        mov                 out2 = 0\r
+        mov                 out3 = 0\r
+        mov                 loc1 = b0\r
+        mov                 out4 = 0\r
+        brl.call.sptk       b0  = PalCall\r
+        mov                 loc2 = psr              // save PSR\r
+        mov                 ar.pfs = loc0\r
+        extr.u              r14 = r10, 32, 32       // r14 <- count1\r
+        rsm                 1 << 14                 // Disable interrupts\r
+        extr.u              r15 = r11, 32, 32       // r15 <- stride1\r
+        extr.u              r10 = r10, 0, 32        // r10 <- count2\r
+        add                 r10 = -1, r10\r
+        extr.u              r11 = r11, 0, 32        // r11 <- stride2\r
+        br.cond.sptk        LoopPredicate\r
+LoopOuter:\r
+        mov                 ar.lc = r10             // LC <- count2\r
+        mov                 ar.ec = r0              // EC <- 0\r
+Loop:\r
+        ptc.e               r9\r
+        add                 r9 = r11, r9            // r9 += stride2\r
+        br.ctop.sptk        Loop\r
+        add                 r9 = r15, r9            // r9 += stride1\r
+LoopPredicate:\r
+        cmp.ne              p6 = r0, r14            // count1 == 0?\r
+        add                 r14 = -1, r14\r
+(p6)    br.cond.sptk        LoopOuter\r
+        mov                 psr.l = loc2\r
+        mov                 b0  = loc1\r
+        br.ret.sptk.many    b0\r
+.endp\r
diff --git a/MdePkg/Library/CpuLib/Ipf/CpuPause.s b/MdePkg/Library/CpuLib/Ipf/CpuPause.s
new file mode 100644 (file)
index 0000000..f52692f
--- /dev/null
@@ -0,0 +1,25 @@
+/// @file\r
+///   CpuPause() function for Itanium-based architecture.\r
+///\r
+/// Copyright (c) 2006, 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
+/// Module Name:  CpuPause.s\r
+///\r
+///\r
+\r
+.auto\r
+.text\r
+\r
+.proc   CpuPause\r
+.type   CpuPause, @function\r
+CpuPause::\r
+        hint                @pause\r
+        br.ret.sptk.many    b0\r
+.endp\r
diff --git a/MdePkg/Library/CpuLib/Ipf/CpuSleep.c b/MdePkg/Library/CpuLib/Ipf/CpuSleep.c
new file mode 100644 (file)
index 0000000..5ad64a5
--- /dev/null
@@ -0,0 +1,32 @@
+/** @file\r
+  Base Library CPU functions for Itanium\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\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
+#include <Library/PalCallLib.h>\r
+\r
+/**\r
+  Places the CPU in a sleep state until an interrupt is received.\r
+\r
+  Places the CPU in a sleep state until an interrupt is received. If interrupts\r
+  are disabled prior to calling this function, then the CPU will be placed in a\r
+  sleep state indefinitely.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuSleep (\r
+  VOID\r
+  )\r
+{\r
+  PalCall (29, 0, 0, 0);\r
+}\r
diff --git a/MdePkg/Library/CpuLib/X64/CpuFlushTlb.S b/MdePkg/Library/CpuLib/X64/CpuFlushTlb.S
new file mode 100644 (file)
index 0000000..2dbaf84
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------ \r
+# Copyright (c) 2006, 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
+# Module Name:\r
+#\r
+#   CpuFlushTlb.Asm\r
+#\r
+# Abstract:\r
+#\r
+#   CpuFlushTlb function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.global _CpuFlushTlb\r
+\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# CpuFlushTlb (\r
+#   VOID\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_CpuFlushTlb:\r
+    mov     %cr3, %rax\r
+    mov     %rax, %cr3\r
+    ret\r
diff --git a/MdePkg/Library/CpuLib/X64/CpuFlushTlb.asm b/MdePkg/Library/CpuLib/X64/CpuFlushTlb.asm
new file mode 100644 (file)
index 0000000..c2c4490
--- /dev/null
@@ -0,0 +1,38 @@
+;------------------------------------------------------------------------------ ;\r
+; Copyright (c) 2006, 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
+; Module Name:\r
+;\r
+;   CpuFlushTlb.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   CpuFlushTlb function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; CpuFlushTlb (\r
+;   VOID\r
+;   );\r
+;------------------------------------------------------------------------------\r
+CpuFlushTlb PROC\r
+    mov     rax, cr3\r
+    mov     cr3, rax\r
+    ret\r
+CpuFlushTlb ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/CpuLib/X64/CpuPause.S b/MdePkg/Library/CpuLib/X64/CpuPause.S
new file mode 100644 (file)
index 0000000..0ecaa85
--- /dev/null
@@ -0,0 +1,34 @@
+#------------------------------------------------------------------------------ ;\r
+# Copyright (c) 2006, 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
+# Module Name:\r
+#\r
+#   CpuPause.S\r
+#\r
+# Abstract:\r
+#\r
+#   CpuPause function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# CpuPause (\r
+#   VOID\r
+#   );\r
+#------------------------------------------------------------------------------\r
+.global _CpuPause;\r
+_CpuPause:\r
+    pause\r
+    ret\r
diff --git a/MdePkg/Library/CpuLib/X64/CpuPause.asm b/MdePkg/Library/CpuLib/X64/CpuPause.asm
new file mode 100644 (file)
index 0000000..d16da37
--- /dev/null
@@ -0,0 +1,37 @@
+;------------------------------------------------------------------------------ ;\r
+; Copyright (c) 2006, 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
+; Module Name:\r
+;\r
+;   CpuPause.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   CpuPause function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; CpuPause (\r
+;   VOID\r
+;   );\r
+;------------------------------------------------------------------------------\r
+CpuPause    PROC\r
+    pause\r
+    ret\r
+CpuPause    ENDP\r
+\r
+    END\r
diff --git a/MdePkg/Library/CpuLib/X64/CpuSleep.S b/MdePkg/Library/CpuLib/X64/CpuSleep.S
new file mode 100644 (file)
index 0000000..681e4c1
--- /dev/null
@@ -0,0 +1,34 @@
+#------------------------------------------------------------------------------ ;\r
+# Copyright (c) 2006, 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
+# Module Name:\r
+#\r
+#   CpuSleep.S\r
+#\r
+# Abstract:\r
+#\r
+#   CpuSleep function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# CpuSleep (\r
+#   VOID\r
+#   );\r
+#------------------------------------------------------------------------------\r
+.global _CpuSleep;\r
+_CpuSleep:\r
+    hlt\r
+    ret\r
diff --git a/MdePkg/Library/CpuLib/X64/CpuSleep.asm b/MdePkg/Library/CpuLib/X64/CpuSleep.asm
new file mode 100644 (file)
index 0000000..b2c4907
--- /dev/null
@@ -0,0 +1,37 @@
+;------------------------------------------------------------------------------ ;\r
+; Copyright (c) 2006, 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
+; Module Name:\r
+;\r
+;   CpuSleep.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   CpuSleep function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; CpuSleep (\r
+;   VOID\r
+;   );\r
+;------------------------------------------------------------------------------\r
+CpuSleep    PROC\r
+    hlt\r
+    ret\r
+CpuSleep    ENDP\r
+\r
+    END\r