source: rtems/cpukit/score/src/percpu.c @ 42bb344e

4.115
Last change on this file since 42bb344e was 42bb344e, checked in by Jennifer Averett <Jennifer.Averett@…>, on 05/11/11 at 14:22:35

2011-05-11 Jennifer Averett <Jennifer.Averett@…>

  • score/Makefile.am, score/preinstall.am, score/include/rtems/score/percpu.h, score/src/percpu.c, score/src/threadcreateidle.c: Modifications to restrict compilation of SMP only code to when SMP is enabled. Entire SMP specific files are disabled via Makefile.am.
  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[11e8bc5]1/*
[06dcaf0]2 *  COPYRIGHT (c) 1989-2011.
[11e8bc5]3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems/system.h>
17#include <rtems/score/thread.h>
18#include <rtems/score/percpu.h>
19#include <rtems/score/wkspace.h>
20#include <rtems/config.h>
21#include <string.h>
22
[06dcaf0]23#if defined(RTEMS_SMP)
[42bb344e]24
25  #include <rtems/score/smp.h>
26
[06dcaf0]27  void _SMP_Handler_initialize(void)
28  {
29    int         cpu;
30    size_t      size;
31    uintptr_t   ptr;
32
33    /*
34     *  Initialize per CPU structures.
35     */
36    size = (_SMP_Processor_count) * sizeof(Per_CPU_Control);
37    memset( _Per_CPU_Information, '\0', size );
38
39    /*
40     *  Initialize per cpu pointer table
41     */
42    size = Configuration.interrupt_stack_size;
43    _Per_CPU_Information_p[0] = &_Per_CPU_Information[0];
[e79093a]44    for (cpu=1 ; cpu < rtems_configuration_smp_maximum_processors; cpu++ ) {
[c26dd0d]45
[06dcaf0]46      Per_CPU_Control *p = &_Per_CPU_Information[cpu];
47
48      _Per_CPU_Information_p[cpu] = p;
49
50      p->interrupt_stack_low = _Workspace_Allocate_or_fatal_error( size );
51
52      ptr = (uintptr_t) _Addresses_Add_offset( p->interrupt_stack_low, size );
53      ptr &= ~CPU_STACK_ALIGNMENT;
54      p->interrupt_stack_high = (void *)ptr;
55      p->state = RTEMS_BSP_SMP_CPU_INITIAL_STATE;
56      RTEMS_COMPILER_MEMORY_BARRIER();
57    }
58  }
59#else
60  /*
61   * On single core systems, we can efficiently directly access a single
62   * statically allocated per cpu structure.  And the fields are initialized
63   * as individual elements just like it has always been done.
64   */
65  Per_CPU_Control _Per_CPU_Information[1];
66#endif
Note: See TracBrowser for help on using the repository browser.