source: rtems/cpukit/score/cpu/powerpc/rtems/score/cpu.h @ 01b32d4

5
Last change on this file since 01b32d4 was 01b32d4, checked in by Sebastian Huber <sebastian.huber@…>, on 01/25/16 at 07:54:17

score: Delete obsolete CPU_TIMESTAMP_* defines

Update #2271.

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