Skip to content
Permalink
Browse files

arch: arc: add macros to get current cpu id

add macros for assembly and C to get current cpu id

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
  • Loading branch information...
vonhust authored and carlescufi committed Jul 25, 2019
1 parent 31a0371 commit 83dfe5eac459e1aa070ac685a0164e6c255471ca
Showing with 16 additions and 0 deletions.
  1. +5 −0 arch/arc/include/swap_macros.h
  2. +11 −0 include/arch/arc/v2/aux_regs.h
@@ -295,6 +295,11 @@ extern "C" {
cmp \reg1, \reg2
.endm

.macro _get_cpu_id reg
lr \reg, [_ARC_V2_IDENTITY]
xbfu \reg, \reg, 0xe8
.endm

#endif /* _ASMLANGUAGE */

#ifdef __cplusplus
@@ -177,8 +177,19 @@ extern "C" {
: "ir"(val), "i"(reg)); \
})
#endif /* __GNUC__ */

#endif /* _ASMLANGUAGE */

#define z_arc_v2_core_id() \
({ \
unsigned int __ret; \
__asm__ __volatile__("lr %0, [%1]\n" \
"xbfu %0, %0, 0xe8\n" \
: "=r"(__ret) \
: "i"(_ARC_V2_IDENTITY)); \
__ret; \
})

#ifdef __cplusplus
}
#endif

0 comments on commit 83dfe5e

Please sign in to comment.
You can’t perform that action at this time.