source: rtems/bsps/m68k/shared/start/start.S @ 511dc4b

5
Last change on this file since 511dc4b was 511dc4b, checked in by Sebastian Huber <sebastian.huber@…>, on 06/19/18 at 07:09:51

Rework initialization and interrupt stack support

Statically initialize the interrupt stack area
(_Configuration_Interrupt_stack_area_begin,
_Configuration_Interrupt_stack_area_end, and
_Configuration_Interrupt_stack_size) via <rtems/confdefs.h>. Place the
interrupt stack area in a special section ".rtemsstack.interrupt". Let
BSPs define the optimal placement of this section in their linker
command files (e.g. in a fast on-chip memory).

This change makes makes the CPU_HAS_SOFTWARE_INTERRUPT_STACK and
CPU_HAS_HARDWARE_INTERRUPT_STACK CPU port defines superfluous, since the
low level initialization code has all information available via global
symbols.

This change makes the CPU_ALLOCATE_INTERRUPT_STACK CPU port define
superfluous, since the interrupt stacks are allocated by confdefs.h for
all architectures. There is no need for BSP-specific linker command
file magic (except the section placement), see previous ARM linker
command file as a bad example.

Remove _CPU_Install_interrupt_stack(). Initialize the hardware
interrupt stack in _CPU_Initialize() if necessary (e.g.
m68k_install_interrupt_stack()).

The optional _CPU_Interrupt_stack_setup() is still useful to customize
the registration of the interrupt stack area in the per-CPU information.

The initialization stack can reuse the interrupt stack, since

  • interrupts are disabled during the sequential system initialization, and
  • the boot_card() function does not return.

This stack resuse saves memory.

Changes per architecture:

arm:

  • Mostly replace the linker symbol based configuration of stacks with the standard <rtems/confdefs.h> configuration via CONFIGURE_INTERRUPT_STACK_SIZE. The size of the FIQ, ABT and UND mode stack is still defined via linker symbols. These modes are rarely used in applications and the default values provided by the BSP should be sufficient in most cases.
  • Remove the bsp_processor_count linker symbol hack used for the SMP support. This is possible since the interrupt stack area is now allocated by the linker and not allocated from the heap. This makes some configure.ac stuff obsolete. Remove the now superfluous BSP variants altcycv_devkit_smp and realview_pbx_a9_qemu_smp.

bfin:

  • Remove unused magic linker command file allocation of initialization stack. Maybe a previous linker command file copy and paste problem? In the start.S the initialization stack is set to a hard coded value.

lm32, m32c, mips, nios2, riscv, sh, v850:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.

m68k:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.

powerpc:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.
  • Used dedicated memory region (REGION_RTEMSSTACK) for the interrupt stack on BSPs using the shared linkcmds.base (replacement for REGION_RWEXTRA).

sparc:

  • Remove the hard coded initialization stack. Use the interrupt stack for the initialization stack on the boot processor. This saves 16KiB of RAM.

Update #3459.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*  entry.s
2 *
3 *  This file contains the entry point for the application.
4 *  The name of this entry point is compiler dependent.
5 *  It jumps to the BSP which is responsible for performing
6 *  all initialization.
7 *
8 *  COPYRIGHT (c) 1989-1999.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.org/license/LICENSE.
14 */
15
16#include <rtems/asm.h>
17
18#if (M68K_COLDFIRE_ARCH == 0) /* All ColdFire BSPs must provide their own start vector */
19
20BEGIN_CODE
21                                        | Default entry points for:
22         PUBLIC (start)                 |   GNU
23         PUBLIC (M68Kvec)               |   Vector Table
24
25SYM (start):
26SYM (M68Kvec):                          | standard location for vectors
27        nop                             | for linkers with problem
28                                        | location zero
29        jmp      SYM (start_around)
30
31     /*
32      *  We can use the following space as our vector table
33      *  if the CPU has a VBR or we can save vector table in it
34      *  if the CPU does not.
35      */
36
37        .space   4088                   | to avoid initial intr stack
38                                        |   from 135BUG on MVME13?
39                                        |   and start code at 0x4000
40SYM (vectors):
41        .space   1016                   | reserve space for rest of vectors
42
43#if ( M68K_HAS_SEPARATE_STACKS == 1 )
44SYM (lowintstack):
45        .space   4092                   | reserve for interrupt stack
46SYM (hiintstack):
47        .space   4                      | end of interrupt stack
48#endif
49
50        PUBLIC (start_around)
51SYM (start_around):
52        move.w  sr, SYM (initial_sr)
53        oriw    #0x3700,sr              | SUPV MODE,INTERRUPTS OFF!!!
54#if ( M68K_HAS_SEPARATE_STACKS == 1 )
55        movec   isp,a0
56        move.l  a0, SYM (initial_isp)
57        movec   usp,a0
58        move.l  a0, SYM (initial_usp)
59        movec   msp,a0
60        move.l  a0, SYM (initial_msp)
61#else
62        move.l  a7, SYM (initial_msp)
63#endif
64
65        |
66        | zero out uninitialized data area
67        |
68zerobss:
69        moveal  # SYM (bsp_section_bss_end),a0     | find end of .bss
70        moveal  # SYM (bsp_section_bss_begin),a1   | find beginning of .bss
71        movel   #0,d0
72
73loop:   movel   #0,a1@+                 | to zero out uninitialized
74        cmpal   a0,a1
75        jlt     loop                    | loop until _end reached
76
77        movel   # SYM (_Configuration_Interrupt_stack_area_end),d0 | d0 = stop of stack
78        movw    #0x3700,sr              | SUPV MODE,INTERRUPTS OFF!!!
79        movel   d0,a7                   | set master stack pointer
80        movel   d0,a6                   | set base pointer
81
82      /*
83       *  RTEMS should maintain a separate interrupt stack on CPUs
84       *  without one in hardware.  This is currently not supported
85       *  on versions of the m68k without a HW intr stack.
86       */
87
88#if ( M68K_HAS_SEPARATE_STACKS == 1 )
89        lea     SYM (hiintstack),a0   | a0 = high end of intr stack
90        movec   a0,isp                | set interrupt stack
91#endif
92
93        movel   #0,a7@-               | push command line
94        jsr     SYM (boot_card)
95        addl    #12,a7
96
97#if ( M68K_HAS_SEPARATE_STACKS == 1 )
98        move.l  SYM (initial_isp),a0
99        movec   a0,isp
100        move.l  SYM (initial_usp),a0
101        movec   a0,usp
102        move.l  SYM (initial_msp),a0
103        movec   a0,msp
104#else
105        movea.l SYM (initial_msp),a7
106#endif
107        move.w  SYM (initial_sr),sr
108        rts
109
110END_CODE
111
112BEGIN_DATA
113
114        PUBLIC (start_frame)
115SYM (start_frame):
116        .space  4,0
117
118END_DATA
119
120BEGIN_BSS
121
122        PUBLIC (initial_isp)
123SYM (initial_isp):
124        .space  4
125
126        PUBLIC (initial_msp)
127SYM (initial_msp):
128        .space  4
129
130        PUBLIC (initial_usp)
131SYM (initial_usp):
132        .space  4
133
134         PUBLIC (initial_sr)
135SYM (initial_sr):
136        .space  2
137
138END_DATA
139#endif
140END
Note: See TracBrowser for help on using the repository browser.