Skip to content

Commit c57f932

Browse files
authored
Add implementation of WhereAmI() to support NO_AFFINITY=0 on ARM64 (#4648)
* Add preliminary implementation of WhereAmI()
1 parent a0083fd commit c57f932

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

common_arm64.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5555
#ifndef ASSEMBLER
5656

5757

58+
static __inline int WhereAmI(void){
59+
uint64_t ret;
60+
__asm__ volatile (
61+
" mrs x0, mpidr_el1 \n"
62+
" and x0, x0, 0xff \n"
63+
:"=r" (ret)
64+
:: "memory"
65+
);
66+
ret +=1;
67+
if ((int)ret <0) ret = 0;
68+
return (int)ret;
69+
}
70+
5871
static __inline void blas_lock(volatile BLASULONG *address){
5972

6073
BLASULONG ret;

0 commit comments

Comments
 (0)