cpukit/aarch64: Add Per_CPU_Control accessor

Add an architecture-specific implementation for
_CPU_Get_current_per_CPU_control() to reduce overhead for getting the
current CPU's Per_CPU_Control structure.
This commit is contained in:
Kinsey Moore
2022-01-03 16:45:26 -06:00
committed by Joel Sherrill
parent 74d3abc1db
commit 3e3393ac1e

View File

@@ -125,6 +125,29 @@ typedef struct {
uint64_t register_fpcr;
} CPU_Interrupt_frame;
#ifdef RTEMS_SMP
static inline
struct Per_CPU_Control *_AARCH64_Get_current_per_CPU_control( void )
{
struct Per_CPU_Control *cpu_self;
uint64_t value;
__asm__ volatile (
"mrs %0, TPIDR_EL1" : "=&r" ( value ) : : "memory"
);
/* Use EL1 Thread ID Register (TPIDR_EL1) */
cpu_self = (struct Per_CPU_Control *)(uintptr_t)value;
return cpu_self;
}
#define _CPU_Get_current_per_CPU_control() \
_AARCH64_Get_current_per_CPU_control()
#endif /* RTEMS_SMP */
void _CPU_Context_volatile_clobber( uintptr_t pattern );
void _CPU_Context_validate( uintptr_t pattern );