source: rtems/cpukit/score/cpu/nios2/nios2-context-initialize.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 * Copyright (c) 2011 embedded brains GmbH
3 *
4 * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
5 *
6 * COPYRIGHT (c) 1989-2006
7 * On-Line Applications Research Corporation (OAR).
8 *
9 * The license and distribution terms for this file may be
10 * found in the file LICENSE in this distribution or at
11 * http://www.rtems.com/license/LICENSE.
12 */
13
14#ifdef HAVE_CONFIG_H
15  #include "config.h"
16#endif
17
18#include <string.h>
19
20#include <rtems/score/cpu.h>
21#include <rtems/score/nios2-utility.h>
22#include <rtems/score/interr.h>
23
24void _CPU_Context_Initialize(
25  Context_Control *context,
26  void *stack_area_begin,
27  size_t stack_area_size,
28  uint32_t new_level,
29  void (*entry_point)( void ),
30  bool is_fp
31)
32{
33  const Nios2_MPU_Configuration *mpu_config = _Nios2_MPU_Get_configuration();
34  uint32_t stack = (uint32_t) stack_area_begin + stack_area_size - 4;
35
36  memset(context, 0, sizeof(*context));
37
38  context->fp = stack;
39  context->status = _Nios2_ISR_Set_level( new_level, NIOS2_STATUS_PIE );
40  context->sp = stack;
41  context->ra = (uint32_t) entry_point;
42
43  if ( mpu_config != NULL ) {
44    Nios2_MPU_Region_descriptor desc = {
45      .index = mpu_config->data_index_for_stack_protection,
46      /* FIXME: Brocken stack allocator */
47      .base = (void *) ((int) stack_area_begin & ~((1 << mpu_config->data_region_size_log2) - 1)),
48      .end = (char *) stack_area_begin + stack_area_size,
49      .perm = NIOS2_MPU_DATA_PERM_SVR_READWRITE_USER_NONE,
50      .data = true,
51      .cacheable = mpu_config->enable_data_cache_for_stack,
52      .read = false,
53      .write = true
54    };
55    bool ok = _Nios2_MPU_Setup_region_registers(
56      mpu_config,
57      &desc,
58      &context->stack_mpubase,
59      &context->stack_mpuacc
60    );
61
62    if ( !ok ) {
63      /* The task stack allocator must ensure that the stack area is valid */
64      _Internal_error_Occurred( INTERNAL_ERROR_CORE, false, 0xdeadbeef );
65    }
66  }
67}
Note: See TracBrowser for help on using the repository browser.