forked from Imagelibrary/rtems
powerpc: Add _CPU_Get_current_per_CPU_control()
Add _CPU_Get_current_per_CPU_control() on SMP configurations. Use SPRG0 for the current per-CPU control. This reduces the code size by three instructions and is slightly faster. Update #2805.
This commit is contained in:
@@ -182,6 +182,10 @@ _start:
|
|||||||
/* Set small-data anchor */
|
/* Set small-data anchor */
|
||||||
LA r13, _SDA_BASE_
|
LA r13, _SDA_BASE_
|
||||||
|
|
||||||
|
#ifdef RTEMS_SMP
|
||||||
|
SET_SELF_CPU_CONTROL r4
|
||||||
|
#endif
|
||||||
|
|
||||||
blr
|
blr
|
||||||
|
|
||||||
.Linitmore:
|
.Linitmore:
|
||||||
|
|||||||
@@ -936,13 +936,20 @@ void ShowBATS(void);
|
|||||||
mtmsr \level
|
mtmsr \level
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro GET_SELF_CPU_CONTROL reg
|
|
||||||
#if defined(RTEMS_SMP)
|
#if defined(RTEMS_SMP)
|
||||||
|
.macro SET_SELF_CPU_CONTROL reg
|
||||||
/* Use Book E Processor ID Register (PIR) */
|
/* Use Book E Processor ID Register (PIR) */
|
||||||
mfspr \reg, 286
|
mfspr \reg, 286
|
||||||
slwi \reg, \reg, PER_CPU_CONTROL_SIZE_LOG2
|
slwi \reg, \reg, PER_CPU_CONTROL_SIZE_LOG2
|
||||||
addis \reg, \reg, _Per_CPU_Information@ha
|
addis \reg, \reg, _Per_CPU_Information@ha
|
||||||
addi \reg, \reg, _Per_CPU_Information@l
|
addi \reg, \reg, _Per_CPU_Information@l
|
||||||
|
mtspr PPC_PER_CPU_CONTROL_REGISTER, \reg
|
||||||
|
.endm
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.macro GET_SELF_CPU_CONTROL reg
|
||||||
|
#if defined(RTEMS_SMP)
|
||||||
|
mfspr \reg, PPC_PER_CPU_CONTROL_REGISTER
|
||||||
#else
|
#else
|
||||||
lis \reg, _Per_CPU_Information@h
|
lis \reg, _Per_CPU_Information@h
|
||||||
ori \reg, \reg, _Per_CPU_Information@l
|
ori \reg, \reg, _Per_CPU_Information@l
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2016 embedded brains GmbH
|
||||||
|
*
|
||||||
* The license and distribution terms for this file may be
|
* The license and distribution terms for this file may be
|
||||||
* found in the file LICENSE in this distribution or at
|
* found in the file LICENSE in this distribution or at
|
||||||
* http://www.rtems.org/license/LICENSE.
|
* http://www.rtems.org/license/LICENSE.
|
||||||
@@ -15,12 +17,37 @@
|
|||||||
|
|
||||||
#include <rtems/score/cpu.h>
|
#include <rtems/score/cpu.h>
|
||||||
|
|
||||||
|
#ifdef RTEMS_SMP
|
||||||
|
|
||||||
|
/* Use SPRG0 for the per-CPU control of the current processor */
|
||||||
|
#define PPC_PER_CPU_CONTROL_REGISTER 272
|
||||||
|
|
||||||
|
#endif /* RTEMS_SMP */
|
||||||
|
|
||||||
#ifndef ASM
|
#ifndef ASM
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef RTEMS_SMP
|
||||||
|
|
||||||
|
static inline struct Per_CPU_Control *_PPC_Get_current_per_CPU_control( void )
|
||||||
|
{
|
||||||
|
struct Per_CPU_Control *cpu_self;
|
||||||
|
|
||||||
|
__asm__ volatile (
|
||||||
|
"mfspr %0, " RTEMS_XSTRING( PPC_PER_CPU_CONTROL_REGISTER )
|
||||||
|
: "=r" ( cpu_self )
|
||||||
|
);
|
||||||
|
|
||||||
|
return cpu_self;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _CPU_Get_current_per_CPU_control() _PPC_Get_current_per_CPU_control()
|
||||||
|
|
||||||
|
#endif /* RTEMS_SMP */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user