--- /dev/null
+#------------------------------------------------------------------------------ \r
+#\r
+# CpuFlushTlb() for ARM\r
+#\r
+# Copyright (c) 2006 - 2009, Intel Corporation<BR>\r
+# Portions copyright (c) 2008-2009 Apple Inc.<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
+.text\r
+.p2align 2\r
+.globl ASM_PFX(CpuFlushTlb)\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
+ASM_PFX(CpuFlushTlb):\r
+ mov r0,#0\r
+ mcr p15,0,r0,c8,c5,0 # Invalidate all the unlocked entried in TLB\r
+ bx LR\r
--- /dev/null
+;------------------------------------------------------------------------------ \r
+;\r
+; CpuFlushTlb() for ARM\r
+;\r
+; Copyright (c) 2006 - 2009, Intel Corporation<BR>\r
+; Portions copyright (c) 2008-2009 Apple Inc.<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
+ EXPORT CpuFlushTlb\r
+ AREA cpu_flush_tlb, CODE, READONLY\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
+CpuFlushTlb \r
+ MOV r0,#0\r
+ MCR p15,0,r0,c8,c5,0 ;Invalidate all the unlocked entried in TLB\r
+ BX LR\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------ \r
+#\r
+# CpuSleep() for ARM\r
+#\r
+# Copyright (c) 2006 - 2009, Intel Corporation<BR>\r
+# Portions copyright (c) 2008-2009 Apple Inc.<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
+.text\r
+.p2align 2\r
+.globl ASM_PFX(CpuSleep)\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
+ASM_PFX(CpuSleep):\r
+ mov r0,#0\r
+ mcr p15,0,r0,c7,c0,4 ;Wait for Interrupt instruction\r
+ bx lr\r
--- /dev/null
+;------------------------------------------------------------------------------ \r
+;\r
+; CpuSleep() for ARM\r
+;\r
+; Copyright (c) 2006 - 2009, Intel Corporation<BR>\r
+; Portions copyright (c) 2008-2009 Apple Inc.<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
+ EXPORT CpuSleep\r
+ AREA cpu_sleep, CODE, READONLY\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
+CpuSleep\r
+ MOV r0,#0\r
+ MCR p15,0,r0,c7,c0,4 ;Wait for Interrupt instruction\r
+ BX LR\r
+\r
+ END\r
# CPU Library implemented using ASM functions for IA-32 and X64,\r
# PAL CALLs for IPF, and empty functions for EBC.\r
#\r
-# Copyright (c) 2007 - 2008, Intel Corporation.\r
+# Copyright (c) 2007 - 2008, Intel Corporation.<BR>\r
+# Portions Copyright (c) 2008-2009 Apple Inc.<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
\r
\r
#\r
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM\r
#\r
\r
[Sources.common]\r
\r
-[Sources.Ia32]\r
+[Sources.IA32]\r
Ia32/CpuSleep.c | MSFT \r
Ia32/CpuFlushTlb.c | MSFT \r
\r
[Sources.EBC]\r
Ebc/CpuSleepFlushTlb.c\r
\r
+[Sources.ARM]
+ Arm/CpuFlushTlb.asm | RVCT
+ Arm/CpuSleep.asm | RVCT
+ Arm/CpuFlushTlb.S | GCC
+ Arm/CpuSleep.S | GCC
+
[Packages]\r
MdePkg/MdePkg.dec\r
\r
\r
-[LibraryClasses.Ipf]\r
+[LibraryClasses.IPF]\r
PalLib\r
BaseLib
\ No newline at end of file
--- /dev/null
+/** @file
+ CpuFlushTlb function for Ia32/X64 GCC.
+
+ Copyright (c) 2006 - 2008, Intel Corporation<BR>
+ Portions copyright (c) 2008-2009 Apple Inc.<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+
+
+/**
+ Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
+
+ Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
+
+**/
+VOID
+EFIAPI
+CpuFlushTlb (
+ VOID
+ )
+{
+ __asm__ __volatile__ (
+ "movl %%cr3, %0\n\t"
+ "movl %0, %%cr3 "
+ : "r" // %0
+ );
+}
+
--- /dev/null
+/** @file
+ CpuSleep function for Ia32/X64 GCC.
+
+ Copyright (c) 2006 - 2008, Intel Corporation<BR>
+ Portions copyright (c) 2008-2009 Apple Inc.<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+
+/**
+ Places the CPU in a sleep state until an interrupt is received.
+
+ Places the CPU in a sleep state until an interrupt is received. If interrupts
+ are disabled prior to calling this function, then the CPU will be placed in a
+ sleep state indefinitely.
+
+**/
+VOID
+EFIAPI
+CpuSleep (
+ VOID
+ )
+{
+ __asm__ __volatile__ ("hlt"::: "memory");
+}
+