[Cbe-oss-dev] [PATCH 11/22]MARS/base: kernel switch asm fix

Yuji Mano yuji.mano at am.sony.com
Fri Mar 20 07:54:21 EST 2009


This patch fixes the kernel/module switch code.
Need to reserve 16 bytes for global __kernel_stack storage.
Put __kernel_stack in .bss since its uninitialized data.
Replace stqr/lqr pair with stqa/lqa.

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
---
 base/src/mpu/kernel/switch.S |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/base/src/mpu/kernel/switch.S
+++ b/base/src/mpu/kernel/switch.S
@@ -35,13 +35,13 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-.data
+.section .bss
 
 /* void *__kernel_stack */
 .align	4
 .globl	__kernel_stack
 __kernel_stack:
-.space	4
+.space	16
 
 
 .text
@@ -54,7 +54,7 @@ workload_run:
 	stqd	$SP, -32($SP)			/* save back chain */
 	ai	$SP, $SP, -32			/* push stack frame */
 
-	stqr	$SP, __kernel_stack		/* save kernel stack pointer */
+	stqa	$SP, __kernel_stack		/* save kernel stack pointer */
 	brsl	$LR, __workload_run		/* call body of workload_run */
 
 	ai	$SP, $SP, 32			/* pop stack frame */
@@ -72,7 +72,7 @@ workload_exit:
 	ai	$SP, $SP, -32			/* push stack frame */
 
 	brsl	$LR, __workload_exit		/* call body of workload_exit */
-	lqr	$SP, __kernel_stack		/* restore kernel stack */
+	lqa	$SP, __kernel_stack		/* restore kernel stack */
 
 	ai	$SP, $SP, 32			/* pop stack frame */
 	lqd	$LR, 16($SP)			/* restore link register */






More information about the cbe-oss-dev mailing list