From 981d028c09d10ed867f2f955f58d60b753c64f29 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 8 Aug 2014 01:39:29 -0400 Subject: Do some kernel cleanup * Seal away private thread and kernel definitions and declarations into the internal headers in order to better hide internal structure. * Add a thread-common.c file that keeps shared functions together. List functions aren't messed with since that's about to be changed to different ones. * It is necessary to modify some ARM/PP stuff since GCC was complaining about constant pool distance and I would rather not force dump it. Just bl the cache calls in the startup and exit code and let it use veneers if it must. * Clean up redundant #includes in relevant areas and reorganize them. * Expunge useless and dangerous stuff like remove_thread(). Change-Id: I6e22932fad61a9fac30fd1363c071074ee7ab382 --- firmware/target/arm/pp/thread-pp.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'firmware/target/arm/pp/thread-pp.c') diff --git a/firmware/target/arm/pp/thread-pp.c b/firmware/target/arm/pp/thread-pp.c index ed4bdbeac1..b2e7fb018d 100644 --- a/firmware/target/arm/pp/thread-pp.c +++ b/firmware/target/arm/pp/thread-pp.c @@ -45,7 +45,7 @@ extern uintptr_t cpu_idlestackbegin[]; extern uintptr_t cpu_idlestackend[]; extern uintptr_t cop_idlestackbegin[]; extern uintptr_t cop_idlestackend[]; -static uintptr_t * const idle_stacks[NUM_CORES] = +uintptr_t * const idle_stacks[NUM_CORES] = { [CPU] = cpu_idlestackbegin, [COP] = cop_idlestackbegin @@ -92,9 +92,7 @@ static inline void NORETURN_ATTR __attribute__((always_inline)) { asm volatile ( "cmp %1, #0 \n" /* CPU? */ - "ldrne r0, =commit_dcache \n" /* No? write back data */ - "movne lr, pc \n" - "bxne r0 \n" + "blne commit_dcache \n" "mov r0, %0 \n" /* copy thread parameter */ "mov sp, %2 \n" /* switch to idle stack */ "bl thread_final_exit_do \n" /* finish removal */ @@ -163,9 +161,7 @@ static void __attribute__((naked)) "ldr sp, [r0, #32] \n" /* Reload original sp from context structure */ "mov r1, #0 \n" /* Clear start address */ "str r1, [r0, #40] \n" - "ldr r0, =commit_discard_idcache \n" /* Invalidate new core's cache */ - "mov lr, pc \n" - "bx r0 \n" + "bl commit_discard_idcache \n" /* Invalidate new core's cache */ "ldmfd sp!, { r4-r11, pc } \n" /* Restore non-volatile context to new core and return */ : : "i"(IDLE_STACK_WORDS) ); -- cgit v1.2.3