small cleanuo to smp asm files

This commit is contained in:
2026-03-26 15:55:32 +01:00
parent 1aa9944581
commit 8a41f3e0fa
3 changed files with 7 additions and 20 deletions

View File

@@ -23,18 +23,11 @@ _tx_thread_smp_protect:
/* Try to get the protection. */
LWU t4, 0(t1) // Pickup protection flag
beqz t4, _get_protection // If clear, try to claim it
/* Protection is busy. Restore interrupts and retry. */
csrw mstatus, a0 // Restore interrupts
j _tx_thread_smp_protect // Restart the protection attempt
_get_protection:
bnez t4, _protection_busy // If set, protection is busy
li t4, 1 // Build lock value
amoswap.w.aq t5, t4, (t1) // Attempt to get protection
bnez t5, _protection_busy // If old value != 0, retry
_got_protection:
fence rw, rw // Ensure lock acquisition is visible
sw t2, 4(t1) // Save owning hart