1 #------------------------------------------------------------------------------
3 # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
5 # This program and the accompanying materials
6 # are licensed and made available under the terms and conditions of the BSD License
7 # which accompanies this distribution. The full text of the license may be found at
8 # http://opensource.org/licenses/bsd-license.php
10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 #------------------------------------------------------------------------------
15 #include <AsmMacroIoLib.h>
19 GCC_ASM_EXPORT(Cp15IdCode)
20 GCC_ASM_EXPORT(Cp15CacheInfo)
21 GCC_ASM_EXPORT(ArmEnableInterrupts)
22 GCC_ASM_EXPORT(ArmDisableInterrupts)
23 GCC_ASM_EXPORT(ArmGetInterruptState)
24 GCC_ASM_EXPORT(ArmEnableFiq)
25 GCC_ASM_EXPORT(ArmDisableFiq)
26 GCC_ASM_EXPORT(ArmGetFiqState)
27 GCC_ASM_EXPORT(ArmInvalidateTlb)
28 GCC_ASM_EXPORT(ArmSetTTBR0)
29 GCC_ASM_EXPORT(ArmGetTTBR0BaseAddress)
30 GCC_ASM_EXPORT(ArmSetDomainAccessControl)
31 GCC_ASM_EXPORT(CPSRMaskInsert)
32 GCC_ASM_EXPORT(CPSRRead)
34 #------------------------------------------------------------------------------
40 ASM_PFX(Cp15CacheInfo):
44 ASM_PFX(ArmEnableInterrupts):
46 bic R0,R0,#0x80 @Enable IRQ interrupts
50 ASM_PFX(ArmDisableInterrupts):
52 orr R1,R0,#0x80 @Disable IRQ interrupts
59 ASM_PFX(ArmGetInterruptState):
61 tst R0,#0x80 @Check if IRQ is enabled.
66 ASM_PFX(ArmEnableFiq):
68 bic R0,R0,#0x40 @Enable FIQ interrupts
72 ASM_PFX(ArmDisableFiq):
74 orr R1,R0,#0x40 @Disable FIQ interrupts
81 ASM_PFX(ArmGetFiqState):
83 tst R0,#0x80 @Check if FIQ is enabled.
88 ASM_PFX(ArmInvalidateTlb):
97 ASM_PFX(ArmGetTTBR0BaseAddress):
99 LoadConstantToReg(0xFFFFC000, r1) @ and r0, r0, #0xFFFFC000
104 ASM_PFX(ArmSetDomainAccessControl):
108 ASM_PFX(CPSRMaskInsert): @ on entry, r0 is the mask and r1 is the field to insert
109 stmfd sp!, {r4-r12, lr} @ save all the banked registers
110 mov r3, sp @ copy the stack pointer into a non-banked register
111 mrs r2, cpsr @ read the cpsr
112 bic r2, r2, r0 @ clear mask in the cpsr
113 and r1, r1, r0 @ clear bits outside the mask in the input
114 orr r2, r2, r1 @ set field
115 msr cpsr_cxsf, r2 @ write back cpsr (may have caused a mode switch)
116 mov sp, r3 @ restore stack pointer
117 ldmfd sp!, {r4-r12, lr} @ restore registers
118 bx lr @ return (hopefully thumb-safe!)
124 ASM_FUNCTION_REMOVE_IF_UNREFERENCED