Skip to content

Register RA will be modified when TX_ENABLE_EXECUTION_CHANGE_NOTIFY is enabled #348

Description

@xuzihan351

Let us discuss the code below(ports/risc-v32/iar/src/tx_thread_context_save.s and others asm code)

#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
    /* _tx_execution_isr_enter is called with thread stack pointer */
    call    _tx_execution_isr_enter                     ; Call the ISR execution enter function
#endif
...
...
   ret
   END

The function tx_thread_context_save is called from ISR or another function, and tx_thread_context_save will return to it by ret.
Register RA stored the return address of the caller function.
When TX_ENABLE_EXECUTION_CHANGE_NOTIFY is enabled, function _tx_execution_isr_enter will be called, and register RA will store the return address of the next line of call _tx_execution_isr_enter . Without saving register RA before call _tx_execution_isr_enter, the return address of tx_thread_context_save's caller function will be replaced. Resulting in function tx_thread_context_save will never return to the right address.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghardwareNew hardware or architecture support request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions