source: rtems/cpukit/score/cpu/powerpc/rtems/score/cpu.h @ 18e29faf

5
Last change on this file since 18e29faf was 18e29faf, checked in by Sebastian Huber <sebastian.huber@…>, on 06/08/16 at 08:10:40

score: Delete CPU_USE_GENERIC_BITFIELD_DATA

Rename log2table into _Bitfield_Leading_zeros since it acually returns
the count of leading zeros of an 8-bit integer. The value for zero is a
bit odd. Provide it unconditionally.

  • Property mode set to 100644
File size: 37.9 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_SIZE    (128)
653
654/*
655 *  Amount of extra stack (above minimum stack size) required by
656 *  MPCI receive server thread.  Remember that in a multiprocessor
657 *  system this thread must exist and be able to process all directives.
658 */
659
660#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 0
661
662/*
663 *  This is defined if the port has a special way to report the ISR nesting
664 *  level.  Most ports maintain the variable _ISR_Nest_level. Note that
665 *  this is not an option - RTEMS/score _relies_ on _ISR_Nest_level
666 *  being maintained (e.g. watchdog queues).
667 */
668
669#define CPU_PROVIDES_ISR_IS_IN_PROGRESS FALSE
670
671/*
672 *  ISR handler macros
673 */
674
675/*
676 *  Disable all interrupts for an RTEMS critical section.  The previous
677 *  level is returned in _isr_cookie.
678 */
679
680#ifndef ASM
681
682static inline uint32_t   _CPU_ISR_Get_level( void )
683{
684  register unsigned int msr;
685  _CPU_MSR_GET(msr);
686  if (msr & MSR_EE) return 0;
687  else  return 1;
688}
689
690static inline void _CPU_ISR_Set_level( uint32_t   level )
691{
692  register unsigned int msr;
693  _CPU_MSR_GET(msr);
694  if (!(level & CPU_MODES_INTERRUPT_MASK)) {
695    msr |= ppc_interrupt_get_disable_mask();
696  }
697  else {
698    msr &= ~ppc_interrupt_get_disable_mask();
699  }
700  _CPU_MSR_SET(msr);
701}
702
703void BSP_panic(char *);
704
705/* Fatal Error manager macros */
706
707/*
708 *  This routine copies _error into a known place -- typically a stack
709 *  location or a register, optionally disables interrupts, and
710 *  halts/stops the CPU.
711 */
712
713void _BSP_Fatal_error(unsigned int);
714
715#endif /* ASM */
716
717#define _CPU_Fatal_halt( _source, _error ) \
718  _BSP_Fatal_error(_error)
719
720/* end of Fatal Error manager macros */
721
722/*
723 *  Should be large enough to run all RTEMS tests.  This ensures
724 *  that a "reasonable" small application should not have any problems.
725 */
726
727#define CPU_STACK_MINIMUM_SIZE          (1024*8)
728
729#define CPU_SIZEOF_POINTER 4
730
731/*
732 *  CPU's worst alignment requirement for data types on a byte boundary.  This
733 *  alignment does not take into account the requirements for the stack.
734 */
735
736#define CPU_ALIGNMENT              (PPC_ALIGNMENT)
737
738/*
739 *  This number corresponds to the byte alignment requirement for the
740 *  heap handler.  This alignment requirement may be stricter than that
741 *  for the data types alignment specified by CPU_ALIGNMENT.  It is
742 *  common for the heap to follow the same alignment requirement as
743 *  CPU_ALIGNMENT.  If the CPU_ALIGNMENT is strict enough for the heap,
744 *  then this should be set to CPU_ALIGNMENT.
745 *
746 *  NOTE:  This does not have to be a power of 2.  It does have to
747 *         be greater or equal to than CPU_ALIGNMENT.
748 */
749
750#define CPU_HEAP_ALIGNMENT         (PPC_ALIGNMENT)
751
752/*
753 *  This number corresponds to the byte alignment requirement for memory
754 *  buffers allocated by the partition manager.  This alignment requirement
755 *  may be stricter than that for the data types alignment specified by
756 *  CPU_ALIGNMENT.  It is common for the partition to follow the same
757 *  alignment requirement as CPU_ALIGNMENT.  If the CPU_ALIGNMENT is strict
758 *  enough for the partition, then this should be set to CPU_ALIGNMENT.
759 *
760 *  NOTE:  This does not have to be a power of 2.  It does have to
761 *         be greater or equal to than CPU_ALIGNMENT.
762 */
763
764#define CPU_PARTITION_ALIGNMENT    (PPC_ALIGNMENT)
765
766/*
767 *  This number corresponds to the byte alignment requirement for the
768 *  stack.  This alignment requirement may be stricter than that for the
769 *  data types alignment specified by CPU_ALIGNMENT.  If the CPU_ALIGNMENT
770 *  is strict enough for the stack, then this should be set to 0.
771 *
772 *  NOTE:  This must be a power of 2 either 0 or greater than CPU_ALIGNMENT.
773 */
774
775#define CPU_STACK_ALIGNMENT        (PPC_STACK_ALIGNMENT)
776
777#ifndef ASM
778/*  The following routine swaps the endian format of an unsigned int.
779 *  It must be static because it is referenced indirectly.
780 *
781 *  This version will work on any processor, but if there is a better
782 *  way for your CPU PLEASE use it.  The most common way to do this is to:
783 *
784 *     swap least significant two bytes with 16-bit rotate
785 *     swap upper and lower 16-bits
786 *     swap most significant two bytes with 16-bit rotate
787 *
788 *  Some CPUs have special instructions which swap a 32-bit quantity in
789 *  a single instruction (e.g. i486).  It is probably best to avoid
790 *  an "endian swapping control bit" in the CPU.  One good reason is
791 *  that interrupts would probably have to be disabled to ensure that
792 *  an interrupt does not try to access the same "chunk" with the wrong
793 *  endian.  Another good reason is that on some CPUs, the endian bit
794 *  endianness for ALL fetches -- both code and data -- so the code
795 *  will be fetched incorrectly.
796 */
797
798static inline uint32_t CPU_swap_u32(
799  uint32_t value
800)
801{
802  uint32_t   swapped;
803
804  __asm__ volatile("rlwimi %0,%1,8,24,31;"
805               "rlwimi %0,%1,24,16,23;"
806               "rlwimi %0,%1,8,8,15;"
807               "rlwimi %0,%1,24,0,7;" :
808               "=&r" ((swapped)) : "r" ((value)));
809
810  return( swapped );
811}
812
813#define CPU_swap_u16( value ) \
814  (((value&0xff) << 8) | ((value >> 8)&0xff))
815
816typedef uint32_t CPU_Counter_ticks;
817
818static inline CPU_Counter_ticks _CPU_Counter_read( void )
819{
820  CPU_Counter_ticks value;
821
822#if defined(__PPC_CPU_E6500__)
823  /* Use Alternate Time Base */
824  __asm__ volatile( "mfspr %0, 526" : "=r" (value) );
825#else
826  __asm__ volatile( "mfspr %0, 268" : "=r" (value) );
827#endif
828
829  return value;
830}
831
832static inline CPU_Counter_ticks _CPU_Counter_difference(
833  CPU_Counter_ticks second,
834  CPU_Counter_ticks first
835)
836{
837  return second - first;
838}
839
840#endif /* ASM */
841
842
843#ifndef ASM
844/* Context handler macros */
845
846/*
847 *  Initialize the context to a state suitable for starting a
848 *  task after a context restore operation.  Generally, this
849 *  involves:
850 *
851 *     - setting a starting address
852 *     - preparing the stack
853 *     - preparing the stack and frame pointers
854 *     - setting the proper interrupt level in the context
855 *     - initializing the floating point context
856 *
857 *  This routine generally does not set any unnecessary register
858 *  in the context.  The state of the "general data" registers is
859 *  undefined at task start time.
860 */
861
862void _CPU_Context_Initialize(
863  Context_Control  *the_context,
864  uint32_t         *stack_base,
865  uint32_t          size,
866  uint32_t          new_level,
867  void             *entry_point,
868  bool              is_fp,
869  void             *tls_area
870);
871
872/*
873 *  This routine is responsible for somehow restarting the currently
874 *  executing task.  If you are lucky, then all that is necessary
875 *  is restoring the context.  Otherwise, there will need to be
876 *  a special assembly routine which does something special in this
877 *  case.  Context_Restore should work most of the time.  It will
878 *  not work if restarting self conflicts with the stack frame
879 *  assumptions of restoring a context.
880 */
881
882#define _CPU_Context_Restart_self( _the_context ) \
883   _CPU_Context_restore( (_the_context) );
884
885/*
886 *  The purpose of this macro is to allow the initial pointer into
887 *  a floating point context area (used to save the floating point
888 *  context) to be at an arbitrary place in the floating point
889 *  context area.
890 *
891 *  This is necessary because some FP units are designed to have
892 *  their context saved as a stack which grows into lower addresses.
893 *  Other FP units can be saved by simply moving registers into offsets
894 *  from the base of the context area.  Finally some FP units provide
895 *  a "dump context" instruction which could fill in from high to low
896 *  or low to high based on the whim of the CPU designers.
897 */
898
899#define _CPU_Context_Fp_start( _base, _offset ) \
900   ( (void *) _Addresses_Add_offset( (_base), (_offset) ) )
901
902/*
903 *  This routine initializes the FP context area passed to it to.
904 *  There are a few standard ways in which to initialize the
905 *  floating point context.  The code included for this macro assumes
906 *  that this is a CPU in which a "initial" FP context was saved into
907 *  _CPU_Null_fp_context and it simply copies it to the destination
908 *  context passed to it.
909 *
910 *  Other models include (1) not doing anything, and (2) putting
911 *  a "null FP status word" in the correct place in the FP context.
912 */
913
914#define _CPU_Context_Initialize_fp( _destination ) \
915  memset( *(_destination), 0, sizeof( **(_destination) ) )
916
917/* end of Context handler macros */
918#endif /* ASM */
919
920#ifndef ASM
921/* Bitfield handler macros */
922
923#define CPU_USE_GENERIC_BITFIELD_CODE FALSE
924
925/*
926 *  This routine sets _output to the bit number of the first bit
927 *  set in _value.  _value is of CPU dependent type Priority_bit_map_Word.
928 *  This type may be either 16 or 32 bits wide although only the 16
929 *  least significant bits will be used.
930 *
931 *  There are a number of variables in using a "find first bit" type
932 *  instruction.
933 *
934 *    (1) What happens when run on a value of zero?
935 *    (2) Bits may be numbered from MSB to LSB or vice-versa.
936 *    (3) The numbering may be zero or one based.
937 *    (4) The "find first bit" instruction may search from MSB or LSB.
938 *
939 *  RTEMS guarantees that (1) will never happen so it is not a concern.
940 *  (2),(3), (4) are handled by the macros _CPU_Priority_mask() and
941 *  _CPU_Priority_Bits_index().  These three form a set of routines
942 *  which must logically operate together.  Bits in the _value are
943 *  set and cleared based on masks built by _CPU_Priority_mask().
944 *  The basic major and minor values calculated by _Priority_Major()
945 *  and _Priority_Minor() are "massaged" by _CPU_Priority_Bits_index()
946 *  to properly range between the values returned by the "find first bit"
947 *  instruction.  This makes it possible for _Priority_Get_highest() to
948 *  calculate the major and directly index into the minor table.
949 *  This mapping is necessary to ensure that 0 (a high priority major/minor)
950 *  is the first bit found.
951 *
952 *  This entire "find first bit" and mapping process depends heavily
953 *  on the manner in which a priority is broken into a major and minor
954 *  components with the major being the 4 MSB of a priority and minor
955 *  the 4 LSB.  Thus (0 << 4) + 0 corresponds to priority 0 -- the highest
956 *  priority.  And (15 << 4) + 14 corresponds to priority 254 -- the next
957 *  to the lowest priority.
958 *
959 *  If your CPU does not have a "find first bit" instruction, then
960 *  there are ways to make do without it.  Here are a handful of ways
961 *  to implement this in software:
962 *
963 *    - a series of 16 bit test instructions
964 *    - a "binary search using if's"
965 *    - _number = 0
966 *      if _value > 0x00ff
967 *        _value >>=8
968 *        _number = 8;
969 *
970 *      if _value > 0x0000f
971 *        _value >=8
972 *        _number += 4
973 *
974 *      _number += bit_set_table[ _value ]
975 *
976 *    where bit_set_table[ 16 ] has values which indicate the first
977 *      bit set
978 */
979
980#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
981  { \
982    __asm__ volatile ("cntlzw %0, %1" : "=r" ((_output)), "=r" ((_value)) : \
983                  "1" ((_value))); \
984  }
985
986/* end of Bitfield handler macros */
987
988/*
989 *  This routine builds the mask which corresponds to the bit fields
990 *  as searched by _CPU_Bitfield_Find_first_bit().  See the discussion
991 *  for that routine.
992 */
993
994#define _CPU_Priority_Mask( _bit_number ) \
995  ( 0x80000000 >> (_bit_number) )
996
997/*
998 *  This routine translates the bit numbers returned by
999 *  _CPU_Bitfield_Find_first_bit() into something suitable for use as
1000 *  a major or minor component of a priority.  See the discussion
1001 *  for that routine.
1002 */
1003
1004#define _CPU_Priority_bits_index( _priority ) \
1005  (_priority)
1006
1007/* end of Priority handler macros */
1008#endif /* ASM */
1009
1010/* functions */
1011
1012#ifndef ASM
1013
1014/*
1015 *  _CPU_Initialize
1016 *
1017 *  This routine performs CPU dependent initialization.
1018 */
1019
1020void _CPU_Initialize(void);
1021
1022/*
1023 *  _CPU_ISR_install_vector
1024 *
1025 *  This routine installs an interrupt vector.
1026 */
1027
1028void _CPU_ISR_install_vector(
1029  uint32_t    vector,
1030  proc_ptr    new_handler,
1031  proc_ptr   *old_handler
1032);
1033
1034/*
1035 *  _CPU_Context_switch
1036 *
1037 *  This routine switches from the run context to the heir context.
1038 */
1039
1040void _CPU_Context_switch(
1041  Context_Control  *run,
1042  Context_Control  *heir
1043);
1044
1045/*
1046 *  _CPU_Context_restore
1047 *
1048 *  This routine is generallu used only to restart self in an
1049 *  efficient manner.  It may simply be a label in _CPU_Context_switch.
1050 *
1051 *  NOTE: May be unnecessary to reload some registers.
1052 */
1053
1054void _CPU_Context_restore(
1055  Context_Control *new_context
1056) RTEMS_NO_RETURN;
1057
1058/*
1059 *  _CPU_Context_save_fp
1060 *
1061 *  This routine saves the floating point context passed to it.
1062 */
1063
1064void _CPU_Context_save_fp(
1065  Context_Control_fp **fp_context_ptr
1066);
1067
1068/*
1069 *  _CPU_Context_restore_fp
1070 *
1071 *  This routine restores the floating point context passed to it.
1072 */
1073
1074void _CPU_Context_restore_fp(
1075  Context_Control_fp **fp_context_ptr
1076);
1077
1078void _CPU_Context_volatile_clobber( uintptr_t pattern );
1079
1080void _CPU_Context_validate( uintptr_t pattern );
1081
1082#ifdef RTEMS_SMP
1083  uint32_t _CPU_SMP_Initialize( void );
1084
1085  bool _CPU_SMP_Start_processor( uint32_t cpu_index );
1086
1087  void _CPU_SMP_Finalize_initialization( uint32_t cpu_count );
1088
1089  void _CPU_SMP_Prepare_start_multitasking( void );
1090
1091  static inline uint32_t _CPU_SMP_Get_current_processor( void )
1092  {
1093    uint32_t pir;
1094
1095    /* Use Book E Processor ID Register (PIR) */
1096    __asm__ volatile (
1097      "mfspr %[pir], 286"
1098      : [pir] "=&r" (pir)
1099    );
1100
1101    return pir;
1102  }
1103
1104  void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
1105
1106  static inline void _CPU_SMP_Processor_event_broadcast( void )
1107  {
1108    __asm__ volatile ( "" : : : "memory" );
1109  }
1110
1111  static inline void _CPU_SMP_Processor_event_receive( void )
1112  {
1113    __asm__ volatile ( "" : : : "memory" );
1114  }
1115#endif
1116
1117typedef struct {
1118  uint32_t EXC_SRR0;
1119  uint32_t EXC_SRR1;
1120  uint32_t _EXC_number;
1121  uint32_t EXC_CR;
1122  uint32_t EXC_CTR;
1123  uint32_t EXC_XER;
1124  uint32_t EXC_LR;
1125  #ifdef __SPE__
1126    uint32_t EXC_SPEFSCR;
1127    uint64_t EXC_ACC;
1128  #endif
1129  PPC_GPR_TYPE GPR0;
1130  PPC_GPR_TYPE GPR1;
1131  PPC_GPR_TYPE GPR2;
1132  PPC_GPR_TYPE GPR3;
1133  PPC_GPR_TYPE GPR4;
1134  PPC_GPR_TYPE GPR5;
1135  PPC_GPR_TYPE GPR6;
1136  PPC_GPR_TYPE GPR7;
1137  PPC_GPR_TYPE GPR8;
1138  PPC_GPR_TYPE GPR9;
1139  PPC_GPR_TYPE GPR10;
1140  PPC_GPR_TYPE GPR11;
1141  PPC_GPR_TYPE GPR12;
1142  PPC_GPR_TYPE GPR13;
1143  PPC_GPR_TYPE GPR14;
1144  PPC_GPR_TYPE GPR15;
1145  PPC_GPR_TYPE GPR16;
1146  PPC_GPR_TYPE GPR17;
1147  PPC_GPR_TYPE GPR18;
1148  PPC_GPR_TYPE GPR19;
1149  PPC_GPR_TYPE GPR20;
1150  PPC_GPR_TYPE GPR21;
1151  PPC_GPR_TYPE GPR22;
1152  PPC_GPR_TYPE GPR23;
1153  PPC_GPR_TYPE GPR24;
1154  PPC_GPR_TYPE GPR25;
1155  PPC_GPR_TYPE GPR26;
1156  PPC_GPR_TYPE GPR27;
1157  PPC_GPR_TYPE GPR28;
1158  PPC_GPR_TYPE GPR29;
1159  PPC_GPR_TYPE GPR30;
1160  PPC_GPR_TYPE GPR31;
1161  #if defined(PPC_MULTILIB_ALTIVEC) || defined(PPC_MULTILIB_FPU)
1162    uint32_t reserved_for_alignment;
1163  #endif
1164  #ifdef PPC_MULTILIB_ALTIVEC
1165    uint32_t VRSAVE;
1166
1167    /* This field must take stvewx/lvewx requirements into account */
1168    uint32_t VSCR;
1169
1170    uint8_t V0[16];
1171    uint8_t V1[16];
1172    uint8_t V2[16];
1173    uint8_t V3[16];
1174    uint8_t V4[16];
1175    uint8_t V5[16];
1176    uint8_t V6[16];
1177    uint8_t V7[16];
1178    uint8_t V8[16];
1179    uint8_t V9[16];
1180    uint8_t V10[16];
1181    uint8_t V11[16];
1182    uint8_t V12[16];
1183    uint8_t V13[16];
1184    uint8_t V14[16];
1185    uint8_t V15[16];
1186    uint8_t V16[16];
1187    uint8_t V17[16];
1188    uint8_t V18[16];
1189    uint8_t V19[16];
1190    uint8_t V20[16];
1191    uint8_t V21[16];
1192    uint8_t V22[16];
1193    uint8_t V23[16];
1194    uint8_t V24[16];
1195    uint8_t V25[16];
1196    uint8_t V26[16];
1197    uint8_t V27[16];
1198    uint8_t V28[16];
1199    uint8_t V29[16];
1200    uint8_t V30[16];
1201    uint8_t V31[16];
1202  #endif
1203  #ifdef PPC_MULTILIB_FPU
1204    double F0;
1205    double F1;
1206    double F2;
1207    double F3;
1208    double F4;
1209    double F5;
1210    double F6;
1211    double F7;
1212    double F8;
1213    double F9;
1214    double F10;
1215    double F11;
1216    double F12;
1217    double F13;
1218    double F14;
1219    double F15;
1220    double F16;
1221    double F17;
1222    double F18;
1223    double F19;
1224    double F20;
1225    double F21;
1226    double F22;
1227    double F23;
1228    double F24;
1229    double F25;
1230    double F26;
1231    double F27;
1232    double F28;
1233    double F29;
1234    double F30;
1235    double F31;
1236    uint64_t FPSCR;
1237  #endif
1238} CPU_Exception_frame;
1239
1240void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
1241
1242/*
1243 * _CPU_Initialize_altivec()
1244 *
1245 * Global altivec-related initialization.
1246 */
1247void
1248_CPU_Initialize_altivec(void);
1249
1250/*
1251 * _CPU_Context_switch_altivec
1252 *
1253 * This routine switches the altivec contexts passed to it.
1254 */
1255
1256void
1257_CPU_Context_switch_altivec(
1258  ppc_context *from,
1259  ppc_context *to
1260);
1261
1262/*
1263 * _CPU_Context_restore_altivec
1264 *
1265 * This routine restores the altivec context passed to it.
1266 */
1267
1268void
1269_CPU_Context_restore_altivec(
1270  ppc_context *ctxt
1271);
1272
1273/*
1274 * _CPU_Context_initialize_altivec
1275 *
1276 * This routine initializes the altivec context passed to it.
1277 */
1278
1279void
1280_CPU_Context_initialize_altivec(
1281  ppc_context *ctxt
1282);
1283
1284void _CPU_Fatal_error(
1285  uint32_t   _error
1286);
1287
1288#endif /* ASM */
1289
1290#ifdef __cplusplus
1291}
1292#endif
1293
1294#endif /* _RTEMS_SCORE_CPU_H */
Note: See TracBrowser for help on using the repository browser.