Changeset 26aafe8 in mainline for kernel/generic/src


Ignore:
Timestamp:
2011-05-19T16:47:49Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a6d8726
Parents:
bcaca55
Message:

cleanup the huge mess related to stacks, their sizes and locations
use two frames for kernel stacks by default on all platforms (to play it safe)

Location:
kernel/generic/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/interrupt/interrupt.c

    rbcaca55 r26aafe8  
    205205         * stack.
    206206         */
    207         return (istate_t *) ((uint8_t *) thread->kstack + THREAD_STACK_SIZE -
    208             sizeof(istate_t));
     207        return (istate_t *) ((uint8_t *)
     208            thread->kstack + STACK_SIZE - sizeof(istate_t));
    209209}
    210210
  • kernel/generic/src/main/main.c

    rbcaca55 r26aafe8  
    118118#endif
    119119
    120 #define CONFIG_STACK_SIZE  ((1 << STACK_FRAMES) * STACK_SIZE)
    121 
    122120/** Main kernel routine for bootstrap CPU.
    123121 *
     
    139137        config.kernel_size = ALIGN_UP(hardcoded_ktext_size +
    140138            hardcoded_kdata_size, PAGE_SIZE);
    141         config.stack_size = CONFIG_STACK_SIZE;
     139        config.stack_size = STACK_SIZE;
    142140       
    143141        /* Initialy the stack is placed just after the kernel */
     
    165163       
    166164        context_save(&ctx);
    167         context_set(&ctx, FADDR(main_bsp_separated_stack), config.stack_base,
    168             THREAD_STACK_SIZE);
     165        context_set(&ctx, FADDR(main_bsp_separated_stack),
     166            config.stack_base, STACK_SIZE);
    169167        context_restore(&ctx);
    170168        /* not reached */
     
    323321        context_save(&CPU->saved_context);
    324322        context_set(&CPU->saved_context, FADDR(main_ap_separated_stack),
    325             (uintptr_t) CPU->stack, CPU_STACK_SIZE);
     323            (uintptr_t) CPU->stack, STACK_SIZE);
    326324        context_restore(&CPU->saved_context);
    327325        /* not reached */
  • kernel/generic/src/proc/program.c

    rbcaca55 r26aafe8  
    5454#include <proc/program.h>
    5555
    56 #ifndef LOADED_PROG_STACK_PAGES_NO
    57 #define LOADED_PROG_STACK_PAGES_NO 1
    58 #endif
    59 
    6056/**
    6157 * Points to the binary image used as the program loader. All non-initial
     
    9086       
    9187        /*
    92          * Create the data address space area.
     88         * Create the stack address space area.
    9389         */
    9490        as_area_t *area = as_area_create(as,
    9591            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE,
    96             LOADED_PROG_STACK_PAGES_NO * PAGE_SIZE, USTACK_ADDRESS,
    97             AS_AREA_ATTR_NONE, &anon_backend, NULL);
     92            STACK_SIZE, USTACK_ADDRESS, AS_AREA_ATTR_NONE,
     93            &anon_backend, NULL);
    9894        if (!area)
    9995                return ENOMEM;
  • kernel/generic/src/proc/scheduler.c

    rbcaca55 r26aafe8  
    376376        context_save(&CPU->saved_context);
    377377        context_set(&CPU->saved_context, FADDR(scheduler_separated_stack),
    378             (uintptr_t) CPU->stack, CPU_STACK_SIZE);
     378            (uintptr_t) CPU->stack, STACK_SIZE);
    379379        context_restore(&CPU->saved_context);
    380380       
  • kernel/generic/src/proc/thread.c

    rbcaca55 r26aafe8  
    6868#include <errno.h>
    6969
    70 
    71 #ifndef LOADED_PROG_STACK_PAGES_NO
    72 #define LOADED_PROG_STACK_PAGES_NO 1
    73 #endif
    74 
    75 
    7670/** Thread states */
    7771const char *thread_states[] = {
     
    300294       
    301295        /* Not needed, but good for debugging */
    302         memsetb(thread->kstack, THREAD_STACK_SIZE * 1 << STACK_FRAMES, 0);
     296        memsetb(thread->kstack, STACK_SIZE, 0);
    303297       
    304298        irq_spinlock_lock(&tidlock, true);
     
    308302        context_save(&thread->saved_context);
    309303        context_set(&thread->saved_context, FADDR(cushion),
    310             (uintptr_t) thread->kstack, THREAD_STACK_SIZE);
     304            (uintptr_t) thread->kstack, STACK_SIZE);
    311305       
    312306        the_initialize((the_t *) thread->kstack);
     
    605599                printf("%-8" PRIu64 " %-14s %10p %-8s %10p %-5" PRIu32 "\n",
    606600                    thread->tid, name, thread, thread_states[thread->state],
    607                     thread->task, thread->task->context);
     601                    thread->task, thread->task->container);
    608602#endif
    609603       
     
    617611                printf("%-8" PRIu64 " %-14s %18p %-8s %18p %-5" PRIu32 "\n",
    618612                    thread->tid, name, thread, thread_states[thread->state],
    619                     thread->task, thread->task->context);
     613                    thread->task, thread->task->container);
    620614#endif
    621615       
     
    658652        else
    659653                printf("[id    ] [name        ] [address ] [state ] [task    ]"
    660                     " [ctx]\n");
     654                    " [ctn]\n");
    661655#endif
    662656       
     
    667661        } else
    668662                printf("[id    ] [name        ] [address         ] [state ]"
    669                     " [task            ] [ctx]\n");
     663                    " [task            ] [ctn]\n");
    670664#endif
    671665       
Note: See TracChangeset for help on using the changeset viewer.