Optimize xPortGetCoreID to 2-instruction inline assembly.

This commit is contained in:
Jeroen Domburg 2016-10-17 18:09:15 +08:00
parent bdd67c98d6
commit 0403d43b19
4 changed files with 2 additions and 21 deletions

View file

@ -192,8 +192,7 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
#endif
/* Multi-core: get current core ID */
int xPortGetCoreID( void );
#define xPortGetCoreID() __extension__({int id; asm volatile("rsr.prid %0; extui %0,%0,13,1":"=r"(id)); id;})
#ifdef __cplusplus
}

View file

@ -322,12 +322,7 @@ STRUCT_END(XtSolFrame)
#ifdef __ASSEMBLER__
.macro getcoreid reg
rsr.prid \reg
bbci \reg,1,1f
movi \reg,1
j 2f
1:
movi \reg,0
2:
extui \reg,\reg,13,1
.endm
#endif

View file

@ -76,7 +76,6 @@ inline static void panicPutHex(int a) { }
inline static void panicPutDec(int a) { }
#endif
int xPortGetCoreID();
void __attribute__((weak)) vApplicationStackOverflowHook( TaskHandle_t xTask, signed char *pcTaskName ) {
panicPutStr("***ERROR*** A stack overflow in task ");

View file

@ -51,18 +51,6 @@ port_switch_flag:
.text
/* C function to get proc ID.*/
.global xPortGetCoreID
.type xPortGetCoreID,@function
.align 4
xPortGetCoreID:
ENTRY(16)
getcoreid a2
RET(16)
/*
*******************************************************************************
* _frxt_setup_switch