2727 */
2828
2929.extern vTaskSwitchContext
30-
30+
3131.set noat
3232
3333# Exported to start the first task.
34- .globl restore_sp_from_pxCurrentTCB
35-
34+ .globl restore_sp_from_pxCurrentTCB
35+
3636# Entry point for exceptions.
3737.section .exceptions.entry.user, "xa"
3838
@@ -41,15 +41,15 @@ save_context:
4141 addi sp, sp, -116 # Create space on the stack.
4242 stw ra, 0 (sp)
4343 # Leave a gap for muldiv 0
44- stw at, 8 (sp)
44+ stw at, 8 (sp)
4545 stw r2, 12 (sp)
4646 stw r3, 16 (sp)
4747 stw r4, 20 (sp)
48- stw r5, 24 (sp)
49- stw r6, 28 (sp)
50- stw r7, 32 (sp)
51- stw r8, 36 (sp)
52- stw r9, 40 (sp)
48+ stw r5, 24 (sp)
49+ stw r6, 28 (sp)
50+ stw r7, 32 (sp)
51+ stw r8, 36 (sp)
52+ stw r9, 40 (sp)
5353 stw r10, 44 (sp)
5454 stw r11, 48 (sp)
5555 stw r12, 52 (sp)
@@ -76,12 +76,12 @@ save_sp_to_pxCurrentTCB:
7676 ldw et, (et) # Load the value of the pxCurrentTCB pointer
7777 stw sp, (et) # Store the stack pointer into the top of the TCB
7878
79- br irq_test_user # skip the section .exceptions.entry
79+ br irq_test_user # skip the section .exceptions.entry
8080
81- .section .exceptions.irqtest, "xa"
81+ .section .exceptions.irqtest, "xa"
8282irq_test_user:
8383
84- .section .exceptions.exit.user, "xa"
84+ .section .exceptions.exit.user, "xa"
8585restore_sp_from_pxCurrentTCB:
8686 movia et, pxCurrentTCB # Load the address of the pxCurrentTCB pointer
8787 ldw et, (et) # Load the value of the pxCurrentTCB pointer
@@ -94,11 +94,11 @@ restore_context:
9494 ldw r2, 12 (sp)
9595 ldw r3, 16 (sp)
9696 ldw r4, 20 (sp)
97- ldw r5, 24 (sp)
98- ldw r6, 28 (sp)
99- ldw r7, 32 (sp)
100- ldw r8, 36 (sp)
101- ldw r9, 40 (sp)
97+ ldw r5, 24 (sp)
98+ ldw r6, 28 (sp)
99+ ldw r7, 32 (sp)
100+ ldw r8, 36 (sp)
101+ ldw r9, 40 (sp)
102102 ldw r10, 44 (sp)
103103 ldw r11, 48 (sp)
104104 ldw r12, 52 (sp)
@@ -120,8 +120,8 @@ restore_context:
120120 ldw fp, 112 (sp)
121121 addi sp, sp, 116 # Release stack space
122122
123- eret # Return to address ea, loading eStatus into Status.
124-
123+ eret # Return to address ea, loading eStatus into Status.
124+
125125 .section .exceptions.soft, "xa"
126126soft_exceptions:
127127 movhi r3, 0x003b /* upper half of trap opcode */
@@ -131,8 +131,9 @@ soft_exceptions:
131131
132132call_scheduler:
133133 stw ea, 72 (sp) # EA is PC+4 so will skip over instruction causing exception
134- call vTaskSwitchContext # Pick the next context.
135- br restore_sp_from_pxCurrentTCB # Switch in the task context and restore.
134+ movia r15, vTaskSwitchContext # Pick the next context - use long call version in place of "call"
135+ callr r15
136+ br restore_sp_from_pxCurrentTCB # Switch in the task context and restore.
136137
137138 .section .exceptions.unknown.user
138139exceptions_unknown_user:
0 commit comments