nios2: implement fiberRtnValueSet()
The return value of _Swap() is often treated as a "don't care" value and thus often ignored. However, there are cases when it is desirable to have a meaningful return value. This meaningful value can be assigned via fiberRtnValueSet(). To that end, a new field has been added to the coop register struct to store this value for when _Swap() needs to return that meaningful value. Change-Id: Ic4967fa7d602850c09ebde18e8bfd4c97cda9ec8 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
885e9084a8
commit
8a8a2928e5
3 changed files with 15 additions and 6 deletions
|
@ -93,15 +93,24 @@ BRANCH_LABEL(next_chosen)
|
|||
ldw ra, __tTCS_coopReg_OFFSET + __t_coop_ra_OFFSET(r11)
|
||||
ldw sp, __tTCS_coopReg_OFFSET + __t_coop_sp_OFFSET(r11)
|
||||
|
||||
/* Restore interrupt state in status.PIE */
|
||||
ldw r2, __tTCS_coopReg_OFFSET + __t_coop_key_OFFSET(r11)
|
||||
andi r3, r2, NIOS2_STATUS_PIE_MSK
|
||||
/* Load return value into r2 (return value register). garbage
|
||||
* unless someone previously called fiberRtnValueSet(). Do this
|
||||
* before we potentially unlock interrupts.
|
||||
*/
|
||||
ldw r2, __tTCS_coopReg_OFFSET + __t_coop_retval_OFFSET(r11)
|
||||
|
||||
/* irq_unlock(fiber->coopReg.key);
|
||||
* key was supplied as argument to _Swap()
|
||||
*/
|
||||
ldw r3, __tTCS_coopReg_OFFSET + __t_coop_key_OFFSET(r11)
|
||||
andi r3, r3, NIOS2_STATUS_PIE_MSK
|
||||
beq r3, zero, no_unlock
|
||||
rdctl r3, status
|
||||
ori r3, r3, NIOS2_STATUS_PIE_MSK
|
||||
wrctl status, r3
|
||||
|
||||
BRANCH_LABEL(no_unlock)
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue