40#ifndef _RTEMS_SCORE_CPU_H
41#define _RTEMS_SCORE_CPU_H
63#define CPU_SIMPLE_VECTORED_INTERRUPTS TRUE
71#define CPU_ISR_PASSES_FRAME_POINTER FALSE
82#if ( M68K_HAS_FPU == 1 ) || ( M68K_HAS_EMAC == 1 )
83 #define CPU_HARDWARE_FP TRUE
84 #define CPU_SOFTWARE_FP FALSE
86 #define CPU_HARDWARE_FP FALSE
87 #if defined( __GNUC__ )
88 #define CPU_SOFTWARE_FP TRUE
90 #define CPU_SOFTWARE_FP FALSE
101#define CPU_ALL_TASKS_ARE_FP FALSE
102#define CPU_IDLE_TASK_IS_FP FALSE
103#define CPU_USE_DEFERRED_FP_SWITCH TRUE
104#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
106#define CPU_STACK_GROWS_UP FALSE
109#define CPU_CACHE_LINE_BYTES 16
111#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES )
113#define CPU_MAXIMUM_PROCESSORS 32
115#if ( CPU_HARDWARE_FP == TRUE ) && !defined( __mcoldfire__ )
116 #if defined( __mc68060__ )
117 #define M68K_FP_STATE_SIZE 16
119 #define M68K_FP_STATE_SIZE 216
145 #if defined( __mcoldfire__ ) && ( M68K_HAS_FPU == 1 )
148 void *thread_pointer;
151#define _CPU_Context_Get_SP( _context ) \
152 (uintptr_t)(_context)->a7_msp
158#if ( CPU_SOFTWARE_FP == TRUE )
166 uint16_t _exception_bits;
167 uint16_t _trap_enable_bits;
168 uint16_t _sticky_bits;
169 uint16_t _rounding_mode;
171 uint16_t _last_operation;
182 #define _CPU_Context_Initialize_fp( _fp_area ) \
184 Context_Control_fp *_fp; \
185 _fp = *(Context_Control_fp **)_fp_area; \
186 _fp->_exception_bits = 0; \
187 _fp->_trap_enable_bits = 0; \
188 _fp->_sticky_bits = 0; \
189 _fp->_rounding_mode = 0; \
191 _fp->_last_operation = 0; \
192 _fp->_operand1.df = 0; \
193 _fp->_operand2.df = 0; \
197#if ( CPU_HARDWARE_FP == TRUE )
198 #if defined( __mcoldfire__ )
202 #if ( M68K_HAS_FPU == 1 )
208 extern uint32_t _CPU_cacr_shadow;
218 uint32_t emac_accext01;
219 uint32_t emac_accext23;
221 #if ( M68K_HAS_FPU == 1 )
222 uint16_t fp_state_format;
223 uint16_t fp_state_fpcr;
225 uint32_t fp_state_fpsr;
244 #define _CPU_Context_Initialize_fp( _fp_area ) \
245 memset( *(_fp_area), 0, sizeof( Context_Control_fp ) )
258 uint8_t fp_save_area [M68K_FP_STATE_SIZE + 112];
266 #define _CPU_Context_Initialize_fp( _fp_area ) \
268 uint32_t *_fp_context = (uint32_t *) \
269 ( (uintptr_t) *( _fp_area ) + CPU_CONTEXT_FP_SIZE - 4 ); \
270 *(--(_fp_context)) = 0; \
271 *(_fp_area) = (void *)(_fp_context); \
291 uint32_t d0, d1, d2, d3, d4, d5, d6, d7;
292 uint32_t a0, a1, a2, a3, a4, a5, a6, a7;
304#define CPU_MODES_INTERRUPT_MASK 0x00000007
310#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp )
316#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 1024
322#define CPU_INTERRUPT_NUMBER_OF_VECTORS 256
323#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER (CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
330#define CPU_PROVIDES_ISR_IS_IN_PROGRESS FALSE
336#define CPU_STACK_MINIMUM_SIZE M68K_CPU_STACK_MINIMUM_SIZE
341#define CPU_PRIORITY_MAXIMUM M68K_CPU_PRIORITY_MAXIMUM
343#define CPU_SIZEOF_POINTER 4
349#define CPU_ALIGNMENT 4
350#define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT
357#define CPU_STACK_ALIGNMENT CPU_ALIGNMENT
359#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
375#define _CPU_ISR_Disable( _level ) \
376 m68k_disable_interrupts( _level )
378#define _CPU_ISR_Enable( _level ) \
379 m68k_enable_interrupts( _level )
381#define _CPU_ISR_Flash( _level ) \
382 m68k_flash_interrupts( _level )
384static inline bool _CPU_ISR_Is_enabled( uint32_t level )
386 return ( level & 0x0700 ) == 0;
389#define _CPU_ISR_Set_level( _newlevel ) \
390 m68k_set_interrupt_level( _newlevel )
406void _CPU_Context_Initialize(
408 void *stack_area_begin,
409 size_t stack_area_size,
411 void (*entry_point)(
void ),
420#define CPU_USE_LIBC_INIT_FINI_ARRAY FALSE
436#define CPU_USE_GENERIC_BITFIELD_CODE FALSE
438#if ( M68K_HAS_BFFFO != 1 )
442extern const unsigned char _CPU_m68k_BFFFO_table[256];
445#if ( M68K_HAS_BFFFO == 1 )
447#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
448 __asm__ volatile( "bfffo (%1),#0,#16,%0" : "=d" (_output) : "a" (&_value));
450#elif ( __mcfisaaplus__ )
452#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
464#if ( defined(__mcoldfire__) )
466#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
475 " move.b (%3,%1),%0\n" \
477 "1: move.w %2,%1\n" \
478 " move.b (%3,%1),%0\n" \
480 "0: and.l #0xff,%0\n" \
481 : "=&d" ((_output)), "=&d" ((dumby)) \
482 : "d" ((_value)), "ao" ((_CPU_m68k_BFFFO_table)) \
485#elif ( M68K_HAS_EXTB_L == 1 )
486#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
490 __asm__ volatile ( " move.w %2,%1\n" \
493 " move.b (%3,%1.w),%0\n" \
496 "1: moveq.l #8,%0\n" \
497 " add.b (%3,%2.w),%0\n" \
499 : "=&d" ((_output)), "=&d" ((dumby)) \
500 : "d" ((_value)), "ao" ((_CPU_m68k_BFFFO_table)) \
504#define _CPU_Bitfield_Find_first_bit( _value, _output ) \
508 __asm__ volatile ( " move.w %2,%1\n" \
511 " move.b (%3,%1.w),%0\n" \
512 " and.l #0x000000ff,%0\n"\
514 "1: moveq.l #8,%0\n" \
515 " add.b (%3,%2.w),%0\n" \
517 : "=&d" ((_output)), "=&d" ((dumby)) \
518 : "d" ((_value)), "ao" ((_CPU_m68k_BFFFO_table)) \
537#define _CPU_Priority_Mask( _bit_number ) \
538 ( 0x8000 >> (_bit_number) )
540#define _CPU_Priority_bits_index( _priority ) \
555typedef void ( *CPU_ISR_raw_handler )( void );
559 CPU_ISR_raw_handler new_handler,
560 CPU_ISR_raw_handler *old_handler
563typedef void ( *CPU_ISR_handler )( uint32_t );
567 CPU_ISR_handler new_handler,
568 CPU_ISR_handler *old_handler
615typedef uint32_t CPU_Counter_ticks;
621#if (M68K_HAS_FPSP_PACKAGE == 1)
647void M68KFPSPInstallExceptionHandlers (
void);
649extern int (*_FPSP_install_raw_handler)(
651 CPU_ISR_raw_handler new_handler,
652 CPU_ISR_raw_handler *old_handler
This header file provides basic definitions used by the API and the implementation.
void _CPU_ISR_install_raw_handler(uint32_t vector, CPU_ISR_raw_handler new_handler, CPU_ISR_raw_handler *old_handler)
SPARC specific raw ISR installer.
Definition: cpu.c:120
#define RTEMS_NO_RETURN
Tells the compiler in a function declaration that this function does not return.
Definition: basedefs.h:386
uint32_t _CPU_ISR_Get_level(void)
Returns the interrupt level of the executing thread.
Definition: cpu.c:167
void * _CPU_Thread_Idle_body(uintptr_t ignored)
Definition: m68kidle.c:39
void _CPU_Initialize(void)
CPU initialization.
Definition: cpu.c:47
uintptr_t CPU_Uint32ptr
Definition: cpu.h:611
void _CPU_Exception_frame_print(const CPU_Exception_frame *frame)
Prints the exception frame via printk().
Definition: vectorexceptions.c:64
uint32_t _CPU_Counter_frequency(void)
Gets the current CPU counter frequency in Hz.
Definition: system-clocks.c:125
void _CPU_Context_switch(Context_Control *run, Context_Control *heir)
CPU switch context.
Definition: cpu_asm.c:110
CPU_Counter_ticks _CPU_Counter_read(void)
Gets the current CPU counter value.
Definition: system-clocks.c:130
void _CPU_ISR_install_vector(uint32_t vector, CPU_ISR_handler hdl, CPU_ISR_handler *oldHdl)
SPARC specific RTEMS ISR installer.
Definition: idt.c:108
Motorola M68K CPU Dependent Source.
#define _CPU_Context_restore_fp(_fp_context_ptr)
Nothing to do due to the synchronous or lazy floating point switch.
Definition: cpu.h:901
#define _CPU_Context_save_fp(_fp_context_ptr)
Nothing to do due to the synchronous or lazy floating point switch.
Definition: cpu.h:895
The set of registers that specifies the complete processor state.
Definition: cpu.h:500
uint32_t pc
This member contains the PC value.
Definition: cpu.h:290
Interrupt stack frame (ISF).
Definition: cpuimpl.h:64
SPARC basic context.
Definition: cpu.h:213
Thread register context.
Definition: cpu.h:173