summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/sparc/rtems/score/sparc.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/cpu/sparc/rtems/score/sparc.h')
-rw-r--r--cpukit/score/cpu/sparc/rtems/score/sparc.h14
1 files changed, 14 insertions, 0 deletions
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