small cleanuo to smp asm files
This commit is contained in:
@@ -80,20 +80,15 @@ _tx_thread_schedule:
|
|||||||
la t0, _tx_thread_execute_ptr // Pickup address of execute ptr
|
la t0, _tx_thread_execute_ptr // Pickup address of execute ptr
|
||||||
add t0, t0, t4 // Select this hart's execute slot
|
add t0, t0, t4 // Select this hart's execute slot
|
||||||
_tx_thread_schedule_loop:
|
_tx_thread_schedule_loop:
|
||||||
|
csrci mstatus, 0x08 // Lockout interrupts
|
||||||
|
LOAD t1, 0(t0) // Pickup next thread to execute
|
||||||
|
bnez t1, _tx_thread_schedule_thread // If non-NULL, continue
|
||||||
|
csrsi mstatus, 0x08 // Enable interrupts
|
||||||
#ifdef TX_ENABLE_WFI
|
#ifdef TX_ENABLE_WFI
|
||||||
csrci mstatus, 0x08 // Lockout interrupts
|
|
||||||
LOAD t1, 0(t0) // Pickup next thread to execute
|
|
||||||
bnez t1, _tx_thread_schedule_thread // If non-NULL, continue
|
|
||||||
csrsi mstatus, 0x08 // Enable interrupts
|
|
||||||
wfi // Wait for interrupt
|
wfi // Wait for interrupt
|
||||||
j _tx_thread_schedule_loop // Keep looking for a thread
|
|
||||||
#else
|
|
||||||
csrci mstatus, 0x08 // Lockout interrupts
|
|
||||||
LOAD t1, 0(t0) // Pickup next thread to execute
|
|
||||||
bnez t1, _tx_thread_schedule_thread // If non-NULL, continue
|
|
||||||
csrsi mstatus, 0x08 // Enable interrupts
|
|
||||||
j _tx_thread_schedule_loop // Keep looking for a thread
|
|
||||||
#endif
|
#endif
|
||||||
|
j _tx_thread_schedule_loop // Keep looking for a thread
|
||||||
|
|
||||||
_tx_thread_schedule_thread:
|
_tx_thread_schedule_thread:
|
||||||
|
|
||||||
/* Atomically claim the thread's ready token so only one hart can
|
/* Atomically claim the thread's ready token so only one hart can
|
||||||
|
|||||||
@@ -23,18 +23,11 @@ _tx_thread_smp_protect:
|
|||||||
|
|
||||||
/* Try to get the protection. */
|
/* Try to get the protection. */
|
||||||
LWU t4, 0(t1) // Pickup protection flag
|
LWU t4, 0(t1) // Pickup protection flag
|
||||||
beqz t4, _get_protection // If clear, try to claim it
|
bnez t4, _protection_busy // If set, protection is busy
|
||||||
|
|
||||||
/* Protection is busy. Restore interrupts and retry. */
|
|
||||||
csrw mstatus, a0 // Restore interrupts
|
|
||||||
j _tx_thread_smp_protect // Restart the protection attempt
|
|
||||||
|
|
||||||
_get_protection:
|
|
||||||
li t4, 1 // Build lock value
|
li t4, 1 // Build lock value
|
||||||
amoswap.w.aq t5, t4, (t1) // Attempt to get protection
|
amoswap.w.aq t5, t4, (t1) // Attempt to get protection
|
||||||
bnez t5, _protection_busy // If old value != 0, retry
|
bnez t5, _protection_busy // If old value != 0, retry
|
||||||
|
|
||||||
_got_protection:
|
|
||||||
fence rw, rw // Ensure lock acquisition is visible
|
fence rw, rw // Ensure lock acquisition is visible
|
||||||
sw t2, 4(t1) // Save owning hart
|
sw t2, 4(t1) // Save owning hart
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ _tx_thread_smp_unprotect:
|
|||||||
/* Release the protection. */
|
/* Release the protection. */
|
||||||
li t3, -1 // Invalid owner value
|
li t3, -1 // Invalid owner value
|
||||||
sw t3, 4(t2) // Mark owning hart invalid
|
sw t3, 4(t2) // Mark owning hart invalid
|
||||||
fence rw, rw // Ensure shared accesses complete
|
|
||||||
amoswap.w.rl x0, x0, (t2) // Release protection flag
|
amoswap.w.rl x0, x0, (t2) // Release protection flag
|
||||||
|
|
||||||
_still_protected:
|
_still_protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user