First public contribution.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\nkernsa\arm\armutils.cia
19 #include <nktest/nkutils.h>
28 void thread_request_signal(NThread* aThread);
34 __NAKED__ void __cpu_idle()
40 __NAKED__ void __cpu_yield()
46 __NAKED__ TLinAddr __stack_pointer()
52 __NAKED__ TUint32 __cpu_status_reg()
58 __NAKED__ TUint32 __cpu_id()
60 asm("mrc p15, 0, r0, c0, c0, 5 ");
64 __NAKED__ TUint32 __trace_cpu_num()
66 asm("mrc p15, 0, r0, c0, c0, 5 ");
67 asm("and r0, r0, #15 ");
71 __NAKED__ TUint32 __get_rwno_tid()
77 __NAKED__ TUint32 __get_static_data()
83 asm(".word %a0" : : "i" ((TInt)&TheScheduler));
87 __NAKED__ TUint32 __get_local_timer_address()
93 asm("ldr r0, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,i_LocalTimerAddr));
100 __NAKED__ TUint32 __get_local_timer_count()
106 asm("ldr r1, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,i_LocalTimerAddr));
110 asm("ldr r0, [r1, #%a0]" : : "i" _FOFF(ArmLocalTimer,iTimerCount));
115 __NAKED__ TUint32 __set_local_timer_count()
121 asm("ldr r1, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,i_LocalTimerAddr));
125 asm("ldr r0, [r1, #%a0]" : : "i" _FOFF(ArmLocalTimer,iTimerCount));
126 asm("str r0, [r1, #%a0]" : : "i" _FOFF(ArmLocalTimer,iTimerCount));
130 __NAKED__ TUint32 __swp_local_timer_count()
136 asm("ldr r1, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,i_LocalTimerAddr));
140 asm("ldr r0, [r1, #%a0]!" : : "i" _FOFF(ArmLocalTimer,iTimerCount));
141 asm("swp r0, r0, [r1] ");
146 TUint32 __NAKED__ norm_fast_counter()
148 asm("str lr, [sp, #-4]! ");
149 asm("bl " CSM_CFUNC(fast_counter));
150 asm("ldr r2, __nfcfs ");
151 asm("ldr r2, [r2] ");
152 asm("rsb r3, r2, #32 ");
153 asm("mov r0, r0, lsr r2 ");
154 asm("orr r0, r0, r1, lsl r3 ");
161 __NAKED__ TUint32 set_bit0_if_nonnull(TUint32&)
163 __DATA_MEMORY_BARRIER_Z__(r12);
169 asm("orr r1, r1, #1 ");
174 __DATA_MEMORY_BARRIER_Z__(r12);
178 __NAKED__ void flip_bit0(TUint32&)
180 __DATA_MEMORY_BARRIER_Z__(r12);
183 asm("eor r1, r1, #1 ");
187 __DATA_MEMORY_BARRIER__(r12);
191 __NAKED__ TUint32 swap_out_if_bit0_clear(TUint32&)
193 __DATA_MEMORY_BARRIER_Z__(r12);
203 __DATA_MEMORY_BARRIER_Z__(r12);
207 __NAKED__ TUint32 __cpsr()
209 asm("mrs r0, cpsr ");
214 __NAKED__ void RequestComplete(NThread* /*aThread*/, NRequestStatus*& /*aStatus*/, TInt /*aValue*/)
216 __DATA_MEMORY_BARRIER_Z__(r12);
217 asm("str lr, [sp, #-4]! ");
224 asm("ldr lr, [sp], #4 ");
225 asm("strne r2, [r3] ");
226 asm("bne " CSM_CFUNC(thread_request_signal));