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
This commit is contained in:
Michael Sevakis 2014-08-08 01:39:29 -04:00
parent 53d9f2e6a7
commit 981d028c09
22 changed files with 366 additions and 986 deletions

View file

@ -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)
);