35 #ifndef _RTEMS_SCORE_CPU_H 36 #define _RTEMS_SCORE_CPU_H 43 #include <rtems/score/cpu_asm.h> 44 #include <rtems/score/x86_64.h> 46 #define CPU_SIMPLE_VECTORED_INTERRUPTS FALSE 47 #define CPU_ISR_PASSES_FRAME_POINTER FALSE 48 #define CPU_HARDWARE_FP FALSE 49 #define CPU_SOFTWARE_FP FALSE 50 #define CPU_ALL_TASKS_ARE_FP FALSE 51 #define CPU_IDLE_TASK_IS_FP FALSE 52 #define CPU_USE_DEFERRED_FP_SWITCH FALSE 53 #define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE 54 #define CPU_STACK_GROWS_UP FALSE 56 #define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED(64) 57 #define CPU_CACHE_LINE_BYTES 64 58 #define CPU_MODES_INTERRUPT_MASK 0x00000001 59 #define CPU_MAXIMUM_PROCESSORS 32 61 #define CPU_EFLAGS_INTERRUPTS_ON 0x00003202 62 #define CPU_EFLAGS_INTERRUPTS_OFF 0x00003002 84 volatile bool is_executing;
88 #define _CPU_Context_Get_SP( _context ) \ 130 #define CPU_INTERRUPT_FRAME_SIZE 72 143 #define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 0 144 #define CPU_PROVIDES_ISR_IS_IN_PROGRESS FALSE 145 #define CPU_STACK_MINIMUM_SIZE (1024*4) 146 #define CPU_SIZEOF_POINTER 8 147 #define CPU_ALIGNMENT 8 148 #define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT 149 #define CPU_STACK_ALIGNMENT 16 150 #define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES 158 #define _CPU_Initialize_vectors() 160 #define _CPU_ISR_Enable(_level) \ 162 amd64_enable_interrupts(); \ 167 #define _CPU_ISR_Disable(_level) \ 169 amd64_enable_interrupts(); \ 174 #define _CPU_ISR_Flash(_level) \ 176 amd64_enable_interrupts(); \ 177 amd64_disable_interrupts(); \ 184 return (level & EFLAGS_INTR_ENABLE) != 0;
190 amd64_disable_interrupts();
193 amd64_enable_interrupts();
206 uint32_t level = (rflags & EFLAGS_INTR_ENABLE) ? 0 : 1;
213 #define _CPU_Context_Destroy( _the_thread, _the_context ) \ 219 void *stack_area_begin,
220 size_t stack_area_size,
222 void (*entry_point)(
void ),
227 #define _CPU_Context_Restart_self( _the_context ) \ 228 _CPU_Context_restore( (_the_context) ); 230 #define _CPU_Context_Initialize_fp( _destination ) \ 232 *(*(_destination)) = _CPU_Null_fp_context; \ 239 #define _CPU_Fatal_halt( _source, _error ) \ 247 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE 249 #if (CPU_USE_GENERIC_BITFIELD_CODE == FALSE) 250 #define _CPU_Bitfield_Find_first_bit( _value, _output ) \ 258 #if (CPU_USE_GENERIC_BITFIELD_CODE == FALSE) 259 #define _CPU_Priority_Mask( _bit_number ) \ 260 ( 1 << (_bit_number) ) 263 #if (CPU_USE_GENERIC_BITFIELD_CODE == FALSE) 264 #define _CPU_Priority_bits_index( _priority ) \ 286 uint32_t processor_state_register;
287 uint32_t integer_registers [1];
288 double float_registers [1];
293 static inline uint32_t CPU_swap_u32(
297 uint32_t byte1, byte2, byte3, byte4, swapped;
299 byte4 = (value >> 24) & 0xff;
300 byte3 = (value >> 16) & 0xff;
301 byte2 = (value >> 8) & 0xff;
302 byte1 = value & 0xff;
304 swapped = (byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4;
308 #define CPU_swap_u16( value ) \ 309 (((value&0xff) << 8) | ((value >> 8)&0xff)) 318 static inline CPU_Counter_ticks _CPU_Counter_difference(
319 CPU_Counter_ticks second,
320 CPU_Counter_ticks first
323 return second - first;
328 uint32_t _CPU_SMP_Initialize(
void );
330 bool _CPU_SMP_Start_processor( uint32_t cpu_index );
332 void _CPU_SMP_Finalize_initialization( uint32_t cpu_count );
334 void _CPU_SMP_Prepare_start_multitasking(
void );
336 static inline uint32_t _CPU_SMP_Get_current_processor(
void )
341 void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
343 static inline void _CPU_SMP_Processor_event_broadcast(
void )
345 __asm__ volatile (
"" : : :
"memory" );
348 static inline void _CPU_SMP_Processor_event_receive(
void )
350 __asm__ volatile (
"" : : :
"memory" );
353 static inline bool _CPU_Context_Get_is_executing(
359 static inline void _CPU_Context_Set_is_executing(
void _CPU_Exception_frame_print(const CPU_Exception_frame *frame)
Prints the exception frame via printk().
Definition: vectorexceptions.c:45
void _CPU_ISR_Set_level(uint32_t level)
Sets the hardware interrupt level by the level value.
Definition: cpu.c:57
CPU_Counter_ticks _CPU_Counter_read(void)
Returns the current CPU counter value.
Definition: system-clocks.c:117
Thread register context.
Definition: cpu.h:194
void * _CPU_Thread_Idle_body(uintptr_t ignored)
Definition: idle-mcf5272.c:20
Interrupt stack frame (ISF).
Definition: cpu.h:191
#define RTEMS_NO_RETURN
Definition: basedefs.h:102
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
void _CPU_Initialize(void)
CPU initialization.
Definition: cpu.c:45
register struct Per_CPU_Control *_SPARC_Per_CPU_current __asm__("g6")
The pointer to the current per-CPU control is available via register g6.
uint64_t rax
Definition: cpu.h:103
uint32_t CPU_Counter_ticks
Unsigned integer type for CPU counter values.
Definition: cpu.h:1210
uint32_t _CPU_ISR_Get_level(void)
Definition: cpu.c:88
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:375
void _CPU_Context_restore(Context_Control *new_context) RTEMS_NO_RETURN
Definition: cpu_asm.c:111
uintptr_t CPU_Uint32ptr
Definition: cpu.h:662
uint32_t _CPU_Counter_frequency(void)
Returns the current CPU counter frequency in Hz.
Definition: system-clocks.c:112
The set of registers that specifies the complete processor state.
Definition: cpu.h:629
uint64_t rbx
Definition: cpu.h:73
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
#define CPU_INTERRUPT_FRAME_SIZE
Definition: cpuimpl.h:78