[Cbe-oss-dev] [PATCH 02/28]MARS/base: prevent use of non volatile regs
Yuji Mano
yuji.mano at am.sony.com
Fri Feb 6 13:30:19 EST 2009
From: Kazunori Asayama <asayama at sm.sony.co.jp>
Guarantee non-volatile regs are not broken during scheduling workload
This patch guarantees non-volatile registers are not broken during
workload scheduling is performed by using -mfixed-range compiler
option. This patch also removes unnecessary 'noinline' attributes in
the kernel implementation.
Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>
---
base/src/mpu/kernel/Makefile.am | 1 +
base/src/mpu/kernel/kernel.c | 36 +++++++++++++++++++++---------------
2 files changed, 22 insertions(+), 15 deletions(-)
Index: b/base/src/mpu/kernel/Makefile.am
===================================================================
--- a/base/src/mpu/kernel/Makefile.am 2009-01-22 13:52:59.000000000 +0900
+++ b/base/src/mpu/kernel/Makefile.am 2009-01-22 22:42:58.000000000 +0900
@@ -72,6 +72,7 @@ AM_CCASFLAGS = \
AM_CFLAGS = \
$(extra_cflags) \
+ -mfixed-range=80-127 \
-W \
-Wall \
-Wunused \
Index: b/base/src/mpu/kernel/kernel.c
===================================================================
--- a/base/src/mpu/kernel/kernel.c 2009-01-22 13:52:59.000000000 +0900
+++ b/base/src/mpu/kernel/kernel.c 2009-01-22 22:48:04.000000000 +0900
@@ -575,7 +575,7 @@ static void release_block(int block, int
notify_host_bits(block_ea, index);
}
-static int __attribute__((noinline)) reserve_workload(void)
+static int reserve_workload(void)
{
int block;
int index = -1;
@@ -601,7 +601,7 @@ static int __attribute__((noinline)) res
return MARS_WORKLOAD_RESERVED;
}
-static void __attribute__((noinline)) release_workload(void)
+static void release_workload(void)
{
int block = workload_id / MARS_WORKLOAD_PER_BLOCK;
int index = workload_id % MARS_WORKLOAD_PER_BLOCK;
@@ -613,7 +613,23 @@ static void __attribute__((noinline)) re
release_block(block, index);
}
-static int __attribute__((noinline)) scheduler(void)
+static void __attribute__((noinline)) run_workload(void)
+{
+ /* save kernel stack pointer */
+ asm volatile (
+ "stqa $sp, _kernel_stack;"
+ );
+
+ /* call module entry function */
+ ((module_entry)workload.module.entry)(&kernel_syscalls);
+
+ /* label so module can jump back here at exit */
+ asm volatile (
+ "_module_exit:"
+ );
+}
+
+static int scheduler(void)
{
int status;
@@ -642,21 +658,11 @@ static int __attribute__((noinline)) sch
memset((void *)MARS_WORKLOAD_MODULE_BASE_ADDR +
workload.module.exec_size, 0, workload.module.bss_size);
- /* save kernel stack pointer */
- asm volatile (
- "stqa $sp, _kernel_stack;"
- );
-
/* sync before executing loaded code */
spu_sync();
- /* call module entry function */
- ((module_entry)workload.module.entry)(&kernel_syscalls);
-
- /* label so module can jump back here at exit */
- asm volatile (
- "_module_exit:"
- );
+ /* run workload */
+ run_workload();
/* release reservation of current workload */
release_workload();
More information about the cbe-oss-dev
mailing list