source: rtems/cpukit/score/cpu/or1k/or1k-context-initialize.c @ 9165349d

Last change on this file since 9165349d was 80cf60e, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 15, 2020 at 7:48:32 AM

Canonicalize config.h include

Use the following variant which was already used by most source files:

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/*
2 * COPYRIGHT (c) 2014 Hesham ALMatary <heshamelmatary@gmail.com>
3 *
4 * COPYRIGHT (c) 1989-2006
5 * On-Line Applications Research Corporation (OAR).
6 *
7 * The license and distribution terms for this file may be
8 * found in the file LICENSE in this distribution or at
9 * http://www.rtems.org/license/LICENSE.
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <string.h>
17
18#include <rtems/score/cpu.h>
19#include <rtems/score/interr.h>
20#include <rtems/score/or1k-utility.h>
21
22void _CPU_Context_Initialize(
23  Context_Control *context,
24  void *stack_area_begin,
25  size_t stack_area_size,
26  uint32_t new_level,
27  void (*entry_point)( void ),
28  bool is_fp,
29  void *tls_area
30)
31{
32  /* Decrement 200 byte to account for red-zone */
33  uint32_t stack = ((uint32_t) stack_area_begin) - 200;
34  uint32_t sr;
35  uint32_t stack_high = stack + stack_area_size;
36
37  sr = _OR1K_mfspr(CPU_OR1K_SPR_SR);
38
39  memset(context, 0, sizeof(*context));
40
41  context->r1 = stack_high;
42  context->r2 = stack_high;
43  context->r9 = (uint32_t) entry_point;
44  context->sr = sr;
45}
Note: See TracBrowser for help on using the repository browser.