From ad563618ca49816e8db755cb44a101dacc270a2a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 13 Feb 2014 13:00:00 +0100 Subject: sparc: Add LEON3_ASR17_PROCESSOR_INDEX_SHIFT Add _LEON3_Get_current_processor(). --- cpukit/score/cpu/sparc/rtems/score/sparc.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'cpukit') diff --git a/cpukit/score/cpu/sparc/rtems/score/sparc.h b/cpukit/score/cpu/sparc/rtems/score/sparc.h index 0c00ac4ac9..4539e7d6df 100644 --- a/cpukit/score/cpu/sparc/rtems/score/sparc.h +++ b/cpukit/score/cpu/sparc/rtems/score/sparc.h @@ -147,6 +147,8 @@ extern "C" { /** This constant is the starting bit position of the IMPL in the PSR. */ #define SPARC_PSR_IMPL_BIT_POSITION 28 /* bits 28 - 31 */ +#define LEON3_ASR17_PROCESSOR_INDEX_SHIFT 28 + #ifndef ASM /** @@ -292,6 +294,18 @@ void sparc_enable_interrupts(uint32_t psr); (_psr_level & SPARC_PSR_PIL_MASK) >> SPARC_PSR_PIL_BIT_POSITION; \ } while ( 0 ) +static inline uint32_t _LEON3_Get_current_processor( void ) +{ + uint32_t asr17; + + __asm__ ( + "rd %%asr17, %0" + : "=&r" (asr17) + ); + + return asr17 >> LEON3_ASR17_PROCESSOR_INDEX_SHIFT; +} + #endif #ifdef __cplusplus -- cgit v1.2.3