source: rtems/cpukit/score/cpu/m68k/rtems/score/cpu.h @ 10fd4aac

4.115
Last change on this file since 10fd4aac was 10fd4aac, checked in by Sebastian Huber <sebastian.huber@…>, on 08/02/13 at 11:54:08

score/cpu: Add CPU_Per_CPU_control

Add CPU port specific per-CPU control.

  • Property mode set to 100644
File size: 20.9 KB
Line 
1/**
2 * @file
3 *
4 * @brief Motorola M68K CPU Dependent Source
5 *
6 * This include file contains information pertaining to the Motorola
7 * m68xxx processor family.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2011.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19#ifndef _RTEMS_SCORE_CPU_H
20#define _RTEMS_SCORE_CPU_H
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include <rtems/score/types.h>
27#include <rtems/score/m68k.h>
28
29/* conditional compilation parameters */
30
31#define CPU_INLINE_ENABLE_DISPATCH       TRUE
32#define CPU_UNROLL_ENQUEUE_PRIORITY      FALSE
33
34/*
35 *  Does the CPU follow the simple vectored interrupt model?
36 *
37 *  If TRUE, then RTEMS allocates the vector table it internally manages.
38 *  If FALSE, then the BSP is assumed to allocate and manage the vector
39 *  table
40 *
41 *  M68K Specific Information:
42 *
43 *  XXX document implementation including references if appropriate
44 */
45#define CPU_SIMPLE_VECTORED_INTERRUPTS TRUE
46
47/*
48 *  Use the m68k's hardware interrupt stack support and have the
49 *  interrupt manager allocate the memory for it.
50 */
51
52#if ( M68K_HAS_SEPARATE_STACKS == 1)
53#define CPU_HAS_SOFTWARE_INTERRUPT_STACK 0
54#define CPU_HAS_HARDWARE_INTERRUPT_STACK 1
55#else
56#define CPU_HAS_SOFTWARE_INTERRUPT_STACK 1
57#define CPU_HAS_HARDWARE_INTERRUPT_STACK 0
58#endif
59#define CPU_ALLOCATE_INTERRUPT_STACK     1
60
61/*
62 *  Does the RTEMS invoke the user's ISR with the vector number and
63 *  a pointer to the saved interrupt frame (1) or just the vector
64 *  number (0)?
65 */
66
67#define CPU_ISR_PASSES_FRAME_POINTER 0
68
69/*
70 *  Some family members have no FP, some have an FPU such as the
71 *  MC68881/MC68882 for the MC68020, others have it built in (MC68030, 040).
72 *
73 *  NOTE:  If on a CPU without hardware FP, then one can use software
74 *         emulation.  The gcc software FP emulation code has data which
75 *         must be contexted switched on a per task basis.
76 */
77
78#if ( M68K_HAS_FPU == 1 ) || ( M68K_HAS_EMAC == 1 )
79  #define CPU_HARDWARE_FP TRUE
80  #define CPU_SOFTWARE_FP FALSE
81#else
82  #define CPU_HARDWARE_FP FALSE
83  #if defined( __GNUC__ )
84    #define CPU_SOFTWARE_FP TRUE
85  #else
86    #define CPU_SOFTWARE_FP FALSE
87  #endif
88#endif
89
90/*
91 *  All tasks are not by default floating point tasks on this CPU.
92 *  The IDLE task does not have a floating point context on this CPU.
93 *  It is safe to use the deferred floating point context switch
94 *  algorithm on this CPU.
95 */
96
97#define CPU_ALL_TASKS_ARE_FP             FALSE
98#define CPU_IDLE_TASK_IS_FP              FALSE
99#define CPU_USE_DEFERRED_FP_SWITCH       TRUE
100
101#define CPU_PROVIDES_IDLE_THREAD_BODY    TRUE
102#define CPU_STACK_GROWS_UP               FALSE
103#define CPU_STRUCTURE_ALIGNMENT          __attribute__ ((aligned (4)))
104
105#define CPU_TIMESTAMP_USE_INT64_INLINE TRUE
106
107/*
108 *  Define what is required to specify how the network to host conversion
109 *  routines are handled.
110 */
111
112#define CPU_BIG_ENDIAN                           TRUE
113#define CPU_LITTLE_ENDIAN                        FALSE
114
115#define CPU_PER_CPU_CONTROL_SIZE 0
116
117#if ( CPU_HARDWARE_FP == TRUE ) && !defined( __mcoldfire__ )
118  #if defined( __mc68060__ )
119    #define M68K_FP_STATE_SIZE 16
120  #else
121    #define M68K_FP_STATE_SIZE 216
122  #endif
123#endif
124
125#ifndef ASM
126
127/* structures */
128
129typedef struct {
130  /* There is no CPU specific per-CPU state */
131} CPU_Per_CPU_control;
132
133/*
134 *  Basic integer context for the m68k family.
135 */
136
137typedef struct {
138  uint32_t    sr;                /* (sr) status register */
139  uint32_t    d2;                /* (d2) data register 2 */
140  uint32_t    d3;                /* (d3) data register 3 */
141  uint32_t    d4;                /* (d4) data register 4 */
142  uint32_t    d5;                /* (d5) data register 5 */
143  uint32_t    d6;                /* (d6) data register 6 */
144  uint32_t    d7;                /* (d7) data register 7 */
145  void       *a2;                /* (a2) address register 2 */
146  void       *a3;                /* (a3) address register 3 */
147  void       *a4;                /* (a4) address register 4 */
148  void       *a5;                /* (a5) address register 5 */
149  void       *a6;                /* (a6) address register 6 */
150  void       *a7_msp;            /* (a7) master stack pointer */
151  #if defined( __mcoldfire__ ) && ( M68K_HAS_FPU == 1 )
152    uint8_t   fpu_dis;
153  #endif
154} Context_Control;
155
156#define _CPU_Context_Get_SP( _context ) \
157  (_context)->a7_msp
158
159/*
160 *  Floating point context areas and support routines
161 */
162
163#if ( CPU_SOFTWARE_FP == TRUE )
164  /*
165   *  This is the same as gcc's view of the software FP condition code
166   *  register _fpCCR.  The implementation of the emulation code is
167   *  in the gcc-VERSION/config/m68k directory.  This structure is
168   *  correct as of gcc 2.7.2.2.
169   */
170  typedef struct {
171    uint16_t _exception_bits;
172    uint16_t _trap_enable_bits;
173    uint16_t _sticky_bits;
174    uint16_t _rounding_mode;
175    uint16_t _format;
176    uint16_t _last_operation;
177    union {
178      float sf;
179      double df;
180    } _operand1;
181    union {
182      float sf;
183      double df;
184    } _operand2;
185  } Context_Control_fp;
186
187  /*
188   *  This software FP implementation is only for GCC.
189   */
190  #define _CPU_Context_Fp_start( _base, _offset ) \
191     ((void *) _Addresses_Add_offset( (_base), (_offset) ) )
192
193  #define _CPU_Context_Initialize_fp( _fp_area ) \
194     { \
195       Context_Control_fp *_fp; \
196       _fp = *(Context_Control_fp **)_fp_area; \
197       _fp->_exception_bits = 0; \
198       _fp->_trap_enable_bits = 0; \
199       _fp->_sticky_bits = 0; \
200       _fp->_rounding_mode = 0;  /* ROUND_TO_NEAREST */ \
201       _fp->_format = 0;         /* NIL */ \
202       _fp->_last_operation = 0; /* NOOP */ \
203       _fp->_operand1.df = 0; \
204       _fp->_operand2.df = 0; \
205     }
206#endif
207
208#if ( CPU_HARDWARE_FP == TRUE )
209  #if defined( __mcoldfire__ )
210    /* We need memset() to initialize the FP context */
211    #include <string.h>
212
213    #if ( M68K_HAS_FPU == 1 )
214      /*
215       * The Cache Control Register (CACR) has write-only access.  It is also
216       * used to enable and disable the FPU.  We need to maintain a copy of
217       * this register to allow per thread values.
218       */
219      extern uint32_t _CPU_cacr_shadow;
220    #endif
221
222    /* We assume that each ColdFire core with a FPU has also an EMAC unit */
223    typedef struct {
224      uint32_t emac_macsr;
225      uint32_t emac_acc0;
226      uint32_t emac_acc1;
227      uint32_t emac_acc2;
228      uint32_t emac_acc3;
229      uint32_t emac_accext01;
230      uint32_t emac_accext23;
231      uint32_t emac_mask;
232      #if ( M68K_HAS_FPU == 1 )
233        uint16_t fp_state_format;
234        uint16_t fp_state_fpcr;
235        double fp_state_op;
236        uint32_t fp_state_fpsr;
237
238        /*
239         * We need to save the FP Instruction Address Register (FPIAR), because
240         * a context switch can occur within a FP exception before the handler
241         * was able to save this register.
242         */
243        uint32_t fp_fpiar;
244
245        double fp_data [8];
246      #endif
247    } Context_Control_fp;
248
249    #define _CPU_Context_Fp_start( _base, _offset ) \
250      ((void *) _Addresses_Add_offset( (_base), (_offset) ))
251
252    /*
253     * The reset value for all context relevant registers except the FP data
254     * registers is zero.  The reset value of the FP data register is NAN.  The
255     * restore of the reset FP state will reset the FP data registers, so the
256     * initial value of them can be arbitrary here.
257     */
258    #define _CPU_Context_Initialize_fp( _fp_area ) \
259      memset( *(_fp_area), 0, sizeof( Context_Control_fp ) )
260  #else
261    /*
262     *  FP context save area for the M68881/M68882 and 68060 numeric
263     *  coprocessors.
264     */
265    typedef struct {
266      /*
267       * M68K_FP_STATE_SIZE bytes for FSAVE/FRESTORE
268       * 96 bytes for FMOVEM FP0-7
269       * 12 bytes for FMOVEM CREGS
270       * 4 bytes for non-null flag
271       */
272      uint8_t fp_save_area [M68K_FP_STATE_SIZE + 112];
273    } Context_Control_fp;
274
275    #define _CPU_Context_Fp_start( _base, _offset ) \
276       ( \
277         (void *) _Addresses_Add_offset( \
278            (_base), \
279            (_offset) + CPU_CONTEXT_FP_SIZE - 4 \
280         ) \
281       )
282
283    #define _CPU_Context_Initialize_fp( _fp_area ) \
284       { \
285         uint32_t   *_fp_context = (uint32_t *)*(_fp_area); \
286         *(--(_fp_context)) = 0; \
287         *(_fp_area) = (void *)(_fp_context); \
288       }
289  #endif
290#endif
291
292/*
293 *  The following structures define the set of information saved
294 *  on the current stack by RTEMS upon receipt of each exc/interrupt.
295 *  These are not used by m68k handlers.
296 *  The exception frame is for rdbg.
297 */
298
299typedef struct {
300  uint32_t   vecnum; /* vector number */
301} CPU_Interrupt_frame;
302
303typedef struct {
304  uint32_t   vecnum; /* vector number */
305  uint32_t   sr; /* status register */
306  uint32_t   pc; /* program counter */
307  uint32_t   d0, d1, d2, d3, d4, d5, d6, d7;
308  uint32_t   a0, a1, a2, a3, a4, a5, a6, a7;
309} CPU_Exception_frame;
310
311/* variables */
312
313extern void*                     _VBR;
314
315#if ( M68K_HAS_VBR == 0 )
316
317/*
318 * Table of ISR handler entries that resides in RAM. The FORMAT/ID is
319 * pushed onto the stack. This is not is the same order as VBR processors.
320 * The ISR handler takes the format and uses it for dispatching the user
321 * handler.
322 *
323 * FIXME : should be moved to below CPU_INTERRUPT_NUMBER_OF_VECTORS
324 *
325 */
326
327typedef struct {
328  uint16_t   move_a7;            /* move #FORMAT_ID,%a7@- */
329  uint16_t   format_id;
330  uint16_t   jmp;                /* jmp  _ISR_Handlers */
331  uint32_t   isr_handler;
332} _CPU_ISR_handler_entry;
333
334#define M68K_MOVE_A7 0x3F3C
335#define M68K_JMP     0x4EF9
336
337      /* points to jsr-exception-table in targets wo/ VBR register */
338SCORE_EXTERN _CPU_ISR_handler_entry _CPU_ISR_jump_table[256];
339
340#endif /* M68K_HAS_VBR */
341
342#endif /* ASM */
343
344/* constants */
345
346/*
347 *  This defines the number of levels and the mask used to pick those
348 *  bits out of a thread mode.
349 */
350
351#define CPU_MODES_INTERRUPT_LEVEL  0x00000007 /* interrupt level in mode */
352#define CPU_MODES_INTERRUPT_MASK   0x00000007 /* interrupt level in mode */
353
354/*
355 *  context size area for floating point
356 */
357
358#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp )
359
360/*
361 *  extra stack required by the MPCI receive server thread
362 */
363
364#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 1024
365
366/*
367 *  m68k family supports 256 distinct vectors.
368 */
369
370#define CPU_INTERRUPT_NUMBER_OF_VECTORS      256
371#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER  (CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
372
373/*
374 *  This is defined if the port has a special way to report the ISR nesting
375 *  level.  Most ports maintain the variable _ISR_Nest_level.
376 */
377
378#define CPU_PROVIDES_ISR_IS_IN_PROGRESS FALSE
379
380/*
381 *  Minimum size of a thread's stack.
382 */
383
384#define CPU_STACK_MINIMUM_SIZE           M68K_CPU_STACK_MINIMUM_SIZE
385
386/*
387 *  Maximum priority of a thread. Note based from 0 which is the idle task.
388 */
389#define CPU_PRIORITY_MAXIMUM             M68K_CPU_PRIORITY_MAXIMUM
390
391#define CPU_SIZEOF_POINTER 4
392
393/*
394 *  m68k is pretty tolerant of alignment.  Just put things on 4 byte boundaries.
395 */
396
397#define CPU_ALIGNMENT                    4
398#define CPU_HEAP_ALIGNMENT               CPU_ALIGNMENT
399#define CPU_PARTITION_ALIGNMENT          CPU_ALIGNMENT
400
401/*
402 *  On m68k thread stacks require no further alignment after allocation
403 *  from the Workspace.
404 */
405
406#define CPU_STACK_ALIGNMENT        0
407
408#ifndef ASM
409
410/* macros */
411
412/*
413 *  ISR handler macros
414 *
415 *  These macros perform the following functions:
416 *     + initialize the RTEMS vector table
417 *     + disable all maskable CPU interrupts
418 *     + restore previous interrupt level (enable)
419 *     + temporarily restore interrupts (flash)
420 *     + set a particular level
421 */
422
423#define _CPU_Initialize_vectors()
424
425#define _CPU_ISR_Disable( _level ) \
426  m68k_disable_interrupts( _level )
427
428#define _CPU_ISR_Enable( _level ) \
429  m68k_enable_interrupts( _level )
430
431#define _CPU_ISR_Flash( _level ) \
432  m68k_flash_interrupts( _level )
433
434#define _CPU_ISR_Set_level( _newlevel ) \
435   m68k_set_interrupt_level( _newlevel )
436
437uint32_t   _CPU_ISR_Get_level( void );
438
439/* end of ISR handler macros */
440
441/*
442 *  Context handler macros
443 *
444 *  These macros perform the following functions:
445 *     + initialize a context area
446 *     + restart the current thread
447 *     + calculate the initial pointer into a FP context area
448 *     + initialize an FP context area
449 */
450
451#if (defined(__mcoldfire__) && ( M68K_HAS_FPU == 1 ))
452#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
453                                 _isr, _entry_point, _is_fp ) \
454   do { \
455     uint32_t   _stack; \
456     \
457     (_the_context)->sr      = 0x3000 | ((_isr) << 8); \
458     _stack                  = (uint32_t)(_stack_base) + (_size) - 4; \
459     (_the_context)->a7_msp  = (void *)_stack; \
460     *(void **)_stack        = (void *)(_entry_point); \
461     (_the_context)->fpu_dis = (_is_fp == TRUE) ? 0x00 : 0x10;          \
462   } while ( 0 )
463#else
464#define _CPU_Context_Initialize( _the_context, _stack_base, _size,      \
465                                 _isr, _entry_point, _is_fp )           \
466   do {                                                                 \
467     uint32_t   _stack;                                                 \
468                                                                        \
469     (_the_context)->sr      = 0x3000 | ((_isr) << 8);                  \
470     _stack                  = (uint32_t)(_stack_base) + (_size) - 4;   \
471     (_the_context)->a7_msp  = (void *)_stack;                          \
472     *(void **)_stack        = (void *)(_entry_point);                  \
473   } while ( 0 )
474#endif
475
476/* end of Context handler macros */
477
478/*
479 *  _CPU_Thread_Idle_body
480 *
481 *  This routine is the CPU dependent IDLE thread body.
482 *
483 *  NOTE:  It need only be provided if CPU_PROVIDES_IDLE_THREAD_BODY
484 *         is TRUE.
485 */
486
487void *_CPU_Thread_Idle_body( uintptr_t ignored );
488
489/*
490 *  Fatal Error manager macros
491 *
492 *  These macros perform the following functions:
493 *    + disable interrupts and halt the CPU
494 */
495
496#if ( defined(__mcoldfire__) )
497#define _CPU_Fatal_halt( _error ) \
498  { __asm__ volatile( "move.w %%sr,%%d0\n\t" \
499                  "or.l %2,%%d0\n\t" \
500                  "move.w %%d0,%%sr\n\t" \
501                  "move.l %1,%%d0\n\t" \
502                  "move.l #0xDEADBEEF,%%d1\n\t" \
503                  "halt" \
504                  : "=g" (_error) \
505                  : "0" (_error), "d"(0x0700) \
506                  : "d0", "d1" ); \
507  }
508#else
509#define _CPU_Fatal_halt( _error ) \
510  { __asm__ volatile( "movl  %0,%%d0; " \
511                  "orw   #0x0700,%%sr; " \
512                  "stop  #0x2700" : "=d" ((_error)) : "0" ((_error)) ); \
513  }
514#endif
515
516/* end of Fatal Error manager macros */
517
518/*
519 *  Bitfield handler macros
520 *
521 *  These macros perform the following functions:
522 *     + scan for the highest numbered (MSB) set in a 16 bit bitfield
523 *
524 *  NOTE:
525 *
526 *    It appears that on the M68020 bitfield are always 32 bits wide
527 *    when in a register.  This code forces the bitfield to be in
528 *    memory (it really always is anyway). This allows us to
529 *    have a real 16 bit wide bitfield which operates "correctly."
530 */
531
532#define CPU_USE_GENERIC_BITFIELD_CODE FALSE
533#define CPU_USE_GENERIC_BITFIELD_DATA FALSE
534
535#if ( M68K_HAS_BFFFO != 1 )
536/*
537 *  Lookup table for BFFFO simulation
538 */
539extern const unsigned char _CPU_m68k_BFFFO_table[256];
540#endif
541
542#if ( M68K_HAS_BFFFO == 1 )
543
544#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
545  __asm__ volatile( "bfffo (%1),#0,#16,%0" : "=d" (_output) : "a" (&_value));
546
547#elif ( __mcfisaaplus__ )
548  /* This is simplified by the fact that RTEMS never calls it with _value=0 */
549#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
550    __asm__ volatile ( \
551       "   swap     %0\n"        \
552       "   ff1.l    %0\n"        \
553       : "=d" ((_output))        \
554       : "0" ((_value))          \
555       : "cc" ) ;
556
557#else
558/* duplicates BFFFO results for 16 bits (i.e., 15-(_priority) in
559   _CPU_Priority_bits_index is not needed), handles the 0 case, and
560   does not molest _value -- jsg */
561#if ( defined(__mcoldfire__) )
562
563#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
564  { \
565    register int dumby; \
566    \
567    __asm__ volatile ( \
568       "   clr.l   %1\n"         \
569       "   move.w  %2,%1\n"      \
570       "   lsr.l   #8,%1\n"      \
571       "   beq.s   1f\n"         \
572       "   move.b  (%3,%1),%0\n" \
573       "   bra.s   0f\n"         \
574       "1: move.w  %2,%1\n"      \
575       "   move.b  (%3,%1),%0\n" \
576       "   addq.l  #8,%0\n"      \
577       "0: and.l   #0xff,%0\n"   \
578       : "=&d" ((_output)), "=&d" ((dumby))    \
579       : "d" ((_value)), "ao" ((_CPU_m68k_BFFFO_table)) \
580       : "cc" ) ; \
581  }
582#elif ( M68K_HAS_EXTB_L == 1 )
583#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
584  { \
585    register int dumby; \
586    \
587    __asm__ volatile ( "   move.w  %2,%1\n"        \
588       "   lsr.w   #8,%1\n"        \
589       "   beq.s   1f\n"           \
590       "   move.b  (%3,%1.w),%0\n" \
591       "   extb.l  %0\n"           \
592       "   bra.s   0f\n"           \
593       "1: moveq.l #8,%0\n"        \
594       "   add.b   (%3,%2.w),%0\n" \
595       "0:\n"                      \
596       : "=&d" ((_output)), "=&d" ((dumby)) \
597       : "d" ((_value)), "ao" ((_CPU_m68k_BFFFO_table)) \
598       : "cc" ) ; \
599  }
600#else
601#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
602  { \
603    register int dumby; \
604    \
605    __asm__ volatile ( "   move.w  %2,%1\n"        \
606       "   lsr.w   #8,%1\n"        \
607       "   beq.s   1f\n"           \
608       "   move.b  (%3,%1.w),%0\n" \
609       "   and.l   #0x000000ff,%0\n"\
610       "   bra.s   0f\n"           \
611       "1: moveq.l #8,%0\n"        \
612       "   add.b   (%3,%2.w),%0\n" \
613       "0:\n"                      \
614       : "=&d" ((_output)), "=&d" ((dumby)) \
615       : "d" ((_value)), "ao" ((_CPU_m68k_BFFFO_table)) \
616       : "cc" ) ; \
617  }
618#endif
619
620#endif
621
622/* end of Bitfield handler macros */
623
624/*
625 *  Priority handler macros
626 *
627 *  These macros perform the following functions:
628 *    + return a mask with the bit for this major/minor portion of
629 *      of thread priority set.
630 *    + translate the bit number returned by "Bitfield_find_first_bit"
631 *      into an index into the thread ready chain bit maps
632 */
633
634#define _CPU_Priority_Mask( _bit_number ) \
635  ( 0x8000 >> (_bit_number) )
636
637#define _CPU_Priority_bits_index( _priority ) \
638  (_priority)
639
640/* end of Priority handler macros */
641
642/* functions */
643
644/*
645 *  _CPU_Initialize
646 *
647 *  This routine performs CPU dependent initialization.
648 */
649
650void _CPU_Initialize(void);
651
652/*
653 *  _CPU_ISR_install_raw_handler
654 *
655 *  This routine installs a "raw" interrupt handler directly into the
656 *  processor's vector table.
657 */
658
659void _CPU_ISR_install_raw_handler(
660  uint32_t    vector,
661  proc_ptr    new_handler,
662  proc_ptr   *old_handler
663);
664
665/*
666 *  _CPU_ISR_install_vector
667 *
668 *  This routine installs an interrupt vector.
669 */
670
671void _CPU_ISR_install_vector(
672  uint32_t         vector,
673  proc_ptr         new_handler,
674  proc_ptr        *old_handler
675);
676
677/*
678 *  _CPU_Install_interrupt_stack
679 *
680 *  This routine installs the hardware interrupt stack pointer.
681 */
682
683void _CPU_Install_interrupt_stack( void );
684
685/*
686 *  _CPU_Context_switch
687 *
688 *  This routine switches from the run context to the heir context.
689 */
690
691void _CPU_Context_switch(
692  Context_Control  *run,
693  Context_Control  *heir
694);
695
696void _CPU_Context_Restart_self(
697  Context_Control  *the_context
698);
699
700/*
701 *  _CPU_Context_save_fp
702 *
703 *  This routine saves the floating point context passed to it.
704 */
705
706void _CPU_Context_save_fp(
707  Context_Control_fp **fp_context_ptr
708);
709
710/*
711 *  _CPU_Context_restore_fp
712 *
713 *  This routine restores the floating point context passed to it.
714 */
715
716void _CPU_Context_restore_fp(
717  Context_Control_fp **fp_context_ptr
718);
719
720static inline void _CPU_Context_volatile_clobber( uintptr_t pattern )
721{
722  /* TODO */
723}
724
725static inline void _CPU_Context_validate( uintptr_t pattern )
726{
727  while (1) {
728    /* TODO */
729  }
730}
731
732/**
733 *  This method prints the CPU exception frame.
734 *
735 *  @param[in] frame points to the frame to be printed
736 */
737void _CPU_Exception_frame_print(
738  const CPU_Exception_frame *frame
739);
740
741#if (M68K_HAS_FPSP_PACKAGE == 1)
742/*
743 *  Hooks for the Floating Point Support Package (FPSP) provided by Motorola
744 *
745 *  NOTES:
746 *
747 *  Motorola 68k family CPU's before the 68040 used a coprocessor
748 *  (68881 or 68882) to handle floating point.  The 68040 has internal
749 *  floating point support -- but *not* the complete support provided by
750 *  the 68881 or 68882.  The leftover functions are taken care of by the
751 *  M68040 Floating Point Support Package.  Quoting from the MC68040
752 *  Microprocessors User's Manual, Section 9, Floating-Point Unit (MC68040):
753 *
754 *    "When used with the M68040FPSP, the MC68040 FPU is fully
755 *    compliant with IEEE floating-point standards."
756 *
757 *  M68KFPSPInstallExceptionHandlers is in libcpu/m68k/MODEL/fpsp and
758 *  is invoked early in the application code to ensure that proper FP
759 *  behavior is installed.  This is not left to the BSP to call, since
760 *  this would force all applications using that BSP to use FPSP which
761 *  is not necessarily desirable.
762 *
763 *  There is a similar package for the 68060 but RTEMS does not yet
764 *  support the 68060.
765 */
766
767void M68KFPSPInstallExceptionHandlers (void);
768
769SCORE_EXTERN int (*_FPSP_install_raw_handler)(
770  uint32_t   vector,
771  proc_ptr new_handler,
772  proc_ptr *old_handler
773);
774
775#endif
776
777
778#endif
779
780#ifdef __cplusplus
781}
782#endif
783
784#endif
Note: See TracBrowser for help on using the repository browser.