source: rtems/cpukit/score/cpu/arm/cpu_asm.S @ f2f211c5

4.115
Last change on this file since f2f211c5 was f2f211c5, checked in by Sebastian Huber <sebastian.huber@…>, on 05/31/13 at 11:59:34

smp: Add ARM support

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreCPU
5 *
6 * @brief ARM architecture support implementation.
7 */
8
9/*
10 *  This file contains all assembly code for the ARM implementation
11 *  of RTEMS.
12 *
13 *  Copyright (c) 2007 by Ray Xu, <Rayx.cn@gmail.com>
14 *          Thumb support added.
15 *
16 *  Copyright (c) 2002 by Advent Networks, Inc.
17 *          Jay Monkman <jmonkman@adventnetworks.com>
18 *
19 *  COPYRIGHT (c) 2000 Canon Research Centre France SA.
20 *  Emmanuel Raguet, mailto:raguet@crf.canon.fr
21 *
22 *  The license and distribution terms for this file may be
23 *  found in the file LICENSE in this distribution or at
24 *  http://www.rtems.com/license/LICENSE.
25 *
26 */
27
28#ifdef HAVE_CONFIG_H
29#include "config.h"
30#endif
31
32#include <rtems/asm.h>
33#include <rtems/score/cpu.h>
34
35#ifdef ARM_MULTILIB_ARCH_V4
36
37        .text
38
39/*
40 *  void _CPU_Context_switch( run_context, heir_context )
41 *  void _CPU_Context_restore( run_context, heir_context )
42 *
43 *  This routine performs a normal non-FP context.
44 *
45 *  R0 = run_context    R1 = heir_context
46 *
47 *  This function copies the current registers to where r0 points, then
48 *  restores the ones from where r1 points.
49 *
50 *  Using the ldm/stm opcodes save 2-3 us on 100 MHz ARM9TDMI with
51 *  a 16 bit data bus.
52 *
53 */
54
55DEFINE_FUNCTION_ARM(_CPU_Context_switch)
56/* Start saving context */
57        mrs     r2, CPSR
58        stmia   r0,  {r2, r4, r5, r6, r7, r8, r9, r10, r11, r13, r14}
59
60#ifdef ARM_MULTILIB_VFP_D32
61        add     r3, r0, #ARM_CONTEXT_CONTROL_D8_OFFSET
62        vstm    r3, {d8-d15}
63#endif
64
65/* Start restoring context */
66_restore:
67#ifdef RTEMS_SMP
68        clrex
69#endif
70
71#ifdef ARM_MULTILIB_VFP_D32
72        add     r3, r1, #ARM_CONTEXT_CONTROL_D8_OFFSET
73        vldm    r3, {d8-d15}
74#endif
75
76        ldmia   r1,  {r2, r4, r5, r6, r7, r8, r9, r10, r11, r13, r14}
77        msr     CPSR_fsxc, r2
78#ifdef __thumb__
79        bx      lr
80        nop
81#else
82        mov     pc, lr
83#endif
84/*
85 *  void _CPU_Context_restore( new_context )
86 *
87 *  This function copies the restores the registers from where r0 points.
88 *  It must match _CPU_Context_switch()
89 *
90 */
91DEFINE_FUNCTION_ARM(_CPU_Context_restore)
92        mov     r1, r0
93        b       _restore
94
95#endif /* ARM_MULTILIB_ARCH_V4 */
Note: See TracBrowser for help on using the repository browser.