19 #ifndef _RTEMS_SCORE_CPU_H 20 #define _RTEMS_SCORE_CPU_H 31 #if defined(RTEMS_PARAVIRT) 32 #include <rtems/score/paravirt.h> 59 #define CPU_SIMPLE_VECTORED_INTERRUPTS FALSE 67 #define CPU_ISR_PASSES_FRAME_POINTER FALSE 75 #define CPU_HARDWARE_FP TRUE 76 #define CPU_SOFTWARE_FP FALSE 78 #define CPU_ALL_TASKS_ARE_FP TRUE 79 #define CPU_IDLE_TASK_IS_FP TRUE 80 #define CPU_USE_DEFERRED_FP_SWITCH FALSE 83 #if ( I386_HAS_FPU == 1 ) 84 #define CPU_HARDWARE_FP TRUE 86 #define CPU_HARDWARE_FP FALSE 88 #define CPU_SOFTWARE_FP FALSE 90 #define CPU_ALL_TASKS_ARE_FP FALSE 91 #define CPU_IDLE_TASK_IS_FP FALSE 92 #if defined(RTEMS_SMP) 93 #define CPU_USE_DEFERRED_FP_SWITCH FALSE 95 #define CPU_USE_DEFERRED_FP_SWITCH TRUE 99 #define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE 101 #define CPU_STACK_GROWS_UP FALSE 104 #define CPU_CACHE_LINE_BYTES 64 106 #define CPU_STRUCTURE_ALIGNMENT 108 #define CPU_MAXIMUM_PROCESSORS 32 110 #define I386_CONTEXT_CONTROL_EFLAGS_OFFSET 0 111 #define I386_CONTEXT_CONTROL_ESP_OFFSET 4 112 #define I386_CONTEXT_CONTROL_EBP_OFFSET 8 113 #define I386_CONTEXT_CONTROL_EBX_OFFSET 12 114 #define I386_CONTEXT_CONTROL_ESI_OFFSET 16 115 #define I386_CONTEXT_CONTROL_EDI_OFFSET 20 116 #define I386_CONTEXT_CONTROL_GS_0_OFFSET 24 117 #define I386_CONTEXT_CONTROL_GS_1_OFFSET 28 120 #define I386_CONTEXT_CONTROL_IS_EXECUTING_OFFSET 32 138 segment_descriptors gs;
140 volatile bool is_executing;
144 #define _CPU_Context_Get_SP( _context ) \ 148 static inline bool _CPU_Context_Get_is_executing(
152 return context->is_executing;
155 static inline void _CPU_Context_Set_is_executing(
160 context->is_executing = is_executing;
193 uint8_t fp_save_area[108];
254 uint8_t xmmregs[8][16];
262 extern cpuExcHandlerType _currentExcHandler;
263 extern void rtems_exception_init_mngt(
void);
267 #error "i386 targets do not support SMP.\ 268 See: https://devel.rtems.org/ticket/3335" 274 #define CPU_INTERRUPT_FRAME_SIZE 4 283 uint32_t todo_replace_with_apt_registers;
287 I386_EXCEPTION_DIVIDE_BY_ZERO = 0,
288 I386_EXCEPTION_DEBUG = 1,
289 I386_EXCEPTION_NMI = 2,
290 I386_EXCEPTION_BREAKPOINT = 3,
291 I386_EXCEPTION_OVERFLOW = 4,
292 I386_EXCEPTION_BOUND = 5,
293 I386_EXCEPTION_ILLEGAL_INSTR = 6,
294 I386_EXCEPTION_MATH_COPROC_UNAVAIL = 7,
295 I386_EXCEPTION_DOUBLE_FAULT = 8,
296 I386_EXCEPTION_I386_COPROC_SEG_ERR = 9,
297 I386_EXCEPTION_INVALID_TSS = 10,
298 I386_EXCEPTION_SEGMENT_NOT_PRESENT = 11,
299 I386_EXCEPTION_STACK_SEGMENT_FAULT = 12,
300 I386_EXCEPTION_GENERAL_PROT_ERR = 13,
301 I386_EXCEPTION_PAGE_FAULT = 14,
302 I386_EXCEPTION_INTEL_RES15 = 15,
303 I386_EXCEPTION_FLOAT_ERROR = 16,
304 I386_EXCEPTION_ALIGN_CHECK = 17,
305 I386_EXCEPTION_MACHINE_CHECK = 18,
306 I386_EXCEPTION_ENTER_RDBG = 50
308 } Intel_symbolic_exception_name;
317 #define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp ) 332 #define CPU_MODES_INTERRUPT_MASK 0x00000001 338 #define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 1024 345 #define CPU_PROVIDES_ISR_IS_IN_PROGRESS FALSE 351 #define CPU_STACK_MINIMUM_SIZE 4096 353 #define CPU_SIZEOF_POINTER 4 359 #define CPU_ALIGNMENT 4 360 #define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT 371 #define CPU_STACK_ALIGNMENT 16 373 #define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES 389 #if !defined(I386_DISABLE_INLINE_ISR_DISABLE_ENABLE) 390 #define _CPU_ISR_Disable( _level ) i386_disable_interrupts( _level ) 392 #define _CPU_ISR_Enable( _level ) i386_enable_interrupts( _level ) 394 #define _CPU_ISR_Flash( _level ) i386_flash_interrupts( _level ) 396 #define _CPU_ISR_Set_level( _new_level ) \ 398 if ( _new_level ) __asm__ volatile ( "cli" ); \ 399 else __asm__ volatile ( "sti" ); \ 402 #define _CPU_ISR_Disable( _level ) _level = i386_disable_interrupts() 403 #define _CPU_ISR_Enable( _level ) i386_enable_interrupts( _level ) 404 #define _CPU_ISR_Flash( _level ) i386_flash_interrupts( _level ) 405 #define _CPU_ISR_Set_level( _new_level ) i386_set_interrupt_level(_new_level) 410 return ( level & EFLAGS_INTR_ENABLE ) != 0;
420 #define _CPU_Interrupt_stack_setup( _lo, _hi ) \ 422 _hi = (void*)(((uintptr_t)(_hi) - 4) & ~ (CPU_STACK_ALIGNMENT - 1)); \ 439 #define CPU_EFLAGS_INTERRUPTS_ON 0x00003202 440 #define CPU_EFLAGS_INTERRUPTS_OFF 0x00003002 446 void *stack_area_begin,
447 size_t stack_area_size,
449 void (*entry_point)(
void ),
454 #define _CPU_Context_Restart_self( _the_context ) \ 455 _CPU_Context_restore( (_the_context) ); 457 #if defined(RTEMS_SMP) 458 uint32_t _CPU_SMP_Initialize(
void );
460 bool _CPU_SMP_Start_processor( uint32_t cpu_index );
462 void _CPU_SMP_Finalize_initialization( uint32_t cpu_count );
464 void _CPU_SMP_Prepare_start_multitasking(
void );
466 uint32_t _CPU_SMP_Get_current_processor(
void );
468 void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
470 static inline void _CPU_SMP_Processor_event_broadcast(
void )
472 __asm__ volatile (
"" : : :
"memory" );
475 static inline void _CPU_SMP_Processor_event_receive(
void )
477 __asm__ volatile (
"" : : :
"memory" );
481 #define _CPU_Context_Initialize_fp( _fp_area ) \ 483 memcpy( *_fp_area, &_CPU_Null_fp_context, CPU_CONTEXT_FP_SIZE ); \ 509 #define CPU_USE_GENERIC_BITFIELD_CODE FALSE 511 #define _CPU_Bitfield_Find_first_bit( _value, _output ) \ 513 uint16_t __value_in_register = ( _value ); \ 514 uint16_t __output = 0; \ 515 __asm__ volatile ( "bsfw %0,%1 " \ 516 : "=r" ( __value_in_register ), "=r" ( __output ) \ 517 : "0" ( __value_in_register ), "1" ( __output ) \ 519 ( _output ) = __output; \ 534 #define _CPU_Priority_Mask( _bit_number ) \ 535 ( 1 << (_bit_number) ) 537 #define _CPU_Priority_bits_index( _priority ) \ 551 typedef void ( *CPU_ISR_handler )( void );
555 CPU_ISR_handler new_handler,
556 CPU_ISR_handler *old_handler
590 #define _CPU_Context_save_fp(fp_context_pp) \ 592 __asm__ __volatile__( \ 594 :"=m"((*(fp_context_pp))->fpucw) \ 596 __asm__ __volatile__( \ 598 :"=m"((*(fp_context_pp))->mxcsr) \ 613 #define _CPU_Context_restore_fp(fp_context_pp) \ 615 __asm__ __volatile__( \ 617 ::"m"((*(fp_context_pp))->fpucw) \ 620 __builtin_ia32_ldmxcsr(_Thread_Executing->fp_context->mxcsr); \ 629 #define _CPU_Context_Initialization_at_thread_begin() \ 631 __asm__ __volatile__( \ 635 :"st","st(1)","st(2)","st(3)", \ 636 "st(4)","st(5)","st(6)","st(7)", \ 639 if ( _Thread_Executing->fp_context ) { \ 640 _CPU_Context_restore_fp(&_Thread_Executing->fp_context); \ 653 static inline CPU_Counter_ticks _CPU_Counter_difference(
654 CPU_Counter_ticks second,
655 CPU_Counter_ticks first
658 return second - first;
void _CPU_Exception_frame_print(const CPU_Exception_frame *frame)
Prints the exception frame via printk().
Definition: vectorexceptions.c:45
CPU_Counter_ticks _CPU_Counter_read(void)
Returns the current CPU counter value.
Definition: system-clocks.c:117
Thread register context.
Definition: cpu.h:196
void * _CPU_Thread_Idle_body(uintptr_t ignored)
Definition: idle-mcf5272.c:20
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:65
void _CPU_Context_restore_fp(Context_Control_fp **fp_context_ptr)
Definition: cpu.c:207
Interrupt stack frame (ISF).
Definition: cpu.h:306
void _CPU_Context_Initialize(Context_Control *context, void *stack_area_begin, size_t stack_area_size, uint32_t new_level, void(*entry_point)(void), bool is_fp, void *tls_area)
Initializes the CPU context.
Definition: epiphany-context-initialize.c:40
void _CPU_Context_switch(Context_Control *run, Context_Control *heir)
CPU switch context.
Definition: cpu_asm.c:91
Intel I386 CPU Dependent Source.
typedef __attribute__
Disable IRQ Interrupts.
Definition: cmsis_gcc.h:69
void _CPU_Initialize(void)
CPU initialization.
Definition: cpu.c:45
SPARC basic context.
Definition: cpu.h:242
register struct Per_CPU_Control *_SPARC_Per_CPU_current __asm__("g6")
The pointer to the current per-CPU control is available via register g6.
uint32_t CPU_Counter_ticks
Unsigned integer type for CPU counter values.
Definition: cpu.h:1202
#define RTEMS_NO_RETURN
Definition: basedefs.h:101
uint32_t _CPU_ISR_Get_level(void)
Definition: cpu.c:88
Definition: sse_test.c:126
unsigned context
Definition: tlb.h:108
bool _CPU_ISR_Is_enabled(uint32_t level)
Returns true if interrupts are enabled in the specified ISR level, otherwise returns false...
Definition: cpu.h:381
void _CPU_Context_restore(Context_Control *new_context) RTEMS_NO_RETURN
Definition: cpu_asm.c:111
uintptr_t CPU_Uint32ptr
Definition: cpu.h:668
uint32_t _CPU_Counter_frequency(void)
Returns the current CPU counter frequency in Hz.
Definition: system-clocks.c:112
void _CPU_Fatal_halt(uint32_t source, uint32_t error) RTEMS_NO_RETURN
Definition: bsp_fatal_halt.c:12
RTEMS_INLINE_ROUTINE void _CPU_ISR_install_vector(uint32_t vector, CPU_ISR_handler new_handler, CPU_ISR_handler *old_handler)
SPARC specific RTEMS ISR installer.
Definition: cpu.h:605
void _CPU_Context_save_fp(Context_Control_fp **fp_context_ptr)
Definition: cpu.c:198
The set of registers that specifies the complete processor state.
Definition: cpu.h:635
Context_Control_fp _CPU_Null_fp_context
Definition: cpu.c:45