19 #ifndef _RTEMS_SCORE_CPU_H 20 #define _RTEMS_SCORE_CPU_H 63 #if SPARC_HAS_FPU == 1 64 #if defined(RTEMS_SMP) 65 #define SPARC_USE_SYNCHRONOUS_FP_SWITCH 67 #define SPARC_USE_LAZY_FP_SWITCH 81 #define CPU_SIMPLE_VECTORED_INTERRUPTS TRUE 91 #define CPU_ISR_PASSES_FRAME_POINTER FALSE 101 #if ( SPARC_HAS_FPU == 1 ) && !defined(SPARC_USE_SYNCHRONOUS_FP_SWITCH) 102 #define CPU_HARDWARE_FP TRUE 104 #define CPU_HARDWARE_FP FALSE 111 #define CPU_SOFTWARE_FP FALSE 121 #define CPU_ALL_TASKS_ARE_FP FALSE 132 #define CPU_IDLE_TASK_IS_FP FALSE 134 #define CPU_USE_DEFERRED_FP_SWITCH FALSE 136 #define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE 147 #define CPU_STACK_GROWS_UP FALSE 150 #define CPU_CACHE_LINE_BYTES 64 152 #define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) 161 #define CPU_MODES_INTERRUPT_MASK 0x0000000F 229 #define CPU_STACK_FRAME_L0_OFFSET 0x00 231 #define CPU_STACK_FRAME_L1_OFFSET 0x04 233 #define CPU_STACK_FRAME_L2_OFFSET 0x08 235 #define CPU_STACK_FRAME_L3_OFFSET 0x0c 237 #define CPU_STACK_FRAME_L4_OFFSET 0x10 239 #define CPU_STACK_FRAME_L5_OFFSET 0x14 241 #define CPU_STACK_FRAME_L6_OFFSET 0x18 243 #define CPU_STACK_FRAME_L7_OFFSET 0x1c 245 #define CPU_STACK_FRAME_I0_OFFSET 0x20 247 #define CPU_STACK_FRAME_I1_OFFSET 0x24 249 #define CPU_STACK_FRAME_I2_OFFSET 0x28 251 #define CPU_STACK_FRAME_I3_OFFSET 0x2c 253 #define CPU_STACK_FRAME_I4_OFFSET 0x30 255 #define CPU_STACK_FRAME_I5_OFFSET 0x34 257 #define CPU_STACK_FRAME_I6_FP_OFFSET 0x38 259 #define CPU_STACK_FRAME_I7_OFFSET 0x3c 261 #define CPU_STRUCTURE_RETURN_ADDRESS_OFFSET 0x40 263 #define CPU_STACK_FRAME_SAVED_ARG0_OFFSET 0x44 265 #define CPU_STACK_FRAME_SAVED_ARG1_OFFSET 0x48 267 #define CPU_STACK_FRAME_SAVED_ARG2_OFFSET 0x4c 269 #define CPU_STACK_FRAME_SAVED_ARG3_OFFSET 0x50 271 #define CPU_STACK_FRAME_SAVED_ARG4_OFFSET 0x54 273 #define CPU_STACK_FRAME_SAVED_ARG5_OFFSET 0x58 275 #define CPU_STACK_FRAME_PAD0_OFFSET 0x5c 277 #define CPU_MAXIMUM_PROCESSORS 32 379 #if defined(SPARC_USE_LAZY_FP_SWITCH) 383 #if defined(RTEMS_SMP) 384 volatile uint32_t is_executing;
393 #define _CPU_Context_Get_SP( _context ) \ 397 static inline bool _CPU_Context_Get_is_executing(
401 return context->is_executing;
404 static inline void _CPU_Context_Set_is_executing(
409 context->is_executing = is_executing;
420 #define G5_OFFSET 0x00 422 #define G7_OFFSET 0x04 425 #define L0_OFFSET 0x08 427 #define L1_OFFSET 0x0C 429 #define L2_OFFSET 0x10 431 #define L3_OFFSET 0x14 433 #define L4_OFFSET 0x18 435 #define L5_OFFSET 0x1C 437 #define L6_OFFSET 0x20 439 #define L7_OFFSET 0x24 442 #define I0_OFFSET 0x28 444 #define I1_OFFSET 0x2C 446 #define I2_OFFSET 0x30 448 #define I3_OFFSET 0x34 450 #define I4_OFFSET 0x38 452 #define I5_OFFSET 0x3C 454 #define I6_FP_OFFSET 0x40 456 #define I7_OFFSET 0x44 459 #define O6_SP_OFFSET 0x48 461 #define O7_OFFSET 0x4C 464 #define PSR_OFFSET 0x50 466 #define ISR_DISPATCH_DISABLE_STACK_OFFSET 0x54 468 #if defined(RTEMS_SMP) 469 #define SPARC_CONTEXT_CONTROL_IS_EXECUTING_OFFSET 0x58 522 #define FO_F1_OFFSET 0x00 524 #define F2_F3_OFFSET 0x08 526 #define F4_F5_OFFSET 0x10 528 #define F6_F7_OFFSET 0x18 530 #define F8_F9_OFFSET 0x20 532 #define F1O_F11_OFFSET 0x28 534 #define F12_F13_OFFSET 0x30 536 #define F14_F15_OFFSET 0x38 538 #define F16_F17_OFFSET 0x40 540 #define F18_F19_OFFSET 0x48 542 #define F2O_F21_OFFSET 0x50 544 #define F22_F23_OFFSET 0x58 546 #define F24_F25_OFFSET 0x60 548 #define F26_F27_OFFSET 0x68 550 #define F28_F29_OFFSET 0x70 552 #define F3O_F31_OFFSET 0x78 554 #define FSR_OFFSET 0x80 557 #define CONTEXT_CONTROL_FP_SIZE 0x84 652 #define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp ) 661 #define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 1024 686 #define CPU_INTERRUPT_NUMBER_OF_VECTORS 256 692 #define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER 511 698 #define SPARC_SYNCHRONOUS_TRAP_BIT_MASK 0x100 703 #define SPARC_ASYNCHRONOUS_TRAP( _trap ) (_trap) 708 #define SPARC_SYNCHRONOUS_TRAP( _trap ) ((_trap) + 256 ) 713 #define SPARC_REAL_TRAP_NUMBER( _trap ) ((_trap) % 256) 719 #define CPU_PROVIDES_ISR_IS_IN_PROGRESS FALSE 729 #define CPU_STACK_MINIMUM_SIZE (1024*4) 734 #define CPU_SIZEOF_POINTER 4 742 #define CPU_ALIGNMENT 8 755 #define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT 761 #define CPU_STACK_ALIGNMENT CPU_ALIGNMENT 763 #define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES 774 #define _CPU_Initialize_vectors() 780 #define _CPU_ISR_Disable( _level ) \ 781 (_level) = sparc_disable_interrupts() 788 #define _CPU_ISR_Enable( _level ) \ 789 sparc_enable_interrupts( _level ) 797 #define _CPU_ISR_Flash( _level ) \ 798 sparc_flash_interrupts( _level ) 800 #define _CPU_ISR_Is_enabled( _isr_cookie ) \ 801 sparc_interrupt_is_enabled( _isr_cookie ) 813 #define _CPU_ISR_Set_level( _newlevel ) \ 814 sparc_enable_interrupts( _newlevel << 8) 852 uint32_t *stack_base,
873 #define _CPU_Context_Initialization_at_thread_begin() \ 875 __asm__ volatile ("set _Thread_Handler,%%i7\n"::); \ 886 #define _CPU_Context_Restart_self( _the_context ) \ 887 _CPU_Context_restore( (_the_context) ); 892 #define _CPU_Context_Initialize_fp( _destination ) \ 898 #define _CPU_Context_save_fp( _fp_context_ptr ) \ 904 #define _CPU_Context_restore_fp( _fp_context_ptr ) \ 920 #define CPU_USE_LIBC_INIT_FINI_ARRAY FALSE 924 #if ( SPARC_HAS_BITSCAN == 0 ) 929 #define CPU_USE_GENERIC_BITFIELD_CODE TRUE 931 #error "scan instruction not currently supported by RTEMS!!" 945 typedef void ( *CPU_ISR_raw_handler )( void );
959 CPU_ISR_raw_handler new_handler,
960 CPU_ISR_raw_handler *old_handler
963 typedef void ( *CPU_ISR_handler )( uint32_t );
977 CPU_ISR_handler new_handler,
978 CPU_ISR_handler *old_handler
981 void *_CPU_Thread_Idle_body( uintptr_t ignored );
1008 #if defined(RTEMS_SMP) 1009 uint32_t _CPU_SMP_Initialize(
void );
1011 bool _CPU_SMP_Start_processor( uint32_t cpu_index );
1013 void _CPU_SMP_Finalize_initialization( uint32_t cpu_count );
1015 void _CPU_SMP_Prepare_start_multitasking(
void );
1017 #if defined(__leon__) && !defined(RTEMS_PARAVIRT) 1018 static inline uint32_t _CPU_SMP_Get_current_processor(
void )
1020 return _LEON3_Get_current_processor();
1023 uint32_t _CPU_SMP_Get_current_processor(
void );
1026 void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
1028 static inline void _CPU_SMP_Processor_event_broadcast(
void )
1030 __asm__
volatile (
"" : : :
"memory" );
1033 static inline void _CPU_SMP_Processor_event_receive(
void )
1035 __asm__
volatile (
"" : : :
"memory" );
1039 #if defined(SPARC_USE_LAZY_FP_SWITCH) 1040 #define _CPU_Context_Destroy( _the_thread, _the_context ) \ 1042 Per_CPU_Control *cpu_self = _Per_CPU_Get(); \ 1043 Thread_Control *_fp_owner = cpu_self->cpu_per_cpu.fp_owner; \ 1044 if ( _fp_owner == _the_thread ) { \ 1045 cpu_self->cpu_per_cpu.fp_owner = NULL; \ 1081 uint32_t byte1, byte2, byte3, byte4, swapped;
1083 byte4 = (value >> 24) & 0xff;
1084 byte3 = (value >> 16) & 0xff;
1085 byte2 = (value >> 8) & 0xff;
1086 byte1 = value & 0xff;
1088 swapped = (byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4;
1099 #define CPU_swap_u16( value ) \ 1100 (((value&0xff) << 8) | ((value >> 8)&0xff)) 1102 typedef uint32_t CPU_Counter_ticks;
1104 uint32_t _CPU_Counter_frequency(
void );
1106 typedef CPU_Counter_ticks ( *SPARC_Counter_read )( void );
1116 SPARC_Counter_read read_isr_disabled;
1117 SPARC_Counter_read read;
1118 volatile const CPU_Counter_ticks *counter_register;
1119 volatile const uint32_t *pending_register;
1120 uint32_t pending_mask;
1121 CPU_Counter_ticks accumulated;
1122 CPU_Counter_ticks interval;
1127 static inline CPU_Counter_ticks _CPU_Counter_read(
void )
1129 return ( *_SPARC_Counter.read )();
1132 static inline CPU_Counter_ticks _CPU_Counter_difference(
1133 CPU_Counter_ticks second,
1134 CPU_Counter_ticks first
1137 return second - first;
void * structure_return_address
uint32_t isr_dispatch_disable
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.
void _CPU_Context_Initialize(Context_Control *the_context, uint32_t *stack_base, uint32_t size, uint32_t new_level, void *entry_point, bool is_fp, void *tls_area)
uint32_t reserved_for_alignment
Interrupt stack frame (ISF).
uint32_t sethi_of_handler_to_l4
void _CPU_Context_restore(Context_Control *new_context) RTEMS_NO_RETURN
SPARC specific context restore.
uint32_t _CPU_ISR_Get_level(void)
Obtain the current interrupt disable level.
void _CPU_Context_switch(Context_Control *run, Context_Control *heir)
SPARC specific context switch.
#define RTEMS_NO_RETURN
Tells the compiler in a function declaration that this function does not return.
SPARC_Minimum_stack_frame Stack_frame
static uint32_t CPU_swap_u32(uint32_t value)
SPARC specific method to endian swap an uint32_t.
const CPU_Trap_table_entry _CPU_Trap_slot_template
uint32_t jmp_to_low_of_handler_plus_l4
Information Required to Build RTEMS for a Particular Member of the SPARC Family.
void _CPU_Fatal_halt(uint32_t source, uint32_t error) RTEMS_NO_RETURN
void _CPU_Initialize(void)
SPARC specific initialization.
This header file provides basic definitions used by the API and the implementation.
#define SPARC_PSR_PIL_MASK
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
void _CPU_ISR_install_vector(uint32_t vector, CPU_ISR_handler new_handler, CPU_ISR_handler *old_handler)
SPARC specific RTEMS ISR installer.