source: rtems/cpukit/score/cpu/arm/armv7m-context-restore.c @ 0daa8ab

5
Last change on this file since 0daa8ab was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief CPU Restore Context
5 */
6
7/*
8 * Copyright (c) 2011 Sebastian Huber.  All rights reserved.
9 *
10 *  embedded brains GmbH
11 *  Obere Lagerstr. 30
12 *  82178 Puchheim
13 *  Germany
14 *  <rtems@embedded-brains.de>
15 *
16 * The license and distribution terms for this file may be
17 * found in the file LICENSE in this distribution or at
18 * http://www.rtems.org/license/LICENSE.
19 */
20
21#ifdef HAVE_CONFIG_H
22  #include "config.h"
23#endif
24
25#include <rtems/score/armv7m.h>
26#include <rtems/score/percpu.h>
27
28#ifdef ARM_MULTILIB_ARCH_V7M
29
30void __attribute__((naked)) _CPU_Context_restore(
31  Context_Control *heir
32)
33{
34  __asm__ volatile (
35    "movw r2, #:lower16:_Per_CPU_Information\n"
36    "movt r2, #:upper16:_Per_CPU_Information\n"
37    "ldr r3, [r0, %[isrctxoff]]\n"
38    "ldr sp, [r0, %[spctxoff]]\n"
39    "ldm r0, {r4-r11, lr}\n"
40    "str r3, [r2, %[isrpcpuoff]]\n"
41    "bx lr\n"
42    :
43    : [spctxoff] "J" (offsetof(Context_Control, register_sp)),
44      [isrctxoff] "J" (offsetof(Context_Control, isr_nest_level)),
45      [isrpcpuoff] "J" (offsetof(Per_CPU_Control, isr_nest_level))
46  );
47  __builtin_unreachable();
48}
49
50#endif /* ARM_MULTILIB_ARCH_V7M */
Note: See TracBrowser for help on using the repository browser.