Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ports/risc-v32/gnu/src/tx_thread_context_save.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (c) 2025 10xEngineers
* Copyright (c) 2026 Eclipse ThreadX contributors
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
Expand All @@ -8,6 +9,7 @@
* SPDX-License-Identifier: MIT
**************************************************************************/

// Some portions generated by Copilot (Opus 5).

/**************************************************************************/
/**************************************************************************/
Expand Down Expand Up @@ -173,7 +175,11 @@ _tx_thread_skip_fpu_save:

/* Call the ISR execution exit function if enabled. */
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
addi sp, sp, -16 // Reserve space to save the return address
sw ra, 0(sp) // Save the return address
call _tx_execution_isr_enter // Call the ISR execution enter function
lw ra, 0(sp) // Recover the return address
addi sp, sp, 16 // Recover the reserved stack space
#endif

ret // Return to ISR
Expand Down Expand Up @@ -261,7 +267,11 @@ _tx_thread_skip_nested_fpu_save:

/* Call the ISR execution exit function if enabled. */
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
addi sp, sp, -16 // Reserve space to save the return address
sw ra, 0(sp) // Save the return address
call _tx_execution_isr_enter // Call the ISR execution enter function
lw ra, 0(sp) // Recover the return address
addi sp, sp, 16 // Recover the reserved stack space
#endif

ret // Return to ISR
Expand All @@ -270,7 +280,11 @@ _tx_thread_idle_system_save:


#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
addi sp, sp, -16 // Reserve space to save the return address
sw ra, 0(sp) // Save the return address
call _tx_execution_isr_enter // Call the ISR execution enter function
lw ra, 0(sp) // Recover the return address
addi sp, sp, 16 // Recover the reserved stack space
#endif

/* Interrupt occurred in the scheduling loop. */
Expand Down
13 changes: 13 additions & 0 deletions ports/risc-v32/iar/src/tx_thread_context_save.s
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* SPDX-License-Identifier: MIT
**************************************************************************/

; Some portions generated by Copilot (Opus 5).

/**************************************************************************/
/**************************************************************************/
Expand Down Expand Up @@ -145,7 +146,11 @@ _tx_thread_context_save:
#endif

#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
addi sp, sp, -16 ; Reserve space to save the return address
sw ra, 0(sp) ; Save the return address
call _tx_execution_isr_enter ; Call the ISR execution enter function
lw ra, 0(sp) ; Recover the return address
addi sp, sp, 16 ; Recover the reserved stack space
#endif

ret ; Return to calling ISR
Expand Down Expand Up @@ -223,7 +228,11 @@ _tx_thread_not_nested_save:

#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
/* _tx_execution_isr_enter is called with thread stack pointer */
addi sp, sp, -16 ; Reserve space to save the return address
sw ra, 0(sp) ; Save the return address
call _tx_execution_isr_enter ; Call the ISR execution enter function
lw ra, 0(sp) ; Recover the return address
addi sp, sp, 16 ; Recover the reserved stack space
#endif


Expand All @@ -238,7 +247,11 @@ _tx_thread_idle_system_save:


#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
addi sp, sp, -16 ; Reserve space to save the return address
sw ra, 0(sp) ; Save the return address
call _tx_execution_isr_enter ; Call the ISR execution enter function
lw ra, 0(sp) ; Recover the return address
addi sp, sp, 16 ; Recover the reserved stack space
#endif

/* Interrupt occurred in the scheduling loop. */
Expand Down
13 changes: 13 additions & 0 deletions ports/risc-v64/gnu/src/tx_thread_context_save.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* SPDX-License-Identifier: MIT
**************************************************************************/

// Some portions generated by Copilot (Opus 5).

/**************************************************************************/
/**************************************************************************/
Expand Down Expand Up @@ -181,7 +182,11 @@ _tx_thread_context_save:
#endif

#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
addi sp, sp, -16 // Reserve space to save the return address
sd ra, 0(sp) // Save the return address
call _tx_execution_isr_enter // Call the ISR execution enter function
ld ra, 0(sp) // Recover the return address
addi sp, sp, 16 // Recover the reserved stack space
#endif

ret // Return to calling ISR
Expand Down Expand Up @@ -316,7 +321,11 @@ _tx_thread_not_nested_save:

#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
/* _tx_execution_isr_enter is called with thread stack pointer */
addi sp, sp, -16 // Reserve space to save the return address
sd ra, 0(sp) // Save the return address
call _tx_execution_isr_enter // Call the ISR execution enter function
ld ra, 0(sp) // Recover the return address
addi sp, sp, 16 // Recover the reserved stack space
#endif

la t0, _tx_thread_system_stack_ptr // Pickup system stack pointer address
Expand All @@ -331,7 +340,11 @@ _tx_thread_idle_system_save:


#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
addi sp, sp, -16 // Reserve space to save the return address
sd ra, 0(sp) // Save the return address
call _tx_execution_isr_enter // Call the ISR execution enter function
ld ra, 0(sp) // Recover the return address
addi sp, sp, 16 // Recover the reserved stack space
#endif

/* Interrupt occurred in the scheduling loop. */
Expand Down