Add preliminary implementation of WhereAmI()

This commit is contained in:
Martin Kroeker 2024-04-15 23:59:44 +02:00 committed by GitHub
parent 91a24b837d
commit 34fd14036c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 0 deletions

View File

@ -55,6 +55,18 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSEMBLER
static __inline int WhereAmI(void){
uint64_t ret;
__asm__ volatile (
" mrs x0, mpidr_el1 \n"
" and x0, x0, 0xff \n"
:"=r" (ret)
:: "memory"
);
if (ret > MAX_CPU_NUMBER) ret = MAX_CPU_NUMBER;
return (int)ret;
}
static __inline void blas_lock(volatile BLASULONG *address){
BLASULONG ret;