task: Module switch asm fix
This patch fixes the task module module/task switch code.
Need to reserve 16 bytes for global __module_stack and __task_stack storage.
Put __module_stack and __task_stack in .bss since its uninitialized data.
Replace incorrect lqr instructin with lqa instruction.
Signed-off-by: Yuji Mano <yuji.mano@am.sony.com>
Acked-by: Kazunori Asayama <asayama@sm.sony.co.jp>
diff --git a/task/src/mpu/module/task_switch.S b/task/src/mpu/module/task_switch.S
index 1d5a936..0c688da 100644
--- a/task/src/mpu/module/task_switch.S
+++ b/task/src/mpu/module/task_switch.S
@@ -35,19 +35,19 @@
* LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
*/
-.data
+.section .bss
/* void *__module_stack */
.align 4
.globl __module_stack
__module_stack:
-.space 4
+.space 16
/* void *__task_stack */
.align 4
.globl __task_stack
__task_stack:
-.space 4
+.space 16
.text
@@ -118,7 +118,7 @@
brsl $LR, __task_restore /* call task restore body */
brsl $LR, __registers_restore /* restore registers */
- lqr $SP, __task_stack /* restore task stack */
+ lqa $SP, __task_stack /* restore task stack */
sync /* sync before execution */
ai $SP, $SP, 48 /* pop task_save stack frame */
@@ -169,7 +169,7 @@
shlqbyi INST_MASK, INST_MASK, 15 /* shift to correct position */
body:
- lqr STACK_PTR, __task_stack /* load task stack pointer */
+ lqa STACK_PTR, __task_stack /* load task stack pointer */
il TEMP, -NUM_REGS * 16 /* size of reg save area */
a REGS_PTR, STACK_PTR, TEMP /* set reg load addr pointer */
ai CODE_PTR, REGS_PTR, -2 * 16 /* set code load addr pointer */