source: rtems/cpukit/score/cpu/powerpc/rtems/score/cpu.h @ 8bb9d41

5
Last change on this file since 8bb9d41 was 8bb9d41, checked in by Sebastian Huber <sebastian.huber@…>, on 09/07/16 at 12:08:06

stackchk: Use a const pattern to check

  • Property mode set to 100644
File size: 38.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief PowerPC CPU Department Source
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2012.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  COPYRIGHT (c) 1995 i-cubed ltd.
12 *
13 *  To anyone who acknowledges that this file is provided "AS IS"
14 *  without any express or implied warranty:
15 *      permission to use, copy, modify, and distribute this file
16 *      for any purpose is hereby granted without fee, provided that
17 *      the above copyright notice and this notice appears in all
18 *      copies, and that the name of i-cubed limited not be used in
19 *      advertising or publicity pertaining to distribution of the
20 *      software without specific, written prior permission.
21 *      i-cubed limited makes no representations about the suitability
22 *      of this software for any purpose.
23 *
24 *  Copyright (c) 2001 Andy Dachs <a.dachs@sstl.co.uk>.
25 *
26 *  Copyright (c) 2001 Surrey Satellite Technology Limited (SSTL).
27 *
28 *  Copyright (c) 2010-2013 embedded brains GmbH.
29 *
30 *  The license and distribution terms for this file may be
31 *  found in the file LICENSE in this distribution or at
32 *  http://www.rtems.org/license/LICENSE.
33 */
34
35#ifndef _RTEMS_SCORE_CPU_H
36#define _RTEMS_SCORE_CPU_H
37
38#include <rtems/score/types.h>
39#include <rtems/score/powerpc.h>
40#include <rtems/powerpc/registers.h>
41
42#ifndef ASM
43  #include <string.h> /* for memset() */
44#endif
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50/* conditional compilation parameters */
51
52/*
53 *  Should the calls to _Thread_Enable_dispatch be inlined?
54 *
55 *  If TRUE, then they are inlined.
56 *  If FALSE, then a subroutine call is made.
57 *
58 *  Basically this is an example of the classic trade-off of size
59 *  versus speed.  Inlining the call (TRUE) typically increases the
60 *  size of RTEMS while speeding up the enabling of dispatching.
61 *  [NOTE: In general, the _Thread_Dispatch_disable_level will
62 *  only be 0 or 1 unless you are in an interrupt handler and that
63 *  interrupt handler invokes the executive.]  When not inlined
64 *  something calls _Thread_Enable_dispatch which in turns calls
65 *  _Thread_Dispatch.  If the enable dispatch is inlined, then
66 *  one subroutine call is avoided entirely.]
67 */
68
69#define CPU_INLINE_ENABLE_DISPATCH       FALSE
70
71/*
72 *  Does this port provide a CPU dependent IDLE task implementation?
73 *
74 *  If TRUE, then the routine _CPU_Thread_Idle_body
75 *  must be provided and is the default IDLE thread body instead of
76 *  _CPU_Thread_Idle_body.
77 *
78 *  If FALSE, then use the generic IDLE thread body if the BSP does
79 *  not provide one.
80 *
81 *  This is intended to allow for supporting processors which have
82 *  a low power or idle mode.  When the IDLE thread is executed, then
83 *  the CPU can be powered down.
84 *
85 *  The order of precedence for selecting the IDLE thread body is:
86 *
87 *    1.  BSP provided
88 *    2.  CPU dependent (if provided)
89 *    3.  generic (if no BSP and no CPU dependent)
90 */
91
92#define CPU_PROVIDES_IDLE_THREAD_BODY    FALSE
93
94/*
95 *  Does the stack grow up (toward higher addresses) or down
96 *  (toward lower addresses)?
97 *
98 *  If TRUE, then the grows upward.
99 *  If FALSE, then the grows toward smaller addresses.
100 */
101
102#define CPU_STACK_GROWS_UP               FALSE
103
104#define CPU_CACHE_LINE_BYTES PPC_STRUCTURE_ALIGNMENT
105
106#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
107
108/*
109 *  Define what is required to specify how the network to host conversion
110 *  routines are handled.
111 */
112
113#if defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN)
114#define CPU_BIG_ENDIAN                           TRUE
115#define CPU_LITTLE_ENDIAN                        FALSE
116#else
117#define CPU_BIG_ENDIAN                           FALSE
118#define CPU_LITTLE_ENDIAN                        TRUE
119#endif
120
121/*
122 *  Does the CPU have hardware floating point?
123 *
124 *  If TRUE, then the RTEMS_FLOATING_POINT task attribute is supported.
125 *  If FALSE, then the RTEMS_FLOATING_POINT task attribute is ignored.
126 *
127 *  If there is a FP coprocessor such as the i387 or mc68881, then
128 *  the answer is TRUE.
129 *
130 *  The macro name "PPC_HAS_FPU" should be made CPU specific.
131 *  It indicates whether or not this CPU model has FP support.  For
132 *  example, it would be possible to have an i386_nofp CPU model
133 *  which set this to false to indicate that you have an i386 without
134 *  an i387 and wish to leave floating point support out of RTEMS.
135 */
136
137#if ( PPC_HAS_FPU == 1 )
138#define CPU_HARDWARE_FP     TRUE
139#define CPU_SOFTWARE_FP     FALSE
140#else
141#define CPU_HARDWARE_FP     FALSE
142#define CPU_SOFTWARE_FP     FALSE
143#endif
144
145/*
146 *  Are all tasks RTEMS_FLOATING_POINT tasks implicitly?
147 *
148 *  If TRUE, then the RTEMS_FLOATING_POINT task attribute is assumed.
149 *  If FALSE, then the RTEMS_FLOATING_POINT task attribute is followed.
150 *
151 *  If CPU_HARDWARE_FP is FALSE, then this should be FALSE as well.
152 *
153 *  PowerPC Note: It appears the GCC can implicitly generate FPU
154 *  and Altivec instructions when you least expect them.  So make
155 *  all tasks floating point.
156 */
157
158#define CPU_ALL_TASKS_ARE_FP CPU_HARDWARE_FP
159
160/*
161 *  Should the IDLE task have a floating point context?
162 *
163 *  If TRUE, then the IDLE task is created as a RTEMS_FLOATING_POINT task
164 *  and it has a floating point context which is switched in and out.
165 *  If FALSE, then the IDLE task does not have a floating point context.
166 *
167 *  Setting this to TRUE negatively impacts the time required to preempt
168 *  the IDLE task from an interrupt because the floating point context
169 *  must be saved as part of the preemption.
170 */
171
172#define CPU_IDLE_TASK_IS_FP      FALSE
173
174#define CPU_PER_CPU_CONTROL_SIZE 0
175
176#define CPU_MAXIMUM_PROCESSORS 32
177
178/*
179 *  Processor defined structures required for cpukit/score.
180 */
181
182/*
183 * Contexts
184 *
185 *  Generally there are 2 types of context to save.
186 *     1. Interrupt registers to save
187 *     2. Task level registers to save
188 *
189 *  This means we have the following 3 context items:
190 *     1. task level context stuff::  Context_Control
191 *     2. floating point task stuff:: Context_Control_fp
192 *     3. special interrupt level context :: Context_Control_interrupt
193 *
194 *  On some processors, it is cost-effective to save only the callee
195 *  preserved registers during a task context switch.  This means
196 *  that the ISR code needs to save those registers which do not
197 *  persist across function calls.  It is not mandatory to make this
198 *  distinctions between the caller/callee saves registers for the
199 *  purpose of minimizing context saved during task switch and on interrupts.
200 *  If the cost of saving extra registers is minimal, simplicity is the
201 *  choice.  Save the same context on interrupt entry as for tasks in
202 *  this case.
203 *
204 *  Additionally, if gdb is to be made aware of RTEMS tasks for this CPU, then
205 *  care should be used in designing the context area.
206 *
207 *  On some CPUs with hardware floating point support, the Context_Control_fp
208 *  structure will not be used or it simply consist of an array of a
209 *  fixed number of bytes.   This is done when the floating point context
210 *  is dumped by a "FP save context" type instruction and the format
211 *  is not really defined by the CPU.  In this case, there is no need
212 *  to figure out the exact format -- only the size.  Of course, although
213 *  this is enough information for RTEMS, it is probably not enough for
214 *  a debugger such as gdb.  But that is another problem.
215 */
216
217#ifndef __SPE__
218  #define PPC_GPR_TYPE uint32_t
219  #define PPC_GPR_SIZE 4
220  #define PPC_GPR_LOAD lwz
221  #define PPC_GPR_STORE stw
222#else
223  #define PPC_GPR_TYPE uint64_t
224  #define PPC_GPR_SIZE 8
225  #define PPC_GPR_LOAD evldd
226  #define PPC_GPR_STORE evstdd
227#endif
228
229#ifndef ASM
230
231typedef struct {
232  /* There is no CPU specific per-CPU state */
233} CPU_Per_CPU_control;
234
235/*
236 * Non-volatile context according to E500ABIUG, EABI and 32-bit TLS (according
237 * to "Power Architecture 32-bit Application Binary Interface Supplement 1.0 -
238 * Linux and Embedded")
239 */
240typedef struct {
241  uint32_t gpr1;
242  uint32_t msr;
243  uint32_t lr;
244  uint32_t cr;
245  PPC_GPR_TYPE gpr14;
246  PPC_GPR_TYPE gpr15;
247  PPC_GPR_TYPE gpr16;
248  PPC_GPR_TYPE gpr17;
249  PPC_GPR_TYPE gpr18;
250  PPC_GPR_TYPE gpr19;
251  PPC_GPR_TYPE gpr20;
252  PPC_GPR_TYPE gpr21;
253  PPC_GPR_TYPE gpr22;
254  PPC_GPR_TYPE gpr23;
255  PPC_GPR_TYPE gpr24;
256  PPC_GPR_TYPE gpr25;
257  PPC_GPR_TYPE gpr26;
258  PPC_GPR_TYPE gpr27;
259  PPC_GPR_TYPE gpr28;
260  PPC_GPR_TYPE gpr29;
261  PPC_GPR_TYPE gpr30;
262  PPC_GPR_TYPE gpr31;
263  uint32_t gpr2;
264  #if defined(PPC_MULTILIB_ALTIVEC)
265    uint32_t reserved_for_alignment;
266    uint8_t v20[16];
267    uint8_t v21[16];
268    uint8_t v22[16];
269    uint8_t v23[16];
270    uint8_t v24[16];
271    uint8_t v25[16];
272    uint8_t v26[16];
273    uint8_t v27[16];
274    uint8_t v28[16];
275    uint8_t v29[16];
276    uint8_t v30[16];
277    uint8_t v31[16];
278    uint32_t vrsave;
279  #elif defined(__ALTIVEC__)
280    /*
281     * 12 non-volatile vector registers, cache-aligned area for vscr/vrsave
282     * and padding to ensure cache-alignment.  Unfortunately, we can't verify
283     * the cache line size here in the cpukit but altivec support code will
284     * produce an error if this is ever different from 32 bytes.
285     *
286     * Note: it is the BSP/CPU-support's responsibility to save/restore
287     *       volatile vregs across interrupts and exceptions.
288     */
289    uint8_t altivec[16*12 + 32 + PPC_DEFAULT_CACHE_LINE_SIZE];
290  #endif
291  #if defined(PPC_MULTILIB_FPU)
292    double f14;
293    double f15;
294    double f16;
295    double f17;
296    double f18;
297    double f19;
298    double f20;
299    double f21;
300    double f22;
301    double f23;
302    double f24;
303    double f25;
304    double f26;
305    double f27;
306    double f28;
307    double f29;
308    double f30;
309    double f31;
310  #endif
311  #if defined(RTEMS_SMP)
312    /*
313     * This item is at the structure end, so that we can use dcbz for the
314     * previous items to optimize the context switch.  We must not set this
315     * item to zero via the dcbz.
316     */
317    volatile uint32_t is_executing;
318  #endif
319} ppc_context;
320
321typedef struct {
322  uint8_t context [
323    PPC_DEFAULT_CACHE_LINE_SIZE
324      + sizeof(ppc_context)
325      + (sizeof(ppc_context) % PPC_DEFAULT_CACHE_LINE_SIZE == 0
326        ? 0
327          : PPC_DEFAULT_CACHE_LINE_SIZE
328            - sizeof(ppc_context) % PPC_DEFAULT_CACHE_LINE_SIZE)
329  ];
330} Context_Control;
331
332static inline ppc_context *ppc_get_context( const Context_Control *context )
333{
334  uintptr_t clsz = PPC_DEFAULT_CACHE_LINE_SIZE;
335  uintptr_t mask = clsz - 1;
336  uintptr_t addr = (uintptr_t) context;
337
338  return (ppc_context *) ((addr & ~mask) + clsz);
339}
340
341#define _CPU_Context_Get_SP( _context ) \
342  ppc_get_context(_context)->gpr1
343
344#ifdef RTEMS_SMP
345  static inline bool _CPU_Context_Get_is_executing(
346    const Context_Control *context
347  )
348  {
349    return ppc_get_context(context)->is_executing;
350  }
351
352  static inline void _CPU_Context_Set_is_executing(
353    Context_Control *context,
354    bool is_executing
355  )
356  {
357    ppc_get_context(context)->is_executing = is_executing;
358  }
359#endif
360#endif /* ASM */
361
362#define PPC_CONTEXT_OFFSET_GPR1 (PPC_DEFAULT_CACHE_LINE_SIZE + 0)
363#define PPC_CONTEXT_OFFSET_MSR (PPC_DEFAULT_CACHE_LINE_SIZE + 4)
364#define PPC_CONTEXT_OFFSET_LR (PPC_DEFAULT_CACHE_LINE_SIZE + 8)
365#define PPC_CONTEXT_OFFSET_CR (PPC_DEFAULT_CACHE_LINE_SIZE + 12)
366
367#define PPC_CONTEXT_GPR_OFFSET( gpr ) \
368  (((gpr) - 14) * PPC_GPR_SIZE + PPC_DEFAULT_CACHE_LINE_SIZE + 16)
369
370#define PPC_CONTEXT_OFFSET_GPR14 PPC_CONTEXT_GPR_OFFSET( 14 )
371#define PPC_CONTEXT_OFFSET_GPR15 PPC_CONTEXT_GPR_OFFSET( 15 )
372#define PPC_CONTEXT_OFFSET_GPR16 PPC_CONTEXT_GPR_OFFSET( 16 )
373#define PPC_CONTEXT_OFFSET_GPR17 PPC_CONTEXT_GPR_OFFSET( 17 )
374#define PPC_CONTEXT_OFFSET_GPR18 PPC_CONTEXT_GPR_OFFSET( 18 )
375#define PPC_CONTEXT_OFFSET_GPR19 PPC_CONTEXT_GPR_OFFSET( 19 )
376#define PPC_CONTEXT_OFFSET_GPR20 PPC_CONTEXT_GPR_OFFSET( 20 )
377#define PPC_CONTEXT_OFFSET_GPR21 PPC_CONTEXT_GPR_OFFSET( 21 )
378#define PPC_CONTEXT_OFFSET_GPR22 PPC_CONTEXT_GPR_OFFSET( 22 )
379#define PPC_CONTEXT_OFFSET_GPR23 PPC_CONTEXT_GPR_OFFSET( 23 )
380#define PPC_CONTEXT_OFFSET_GPR24 PPC_CONTEXT_GPR_OFFSET( 24 )
381#define PPC_CONTEXT_OFFSET_GPR25 PPC_CONTEXT_GPR_OFFSET( 25 )
382#define PPC_CONTEXT_OFFSET_GPR26 PPC_CONTEXT_GPR_OFFSET( 26 )
383#define PPC_CONTEXT_OFFSET_GPR27 PPC_CONTEXT_GPR_OFFSET( 27 )
384#define PPC_CONTEXT_OFFSET_GPR28 PPC_CONTEXT_GPR_OFFSET( 28 )
385#define PPC_CONTEXT_OFFSET_GPR29 PPC_CONTEXT_GPR_OFFSET( 29 )
386#define PPC_CONTEXT_OFFSET_GPR30 PPC_CONTEXT_GPR_OFFSET( 30 )
387#define PPC_CONTEXT_OFFSET_GPR31 PPC_CONTEXT_GPR_OFFSET( 31 )
388#define PPC_CONTEXT_OFFSET_GPR2 PPC_CONTEXT_GPR_OFFSET( 32 )
389
390#ifdef PPC_MULTILIB_ALTIVEC
391  #define PPC_CONTEXT_OFFSET_V( v ) \
392    ( ( ( v ) - 20 ) * 16 + PPC_DEFAULT_CACHE_LINE_SIZE + 96 )
393  #define PPC_CONTEXT_OFFSET_V20 PPC_CONTEXT_OFFSET_V( 20 )
394  #define PPC_CONTEXT_OFFSET_V21 PPC_CONTEXT_OFFSET_V( 21 )
395  #define PPC_CONTEXT_OFFSET_V22 PPC_CONTEXT_OFFSET_V( 22 )
396  #define PPC_CONTEXT_OFFSET_V23 PPC_CONTEXT_OFFSET_V( 23 )
397  #define PPC_CONTEXT_OFFSET_V24 PPC_CONTEXT_OFFSET_V( 24 )
398  #define PPC_CONTEXT_OFFSET_V25 PPC_CONTEXT_OFFSET_V( 25 )
399  #define PPC_CONTEXT_OFFSET_V26 PPC_CONTEXT_OFFSET_V( 26 )
400  #define PPC_CONTEXT_OFFSET_V27 PPC_CONTEXT_OFFSET_V( 27 )
401  #define PPC_CONTEXT_OFFSET_V28 PPC_CONTEXT_OFFSET_V( 28 )
402  #define PPC_CONTEXT_OFFSET_V29 PPC_CONTEXT_OFFSET_V( 29 )
403  #define PPC_CONTEXT_OFFSET_V30 PPC_CONTEXT_OFFSET_V( 30 )
404  #define PPC_CONTEXT_OFFSET_V31 PPC_CONTEXT_OFFSET_V( 31 )
405  #define PPC_CONTEXT_OFFSET_VRSAVE PPC_CONTEXT_OFFSET_V( 32 )
406  #define PPC_CONTEXT_OFFSET_F( f ) \
407    ( ( ( f ) - 14 ) * 8 + PPC_DEFAULT_CACHE_LINE_SIZE + 296 )
408#else
409  #define PPC_CONTEXT_OFFSET_F( f ) \
410    ( ( ( f ) - 14 ) * 8 + PPC_DEFAULT_CACHE_LINE_SIZE + 96 )
411#endif
412
413#ifdef PPC_MULTILIB_FPU
414  #define PPC_CONTEXT_OFFSET_F14 PPC_CONTEXT_OFFSET_F( 14 )
415  #define PPC_CONTEXT_OFFSET_F15 PPC_CONTEXT_OFFSET_F( 15 )
416  #define PPC_CONTEXT_OFFSET_F16 PPC_CONTEXT_OFFSET_F( 16 )
417  #define PPC_CONTEXT_OFFSET_F17 PPC_CONTEXT_OFFSET_F( 17 )
418  #define PPC_CONTEXT_OFFSET_F18 PPC_CONTEXT_OFFSET_F( 18 )
419  #define PPC_CONTEXT_OFFSET_F19 PPC_CONTEXT_OFFSET_F( 19 )
420  #define PPC_CONTEXT_OFFSET_F20 PPC_CONTEXT_OFFSET_F( 20 )
421  #define PPC_CONTEXT_OFFSET_F21 PPC_CONTEXT_OFFSET_F( 21 )
422  #define PPC_CONTEXT_OFFSET_F22 PPC_CONTEXT_OFFSET_F( 22 )
423  #define PPC_CONTEXT_OFFSET_F23 PPC_CONTEXT_OFFSET_F( 23 )
424  #define PPC_CONTEXT_OFFSET_F24 PPC_CONTEXT_OFFSET_F( 24 )
425  #define PPC_CONTEXT_OFFSET_F25 PPC_CONTEXT_OFFSET_F( 25 )
426  #define PPC_CONTEXT_OFFSET_F26 PPC_CONTEXT_OFFSET_F( 26 )
427  #define PPC_CONTEXT_OFFSET_F27 PPC_CONTEXT_OFFSET_F( 27 )
428  #define PPC_CONTEXT_OFFSET_F28 PPC_CONTEXT_OFFSET_F( 28 )
429  #define PPC_CONTEXT_OFFSET_F29 PPC_CONTEXT_OFFSET_F( 29 )
430  #define PPC_CONTEXT_OFFSET_F30 PPC_CONTEXT_OFFSET_F( 30 )
431  #define PPC_CONTEXT_OFFSET_F31 PPC_CONTEXT_OFFSET_F( 31 )
432#endif
433
434#if defined(PPC_MULTILIB_FPU)
435  #define PPC_CONTEXT_VOLATILE_SIZE PPC_CONTEXT_OFFSET_F( 32 )
436#elif defined(PPC_MULTILIB_ALTIVEC)
437  #define PPC_CONTEXT_VOLATILE_SIZE (PPC_CONTEXT_OFFSET_VRSAVE + 4)
438#else
439  #define PPC_CONTEXT_VOLATILE_SIZE (PPC_CONTEXT_GPR_OFFSET( 32 ) + 4)
440#endif
441
442#ifdef RTEMS_SMP
443  #define PPC_CONTEXT_OFFSET_IS_EXECUTING PPC_CONTEXT_VOLATILE_SIZE
444#endif
445
446#ifndef ASM
447typedef struct {
448#if (PPC_HAS_FPU == 1)
449    /* The ABIs (PowerOpen/SVR4/EABI) only require saving f14-f31 over
450     * procedure calls.  However, this would mean that the interrupt
451     * frame had to hold f0-f13, and the fpscr.  And as the majority
452     * of tasks will not have an FP context, we will save the whole
453     * context here.
454     */
455#if (PPC_HAS_DOUBLE == 1)
456    double      f[32];
457    uint64_t    fpscr;
458#else
459    float       f[32];
460    uint32_t    fpscr;
461#endif
462#endif /* (PPC_HAS_FPU == 1) */
463} Context_Control_fp;
464
465typedef struct CPU_Interrupt_frame {
466    uint32_t   stacklink;       /* Ensure this is a real frame (also reg1 save) */
467    uint32_t   calleeLr;        /* link register used by callees: SVR4/EABI */
468
469    /* This is what is left out of the primary contexts */
470    uint32_t   gpr0;
471    uint32_t   gpr2;            /* play safe */
472    uint32_t   gpr3;
473    uint32_t   gpr4;
474    uint32_t   gpr5;
475    uint32_t   gpr6;
476    uint32_t   gpr7;
477    uint32_t   gpr8;
478    uint32_t   gpr9;
479    uint32_t   gpr10;
480    uint32_t   gpr11;
481    uint32_t   gpr12;
482    uint32_t   gpr13;   /* Play safe */
483    uint32_t   gpr28;   /* For internal use by the IRQ handler */
484    uint32_t   gpr29;   /* For internal use by the IRQ handler */
485    uint32_t   gpr30;   /* For internal use by the IRQ handler */
486    uint32_t   gpr31;   /* For internal use by the IRQ handler */
487    uint32_t   cr;      /* Bits of this are volatile, so no-one may save */
488    uint32_t   ctr;
489    uint32_t   xer;
490    uint32_t   lr;
491    uint32_t   pc;
492    uint32_t   msr;
493    uint32_t   pad[3];
494} CPU_Interrupt_frame;
495
496#endif /* ASM */
497
498/*
499 *  Does the CPU follow the simple vectored interrupt model?
500 *
501 *  If TRUE, then RTEMS allocates the vector table it internally manages.
502 *  If FALSE, then the BSP is assumed to allocate and manage the vector
503 *  table
504 *
505 *  PowerPC Specific Information:
506 *
507 *  The PowerPC and x86 were the first to use the PIC interrupt model.
508 *  They do not use the simple vectored interrupt model.
509 */
510#define CPU_SIMPLE_VECTORED_INTERRUPTS FALSE
511
512/*
513 *  Does RTEMS manage a dedicated interrupt stack in software?
514 *
515 *  If TRUE, then a stack is allocated in _ISR_Handler_initialization.
516 *  If FALSE, nothing is done.
517 *
518 *  If the CPU supports a dedicated interrupt stack in hardware,
519 *  then it is generally the responsibility of the BSP to allocate it
520 *  and set it up.
521 *
522 *  If the CPU does not support a dedicated interrupt stack, then
523 *  the porter has two options: (1) execute interrupts on the
524 *  stack of the interrupted task, and (2) have RTEMS manage a dedicated
525 *  interrupt stack.
526 *
527 *  If this is TRUE, CPU_ALLOCATE_INTERRUPT_STACK should also be TRUE.
528 *
529 *  Only one of CPU_HAS_SOFTWARE_INTERRUPT_STACK and
530 *  CPU_HAS_HARDWARE_INTERRUPT_STACK should be set to TRUE.  It is
531 *  possible that both are FALSE for a particular CPU.  Although it
532 *  is unclear what that would imply about the interrupt processing
533 *  procedure on that CPU.
534 */
535
536#define CPU_HAS_SOFTWARE_INTERRUPT_STACK TRUE
537
538/*
539 *  Does this CPU have hardware support for a dedicated interrupt stack?
540 *
541 *  If TRUE, then it must be installed during initialization.
542 *  If FALSE, then no installation is performed.
543 *
544 *  If this is TRUE, CPU_ALLOCATE_INTERRUPT_STACK should also be TRUE.
545 *
546 *  Only one of CPU_HAS_SOFTWARE_INTERRUPT_STACK and
547 *  CPU_HAS_HARDWARE_INTERRUPT_STACK should be set to TRUE.  It is
548 *  possible that both are FALSE for a particular CPU.  Although it
549 *  is unclear what that would imply about the interrupt processing
550 *  procedure on that CPU.
551 */
552
553#define CPU_HAS_HARDWARE_INTERRUPT_STACK FALSE
554
555/*
556 *  Does RTEMS allocate a dedicated interrupt stack in the Interrupt Manager?
557 *
558 *  If TRUE, then the memory is allocated during initialization.
559 *  If FALSE, then the memory is allocated during initialization.
560 *
561 *  This should be TRUE is CPU_HAS_SOFTWARE_INTERRUPT_STACK is TRUE.
562 */
563
564#define CPU_ALLOCATE_INTERRUPT_STACK TRUE
565
566/*
567 *  Does the RTEMS invoke the user's ISR with the vector number and
568 *  a pointer to the saved interrupt frame (1) or just the vector
569 *  number (0)?
570 */
571
572#define CPU_ISR_PASSES_FRAME_POINTER 0
573
574/*
575 *  Should the saving of the floating point registers be deferred
576 *  until a context switch is made to another different floating point
577 *  task?
578 *
579 *  If TRUE, then the floating point context will not be stored until
580 *  necessary.  It will remain in the floating point registers and not
581 *  disturned until another floating point task is switched to.
582 *
583 *  If FALSE, then the floating point context is saved when a floating
584 *  point task is switched out and restored when the next floating point
585 *  task is restored.  The state of the floating point registers between
586 *  those two operations is not specified.
587 *
588 *  If the floating point context does NOT have to be saved as part of
589 *  interrupt dispatching, then it should be safe to set this to TRUE.
590 *
591 *  Setting this flag to TRUE results in using a different algorithm
592 *  for deciding when to save and restore the floating point context.
593 *  The deferred FP switch algorithm minimizes the number of times
594 *  the FP context is saved and restored.  The FP context is not saved
595 *  until a context switch is made to another, different FP task.
596 *  Thus in a system with only one FP task, the FP context will never
597 *  be saved or restored.
598 *
599 *  Note, however that compilers may use floating point registers/
600 *  instructions for optimization or they may save/restore FP registers
601 *  on the stack. You must not use deferred switching in these cases
602 *  and on the PowerPC attempting to do so will raise a "FP unavailable"
603 *  exception.
604 */
605/*
606 *  ACB Note:  This could make debugging tricky..
607 */
608
609/* conservative setting (FALSE); probably doesn't affect performance too much */
610#define CPU_USE_DEFERRED_FP_SWITCH       FALSE
611
612/*
613 *  Processor defined structures required for cpukit/score.
614 */
615
616#ifndef ASM
617
618/*
619 *  This variable is optional.  It is used on CPUs on which it is difficult
620 *  to generate an "uninitialized" FP context.  It is filled in by
621 *  _CPU_Initialize and copied into the task's FP context area during
622 *  _CPU_Context_Initialize.
623 */
624
625/* EXTERN Context_Control_fp  _CPU_Null_fp_context; */
626
627#endif /* ndef ASM */
628
629/*
630 *  This defines the number of levels and the mask used to pick those
631 *  bits out of a thread mode.
632 */
633
634#define CPU_MODES_INTERRUPT_LEVEL  0x00000001 /* interrupt level in mode */
635#define CPU_MODES_INTERRUPT_MASK   0x00000001 /* interrupt level in mode */
636
637/*
638 *  The size of the floating point context area.  On some CPUs this
639 *  will not be a "sizeof" because the format of the floating point
640 *  area is not defined -- only the size is.  This is usually on
641 *  CPUs with a "floating point save context" instruction.
642 */
643
644#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp )
645
646/*
647 * (Optional) # of bytes for libmisc/stackchk to check
648 * If not specifed, then it defaults to something reasonable
649 * for most architectures.
650 */
651
652#define CPU_STACK_CHECK_PATTERN_INITIALIZER \
653  { 0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
654    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
655    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
656    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
657    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
658    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
659    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
660    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06 }
661
662/*
663 *  Amount of extra stack (above minimum stack size) required by
664 *  MPCI receive server thread.  Remember that in a multiprocessor
665 *  system this thread must exist and be able to process all directives.
666 */
667
668#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 0
669
670/*
671 *  This is defined if the port has a special way to report the ISR nesting
672 *  level.  Most ports maintain the variable _ISR_Nest_level. Note that
673 *  this is not an option - RTEMS/score _relies_ on _ISR_Nest_level
674 *  being maintained (e.g. watchdog queues).
675 */
676
677#define CPU_PROVIDES_ISR_IS_IN_PROGRESS FALSE
678
679/*
680 *  ISR handler macros
681 */
682
683/*
684 *  Disable all interrupts for an RTEMS critical section.  The previous
685 *  level is returned in _isr_cookie.
686 */
687
688#ifndef ASM
689
690static inline uint32_t   _CPU_ISR_Get_level( void )
691{
692  register unsigned int msr;
693  _CPU_MSR_GET(msr);
694  if (msr & MSR_EE) return 0;
695  else  return 1;
696}
697
698static inline void _CPU_ISR_Set_level( uint32_t   level )
699{
700  register unsigned int msr;
701  _CPU_MSR_GET(msr);
702  if (!(level & CPU_MODES_INTERRUPT_MASK)) {
703    msr |= ppc_interrupt_get_disable_mask();
704  }
705  else {
706    msr &= ~ppc_interrupt_get_disable_mask();
707  }
708  _CPU_MSR_SET(msr);
709}
710
711void BSP_panic(char *);
712
713/* Fatal Error manager macros */
714
715/*
716 *  This routine copies _error into a known place -- typically a stack
717 *  location or a register, optionally disables interrupts, and
718 *  halts/stops the CPU.
719 */
720
721void _BSP_Fatal_error(unsigned int);
722
723#endif /* ASM */
724
725#define _CPU_Fatal_halt( _source, _error ) \
726  _BSP_Fatal_error(_error)
727
728/* end of Fatal Error manager macros */
729
730/*
731 *  Should be large enough to run all RTEMS tests.  This ensures
732 *  that a "reasonable" small application should not have any problems.
733 */
734
735#define CPU_STACK_MINIMUM_SIZE          (1024*8)
736
737#define CPU_SIZEOF_POINTER 4
738
739/*
740 *  CPU's worst alignment requirement for data types on a byte boundary.  This
741 *  alignment does not take into account the requirements for the stack.
742 */
743
744#define CPU_ALIGNMENT              (PPC_ALIGNMENT)
745
746/*
747 *  This number corresponds to the byte alignment requirement for the
748 *  heap handler.  This alignment requirement may be stricter than that
749 *  for the data types alignment specified by CPU_ALIGNMENT.  It is
750 *  common for the heap to follow the same alignment requirement as
751 *  CPU_ALIGNMENT.  If the CPU_ALIGNMENT is strict enough for the heap,
752 *  then this should be set to CPU_ALIGNMENT.
753 *
754 *  NOTE:  This does not have to be a power of 2.  It does have to
755 *         be greater or equal to than CPU_ALIGNMENT.
756 */
757
758#define CPU_HEAP_ALIGNMENT         (PPC_ALIGNMENT)
759
760/*
761 *  This number corresponds to the byte alignment requirement for memory
762 *  buffers allocated by the partition manager.  This alignment requirement
763 *  may be stricter than that for the data types alignment specified by
764 *  CPU_ALIGNMENT.  It is common for the partition to follow the same
765 *  alignment requirement as CPU_ALIGNMENT.  If the CPU_ALIGNMENT is strict
766 *  enough for the partition, then this should be set to CPU_ALIGNMENT.
767 *
768 *  NOTE:  This does not have to be a power of 2.  It does have to
769 *         be greater or equal to than CPU_ALIGNMENT.
770 */
771
772#define CPU_PARTITION_ALIGNMENT    (PPC_ALIGNMENT)
773
774/*
775 *  This number corresponds to the byte alignment requirement for the
776 *  stack.  This alignment requirement may be stricter than that for the
777 *  data types alignment specified by CPU_ALIGNMENT.  If the CPU_ALIGNMENT
778 *  is strict enough for the stack, then this should be set to 0.
779 *
780 *  NOTE:  This must be a power of 2 either 0 or greater than CPU_ALIGNMENT.
781 */
782
783#define CPU_STACK_ALIGNMENT        (PPC_STACK_ALIGNMENT)
784
785#ifndef ASM
786/*  The following routine swaps the endian format of an unsigned int.
787 *  It must be static because it is referenced indirectly.
788 *
789 *  This version will work on any processor, but if there is a better
790 *  way for your CPU PLEASE use it.  The most common way to do this is to:
791 *
792 *     swap least significant two bytes with 16-bit rotate
793 *     swap upper and lower 16-bits
794 *     swap most significant two bytes with 16-bit rotate
795 *
796 *  Some CPUs have special instructions which swap a 32-bit quantity in
797 *  a single instruction (e.g. i486).  It is probably best to avoid
798 *  an "endian swapping control bit" in the CPU.  One good reason is
799 *  that interrupts would probably have to be disabled to ensure that
800 *  an interrupt does not try to access the same "chunk" with the wrong
801 *  endian.  Another good reason is that on some CPUs, the endian bit
802 *  endianness for ALL fetches -- both code and data -- so the code
803 *  will be fetched incorrectly.
804 */
805
806static inline uint32_t CPU_swap_u32(
807  uint32_t value
808)
809{
810  uint32_t   swapped;
811
812  __asm__ volatile("rlwimi %0,%1,8,24,31;"
813               "rlwimi %0,%1,24,16,23;"
814               "rlwimi %0,%1,8,8,15;"
815               "rlwimi %0,%1,24,0,7;" :
816               "=&r" ((swapped)) : "r" ((value)));
817
818  return( swapped );
819}
820
821#define CPU_swap_u16( value ) \
822  (((value&0xff) << 8) | ((value >> 8)&0xff))
823
824typedef uint32_t CPU_Counter_ticks;
825
826static inline CPU_Counter_ticks _CPU_Counter_read( void )
827{
828  CPU_Counter_ticks value;
829
830#if defined(__PPC_CPU_E6500__)
831  /* Use Alternate Time Base */
832  __asm__ volatile( "mfspr %0, 526" : "=r" (value) );
833#else
834  __asm__ volatile( "mfspr %0, 268" : "=r" (value) );
835#endif
836
837  return value;
838}
839
840static inline CPU_Counter_ticks _CPU_Counter_difference(
841  CPU_Counter_ticks second,
842  CPU_Counter_ticks first
843)
844{
845  return second - first;
846}
847
848#endif /* ASM */
849
850
851#ifndef ASM
852/* Context handler macros */
853
854/*
855 *  Initialize the context to a state suitable for starting a
856 *  task after a context restore operation.  Generally, this
857 *  involves:
858 *
859 *     - setting a starting address
860 *     - preparing the stack
861 *     - preparing the stack and frame pointers
862 *     - setting the proper interrupt level in the context
863 *     - initializing the floating point context
864 *
865 *  This routine generally does not set any unnecessary register
866 *  in the context.  The state of the "general data" registers is
867 *  undefined at task start time.
868 */
869
870void _CPU_Context_Initialize(
871  Context_Control  *the_context,
872  uint32_t         *stack_base,
873  uint32_t          size,
874  uint32_t          new_level,
875  void             *entry_point,
876  bool              is_fp,
877  void             *tls_area
878);
879
880/*
881 *  This routine is responsible for somehow restarting the currently
882 *  executing task.  If you are lucky, then all that is necessary
883 *  is restoring the context.  Otherwise, there will need to be
884 *  a special assembly routine which does something special in this
885 *  case.  Context_Restore should work most of the time.  It will
886 *  not work if restarting self conflicts with the stack frame
887 *  assumptions of restoring a context.
888 */
889
890#define _CPU_Context_Restart_self( _the_context ) \
891   _CPU_Context_restore( (_the_context) );
892
893/*
894 *  The purpose of this macro is to allow the initial pointer into
895 *  a floating point context area (used to save the floating point
896 *  context) to be at an arbitrary place in the floating point
897 *  context area.
898 *
899 *  This is necessary because some FP units are designed to have
900 *  their context saved as a stack which grows into lower addresses.
901 *  Other FP units can be saved by simply moving registers into offsets
902 *  from the base of the context area.  Finally some FP units provide
903 *  a "dump context" instruction which could fill in from high to low
904 *  or low to high based on the whim of the CPU designers.
905 */
906
907#define _CPU_Context_Fp_start( _base, _offset ) \
908   ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
909
910/*
911 *  This routine initializes the FP context area passed to it to.
912 *  There are a few standard ways in which to initialize the
913 *  floating point context.  The code included for this macro assumes
914 *  that this is a CPU in which a "initial" FP context was saved into
915 *  _CPU_Null_fp_context and it simply copies it to the destination
916 *  context passed to it.
917 *
918 *  Other models include (1) not doing anything, and (2) putting
919 *  a "null FP status word" in the correct place in the FP context.
920 */
921
922#define _CPU_Context_Initialize_fp( _destination ) \
923  memset( *(_destination), 0, sizeof( **(_destination) ) )
924
925/* end of Context handler macros */
926#endif /* ASM */
927
928#ifndef ASM
929/* Bitfield handler macros */
930
931#define CPU_USE_GENERIC_BITFIELD_CODE FALSE
932
933/*
934 *  This routine sets _output to the bit number of the first bit
935 *  set in _value.  _value is of CPU dependent type Priority_bit_map_Word.
936 *  This type may be either 16 or 32 bits wide although only the 16
937 *  least significant bits will be used.
938 *
939 *  There are a number of variables in using a "find first bit" type
940 *  instruction.
941 *
942 *    (1) What happens when run on a value of zero?
943 *    (2) Bits may be numbered from MSB to LSB or vice-versa.
944 *    (3) The numbering may be zero or one based.
945 *    (4) The "find first bit" instruction may search from MSB or LSB.
946 *
947 *  RTEMS guarantees that (1) will never happen so it is not a concern.
948 *  (2),(3), (4) are handled by the macros _CPU_Priority_mask() and
949 *  _CPU_Priority_Bits_index().  These three form a set of routines
950 *  which must logically operate together.  Bits in the _value are
951 *  set and cleared based on masks built by _CPU_Priority_mask().
952 *  The basic major and minor values calculated by _Priority_Major()
953 *  and _Priority_Minor() are "massaged" by _CPU_Priority_Bits_index()
954 *  to properly range between the values returned by the "find first bit"
955 *  instruction.  This makes it possible for _Priority_Get_highest() to
956 *  calculate the major and directly index into the minor table.
957 *  This mapping is necessary to ensure that 0 (a high priority major/minor)
958 *  is the first bit found.
959 *
960 *  This entire "find first bit" and mapping process depends heavily
961 *  on the manner in which a priority is broken into a major and minor
962 *  components with the major being the 4 MSB of a priority and minor
963 *  the 4 LSB.  Thus (0 << 4) + 0 corresponds to priority 0 -- the highest
964 *  priority.  And (15 << 4) + 14 corresponds to priority 254 -- the next
965 *  to the lowest priority.
966 *
967 *  If your CPU does not have a "find first bit" instruction, then
968 *  there are ways to make do without it.  Here are a handful of ways
969 *  to implement this in software:
970 *
971 *    - a series of 16 bit test instructions
972 *    - a "binary search using if's"
973 *    - _number = 0
974 *      if _value > 0x00ff
975 *        _value >>=8
976 *        _number = 8;
977 *
978 *      if _value > 0x0000f
979 *        _value >=8
980 *        _number += 4
981 *
982 *      _number += bit_set_table[ _value ]
983 *
984 *    where bit_set_table[ 16 ] has values which indicate the first
985 *      bit set
986 */
987
988#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
989  { \
990    __asm__ volatile ("cntlzw %0, %1" : "=r" ((_output)), "=r" ((_value)) : \
991                  "1" ((_value))); \
992    (_output) = (_output) - 16; \
993  }
994
995/* end of Bitfield handler macros */
996
997/*
998 *  This routine builds the mask which corresponds to the bit fields
999 *  as searched by _CPU_Bitfield_Find_first_bit().  See the discussion
1000 *  for that routine.
1001 */
1002
1003#define _CPU_Priority_Mask( _bit_number ) \
1004  ( 0x8000u >> (_bit_number) )
1005
1006/*
1007 *  This routine translates the bit numbers returned by
1008 *  _CPU_Bitfield_Find_first_bit() into something suitable for use as
1009 *  a major or minor component of a priority.  See the discussion
1010 *  for that routine.
1011 */
1012
1013#define _CPU_Priority_bits_index( _priority ) \
1014  (_priority)
1015
1016/* end of Priority handler macros */
1017#endif /* ASM */
1018
1019/* functions */
1020
1021#ifndef ASM
1022
1023/*
1024 *  _CPU_Initialize
1025 *
1026 *  This routine performs CPU dependent initialization.
1027 */
1028
1029void _CPU_Initialize(void);
1030
1031/*
1032 *  _CPU_ISR_install_vector
1033 *
1034 *  This routine installs an interrupt vector.
1035 */
1036
1037void _CPU_ISR_install_vector(
1038  uint32_t    vector,
1039  proc_ptr    new_handler,
1040  proc_ptr   *old_handler
1041);
1042
1043/*
1044 *  _CPU_Context_switch
1045 *
1046 *  This routine switches from the run context to the heir context.
1047 */
1048
1049void _CPU_Context_switch(
1050  Context_Control  *run,
1051  Context_Control  *heir
1052);
1053
1054/*
1055 *  _CPU_Context_restore
1056 *
1057 *  This routine is generallu used only to restart self in an
1058 *  efficient manner.  It may simply be a label in _CPU_Context_switch.
1059 *
1060 *  NOTE: May be unnecessary to reload some registers.
1061 */
1062
1063void _CPU_Context_restore(
1064  Context_Control *new_context
1065) RTEMS_NO_RETURN;
1066
1067/*
1068 *  _CPU_Context_save_fp
1069 *
1070 *  This routine saves the floating point context passed to it.
1071 */
1072
1073void _CPU_Context_save_fp(
1074  Context_Control_fp **fp_context_ptr
1075);
1076
1077/*
1078 *  _CPU_Context_restore_fp
1079 *
1080 *  This routine restores the floating point context passed to it.
1081 */
1082
1083void _CPU_Context_restore_fp(
1084  Context_Control_fp **fp_context_ptr
1085);
1086
1087void _CPU_Context_volatile_clobber( uintptr_t pattern );
1088
1089void _CPU_Context_validate( uintptr_t pattern );
1090
1091#ifdef RTEMS_SMP
1092  uint32_t _CPU_SMP_Initialize( void );
1093
1094  bool _CPU_SMP_Start_processor( uint32_t cpu_index );
1095
1096  void _CPU_SMP_Finalize_initialization( uint32_t cpu_count );
1097
1098  void _CPU_SMP_Prepare_start_multitasking( void );
1099
1100  static inline uint32_t _CPU_SMP_Get_current_processor( void )
1101  {
1102    uint32_t pir;
1103
1104    /* Use Book E Processor ID Register (PIR) */
1105    __asm__ volatile (
1106      "mfspr %[pir], 286"
1107      : [pir] "=&r" (pir)
1108    );
1109
1110    return pir;
1111  }
1112
1113  void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
1114
1115  static inline void _CPU_SMP_Processor_event_broadcast( void )
1116  {
1117    __asm__ volatile ( "" : : : "memory" );
1118  }
1119
1120  static inline void _CPU_SMP_Processor_event_receive( void )
1121  {
1122    __asm__ volatile ( "" : : : "memory" );
1123  }
1124#endif
1125
1126typedef struct {
1127  uint32_t EXC_SRR0;
1128  uint32_t EXC_SRR1;
1129  uint32_t _EXC_number;
1130  uint32_t EXC_CR;
1131  uint32_t EXC_CTR;
1132  uint32_t EXC_XER;
1133  uint32_t EXC_LR;
1134  #ifdef __SPE__
1135    uint32_t EXC_SPEFSCR;
1136    uint64_t EXC_ACC;
1137  #endif
1138  PPC_GPR_TYPE GPR0;
1139  PPC_GPR_TYPE GPR1;
1140  PPC_GPR_TYPE GPR2;
1141  PPC_GPR_TYPE GPR3;
1142  PPC_GPR_TYPE GPR4;
1143  PPC_GPR_TYPE GPR5;
1144  PPC_GPR_TYPE GPR6;
1145  PPC_GPR_TYPE GPR7;
1146  PPC_GPR_TYPE GPR8;
1147  PPC_GPR_TYPE GPR9;
1148  PPC_GPR_TYPE GPR10;
1149  PPC_GPR_TYPE GPR11;
1150  PPC_GPR_TYPE GPR12;
1151  PPC_GPR_TYPE GPR13;
1152  PPC_GPR_TYPE GPR14;
1153  PPC_GPR_TYPE GPR15;
1154  PPC_GPR_TYPE GPR16;
1155  PPC_GPR_TYPE GPR17;
1156  PPC_GPR_TYPE GPR18;
1157  PPC_GPR_TYPE GPR19;
1158  PPC_GPR_TYPE GPR20;
1159  PPC_GPR_TYPE GPR21;
1160  PPC_GPR_TYPE GPR22;
1161  PPC_GPR_TYPE GPR23;
1162  PPC_GPR_TYPE GPR24;
1163  PPC_GPR_TYPE GPR25;
1164  PPC_GPR_TYPE GPR26;
1165  PPC_GPR_TYPE GPR27;
1166  PPC_GPR_TYPE GPR28;
1167  PPC_GPR_TYPE GPR29;
1168  PPC_GPR_TYPE GPR30;
1169  PPC_GPR_TYPE GPR31;
1170  #if defined(PPC_MULTILIB_ALTIVEC) || defined(PPC_MULTILIB_FPU)
1171    uint32_t reserved_for_alignment;
1172  #endif
1173  #ifdef PPC_MULTILIB_ALTIVEC
1174    uint32_t VRSAVE;
1175
1176    /* This field must take stvewx/lvewx requirements into account */
1177    uint32_t VSCR;
1178
1179    uint8_t V0[16];
1180    uint8_t V1[16];
1181    uint8_t V2[16];
1182    uint8_t V3[16];
1183    uint8_t V4[16];
1184    uint8_t V5[16];
1185    uint8_t V6[16];
1186    uint8_t V7[16];
1187    uint8_t V8[16];
1188    uint8_t V9[16];
1189    uint8_t V10[16];
1190    uint8_t V11[16];
1191    uint8_t V12[16];
1192    uint8_t V13[16];
1193    uint8_t V14[16];
1194    uint8_t V15[16];
1195    uint8_t V16[16];
1196    uint8_t V17[16];
1197    uint8_t V18[16];
1198    uint8_t V19[16];
1199    uint8_t V20[16];
1200    uint8_t V21[16];
1201    uint8_t V22[16];
1202    uint8_t V23[16];
1203    uint8_t V24[16];
1204    uint8_t V25[16];
1205    uint8_t V26[16];
1206    uint8_t V27[16];
1207    uint8_t V28[16];
1208    uint8_t V29[16];
1209    uint8_t V30[16];
1210    uint8_t V31[16];
1211  #endif
1212  #ifdef PPC_MULTILIB_FPU
1213    double F0;
1214    double F1;
1215    double F2;
1216    double F3;
1217    double F4;
1218    double F5;
1219    double F6;
1220    double F7;
1221    double F8;
1222    double F9;
1223    double F10;
1224    double F11;
1225    double F12;
1226    double F13;
1227    double F14;
1228    double F15;
1229    double F16;
1230    double F17;
1231    double F18;
1232    double F19;
1233    double F20;
1234    double F21;
1235    double F22;
1236    double F23;
1237    double F24;
1238    double F25;
1239    double F26;
1240    double F27;
1241    double F28;
1242    double F29;
1243    double F30;
1244    double F31;
1245    uint64_t FPSCR;
1246  #endif
1247} CPU_Exception_frame;
1248
1249void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
1250
1251/*
1252 * _CPU_Initialize_altivec()
1253 *
1254 * Global altivec-related initialization.
1255 */
1256void
1257_CPU_Initialize_altivec(void);
1258
1259/*
1260 * _CPU_Context_switch_altivec
1261 *
1262 * This routine switches the altivec contexts passed to it.
1263 */
1264
1265void
1266_CPU_Context_switch_altivec(
1267  ppc_context *from,
1268  ppc_context *to
1269);
1270
1271/*
1272 * _CPU_Context_restore_altivec
1273 *
1274 * This routine restores the altivec context passed to it.
1275 */
1276
1277void
1278_CPU_Context_restore_altivec(
1279  ppc_context *ctxt
1280);
1281
1282/*
1283 * _CPU_Context_initialize_altivec
1284 *
1285 * This routine initializes the altivec context passed to it.
1286 */
1287
1288void
1289_CPU_Context_initialize_altivec(
1290  ppc_context *ctxt
1291);
1292
1293void _CPU_Fatal_error(
1294  uint32_t   _error
1295);
1296
1297#endif /* ASM */
1298
1299#ifdef __cplusplus
1300}
1301#endif
1302
1303#endif /* _RTEMS_SCORE_CPU_H */
Note: See TracBrowser for help on using the repository browser.