fix get cpu id using mpidr

This commit is contained in:
lr 2024-07-03 20:22:00 +08:00
parent 27d7232e61
commit ff37506a09
2 changed files with 6 additions and 3 deletions

View File

@ -21,7 +21,8 @@ Modification:
.func cpu_get_current
cpu_get_current:
mrs x0, mpidr_el1
and x0, x0, #3
and x0, x0, #0xFFF
lsr x0, x0, #8
ret
.endfunc

View File

@ -67,7 +67,8 @@ cmp w1, #UNLOCKED
bne _spinlock_lock
mrs x1, mpidr_el1 // get our CPU ID
and x1, x1, #3
and x1, x1, #0xFFF
lsr x1, x1, #8
stxrb w2, w1, [x0]
cmp x2, #0
bne _spinlock_lock // check if the write was successful, if the write failed, start over
@ -86,7 +87,8 @@ ret
_spinlock_unlock:
mrs x1, mpidr_el1 // get our CPU ID
and x1, x1, #3
and x1, x1, #0xFFF
lsr x1, x1, #8
ldr w2, [x0]
cmp w1, w2