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

4.104.115
Last change on this file since 78623bce was 78623bce, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on 04/08/10 at 10:13:46

add/adapt documentation

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreCPU
5 *
6 * @brief ARM architecture support implementation.
7 */
8
9/*
10 *  $Id$
11 *
12 *  This file contains all assembly code for the ARM implementation
13 *  of RTEMS.
14 *
15 *  Copyright (c) 2007 by Ray Xu, <Rayx.cn@gmail.com>
16 *          Thumb support added.
17 *
18 *  Copyright (c) 2002 by Advent Networks, Inc.
19 *          Jay Monkman <jmonkman@adventnetworks.com>
20 *
21 *  COPYRIGHT (c) 2000 Canon Research Centre France SA.
22 *  Emmanuel Raguet, mailto:raguet@crf.canon.fr
23 *
24 *  The license and distribution terms for this file may be
25 *  found in the file LICENSE in this distribution or at
26 *  http://www.rtems.com/license/LICENSE.
27 *
28 */
29
30#ifdef HAVE_CONFIG_H
31#include "config.h"
32#endif
33
34#include <rtems/asm.h>
35#include <rtems/score/cpu_asm.h>
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
61/* Start restoring context */
62_restore:
63        ldmia   r1,  {r2, r4, r5, r6, r7, r8, r9, r10, r11, r13, r14}
64        msr     cpsr, r2
65#ifdef __thumb__
66        bx      lr
67        nop
68#else
69        mov     pc, lr
70#endif
71/*
72 *  void _CPU_Context_restore( new_context )
73 *
74 *  This function copies the restores the registers from where r0 points.
75 *  It must match _CPU_Context_switch()
76 *
77 */
78DEFINE_FUNCTION_ARM(_CPU_Context_restore)
79        mov     r1, r0
80        b       _restore
Note: See TracBrowser for help on using the repository browser.