Changeset 26aafe8 in mainline


Ignore:
Timestamp:
2011-05-19T16:47:49Z (13 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
Files:
40 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/abs32le/include/mm/as.h

    rbcaca55 r26aafe8  
    4343#define USER_ADDRESS_SPACE_END_ARCH      UINT32_C(0x7fffffff)
    4444
    45 #define USTACK_ADDRESS_ARCH  (USER_ADDRESS_SPACE_END_ARCH - (PAGE_SIZE - 1))
    46 
    4745typedef struct {
    4846} as_arch_t;
  • kernel/arch/amd64/include/mm/as.h

    rbcaca55 r26aafe8  
    4343#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT64_C(0xffff800000000000)
    4444#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT64_C(0xffffffffffffffff)
    45 
    46 #define USER_ADDRESS_SPACE_START_ARCH  UINT64_C(0x0000000000000000)
    47 #define USER_ADDRESS_SPACE_END_ARCH    UINT64_C(0x00007fffffffffff)
    48 
    49 #define USTACK_ADDRESS_ARCH  (USER_ADDRESS_SPACE_END_ARCH - (PAGE_SIZE - 1))
     45#define USER_ADDRESS_SPACE_START_ARCH    UINT64_C(0x0000000000000000)
     46#define USER_ADDRESS_SPACE_END_ARCH      UINT64_C(0x00007fffffffffff)
    5047
    5148#define as_constructor_arch(as, flags)  (as != as)
  • kernel/arch/amd64/src/proc/scheduler.c

    rbcaca55 r26aafe8  
    5656{
    5757        CPU->arch.tss->rsp0 =
    58             (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE];
     58            (uintptr_t) &THREAD->kstack[STACK_SIZE];
    5959       
    6060        /*
  • kernel/arch/amd64/src/userspace.c

    rbcaca55 r26aafe8  
    6666                "iretq\n"
    6767                :: [udata_des] "i" (GDT_SELECTOR(UDATA_DES) | PL_USER),
    68                    [stack_size] "r" (kernel_uarg->uspace_stack + THREAD_STACK_SIZE),
     68                   [stack_size] "r" (kernel_uarg->uspace_stack + STACK_SIZE),
    6969                   [ipl] "r" (ipl),
    7070                   [utext_des] "i" (GDT_SELECTOR(UTEXT_DES) | PL_USER),
  • kernel/arch/arm32/include/mm/as.h

    rbcaca55 r26aafe8  
    3737#define KERN_arm32_AS_H_
    3838
    39 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH      0
     39#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
    4040
    41 #define KERNEL_ADDRESS_SPACE_START_ARCH     (unsigned long) 0x80000000
    42 #define KERNEL_ADDRESS_SPACE_END_ARCH       (unsigned long) 0xffffffff
    43 #define USER_ADDRESS_SPACE_START_ARCH       (unsigned long) 0x00000000
    44 #define USER_ADDRESS_SPACE_END_ARCH         (unsigned long) 0x7fffffff
    45 
    46 #define USTACK_ADDRESS_ARCH     (0x80000000 - PAGE_SIZE)
     41#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT32_C(0x80000000)
     42#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT32_C(0xffffffff)
     43#define USER_ADDRESS_SPACE_START_ARCH    UINT32_C(0x00000000)
     44#define USER_ADDRESS_SPACE_END_ARCH      UINT32_C(0x7fffffff)
    4745
    4846typedef struct {
  • kernel/arch/arm32/src/arm32.c

    rbcaca55 r26aafe8  
    134134        uint8_t *stck;
    135135       
    136         stck = &THREAD->kstack[THREAD_STACK_SIZE - SP_DELTA];
     136        stck = &THREAD->kstack[STACK_SIZE - SP_DELTA];
    137137        supervisor_sp = (uintptr_t) stck;
    138138}
  • kernel/arch/arm32/src/userspace.c

    rbcaca55 r26aafe8  
    3838
    3939/** Struct for holding all general purpose registers.
    40  * 
     40 *
    4141 *  Used to set registers when going to userspace.
    4242 */
     
    6060} ustate_t;
    6161
    62 /** Changes processor mode and jumps to the address specified in the first
    63  * parameter.
     62/** Change processor mode
    6463 *
    65  *  @param kernel_uarg   Userspace settings (entry point, stack, ...).
     64 * @param kernel_uarg Userspace settings (entry point, stack, ...).
     65 *
    6666 */
    6767void userspace(uspace_arg_t *kernel_uarg)
     
    7979
    8080        /* clear other registers */
    81         ustate.r3  = ustate.r4  = ustate.r5 = ustate.r6 = ustate.r7 =
    82             ustate.r8 = ustate.r9 = ustate.r10 = ustate.r11 = ustate.r12 =
    83             ustate.lr = 0;
     81        ustate.r3 = 0;
     82        ustate.r4 = 0;
     83        ustate.r5 = 0;
     84        ustate.r6 = 0;
     85        ustate.r7 = 0;
     86        ustate.r8 = 0;
     87        ustate.r9 = 0;
     88        ustate.r10 = 0;
     89        ustate.r11 = 0;
     90        ustate.r12 = 0;
     91        ustate.lr = 0;
    8492
    8593        /* set user stack */
    86         ustate.sp = ((uint32_t)kernel_uarg->uspace_stack) + PAGE_SIZE;
     94        ustate.sp = ((uint32_t)kernel_uarg->uspace_stack) + STACK_SIZE;
    8795
    8896        /* set where uspace execution starts */
  • kernel/arch/ia32/include/mm/as.h

    rbcaca55 r26aafe8  
    4343#define USER_ADDRESS_SPACE_END_ARCH      UINT32_C(0x7fffffff)
    4444
    45 #define USTACK_ADDRESS_ARCH  (USER_ADDRESS_SPACE_END_ARCH - (PAGE_SIZE - 1))
    46 
    4745typedef struct {
    4846} as_arch_t;
  • kernel/arch/ia32/src/proc/scheduler.c

    rbcaca55 r26aafe8  
    5858void before_thread_runs_arch(void)
    5959{
    60         uintptr_t kstk = (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE];
     60        uintptr_t kstk = (uintptr_t) &THREAD->kstack[STACK_SIZE];
    6161       
    6262        if (CPU->arch.fi.bits.sep) {
  • kernel/arch/ia32/src/userspace.c

    rbcaca55 r26aafe8  
    7676                :
    7777                : [udata_des] "i" (GDT_SELECTOR(UDATA_DES) | PL_USER),
    78                   [stack_size] "r" ((uint8_t *) kernel_uarg->uspace_stack + THREAD_STACK_SIZE),
     78                  [stack_size] "r" ((uint8_t *) kernel_uarg->uspace_stack + STACK_SIZE),
    7979                  [ipl] "r" (ipl),
    8080                  [utext_des] "i" (GDT_SELECTOR(UTEXT_DES) | PL_USER),
  • kernel/arch/ia64/include/arch.h

    rbcaca55 r26aafe8  
    3636#define KERN_ia64_ARCH_H_
    3737
    38 #define LOADED_PROG_STACK_PAGES_NO 2
    39 
    4038#include <arch/drivers/ski.h>
    4139
  • kernel/arch/ia64/include/asm.h

    rbcaca55 r26aafe8  
    131131NO_TRACE static inline uintptr_t get_stack_base(void)
    132132{
    133         uint64_t v;
     133        uint64_t value;
    134134       
    135135        /*
     
    152152        asm volatile (
    153153                "mov %[value] = r12"
    154                 : [value] "=r" (v)
    155         );
    156        
    157         return (v & (~(STACK_SIZE - 1)));
     154                : [value] "=r" (value)
     155        );
     156       
     157        return (value & (~(STACK_SIZE - 1)));
    158158}
    159159
  • kernel/arch/ia64/include/mm/as.h

    rbcaca55 r26aafe8  
    3838#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
    3939
    40 #define KERNEL_ADDRESS_SPACE_START_ARCH  ((unsigned long) 0xe000000000000000ULL)
    41 #define KERNEL_ADDRESS_SPACE_END_ARCH    ((unsigned long) 0xffffffffffffffffULL)
    42 #define USER_ADDRESS_SPACE_START_ARCH    ((unsigned long) 0x0000000000000000ULL)
    43 #define USER_ADDRESS_SPACE_END_ARCH      ((unsigned long) 0xdfffffffffffffffULL)
     40#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT64_C(0xe000000000000000)
     41#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT64_C(0xffffffffffffffff)
     42#define USER_ADDRESS_SPACE_START_ARCH    UINT64_C(0x0000000000000000)
     43#define USER_ADDRESS_SPACE_END_ARCH      UINT64_C(0xdfffffffffffffff)
    4444
    45 #define USTACK_ADDRESS_ARCH  0x0000000ff0000000ULL
     45#define USTACK_ADDRESS_ARCH  UINT64_C(0x0000000ff0000000)
    4646
    4747typedef struct {
  • kernel/arch/ia64/include/mm/frame.h

    rbcaca55 r26aafe8  
    4949#define physmem_print()
    5050
    51 #define ARCH_STACK_FRAMES TWO_FRAMES
    52 
    5351#endif /* __ASM__ */
    5452#endif /* KERNEL */
  • kernel/arch/ia64/src/ia64.c

    rbcaca55 r26aafe8  
    250250
    251251        switch_to_userspace((uintptr_t) kernel_uarg->uspace_entry,
    252             ((uintptr_t) kernel_uarg->uspace_stack) + PAGE_SIZE -
     252            ((uintptr_t) kernel_uarg->uspace_stack) + STACK_SIZE -
    253253            ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT),
    254             ((uintptr_t) kernel_uarg->uspace_stack) + PAGE_SIZE,
     254            ((uintptr_t) kernel_uarg->uspace_stack) + STACK_SIZE,
    255255            (uintptr_t) kernel_uarg->uspace_uarg, psr.value, rsc.value);
    256256
  • kernel/arch/ia64/src/proc/scheduler.c

    rbcaca55 r26aafe8  
    8686                "bsw.1\n"
    8787                :
    88                 : "r" (&THREAD->kstack[THREAD_STACK_SIZE]),
    89                   "r" (&THREAD->kstack[THREAD_STACK_SIZE - SP_DELTA])
     88                : "r" (&THREAD->kstack[STACK_SIZE]),
     89                  "r" (&THREAD->kstack[STACK_SIZE - SP_DELTA])
    9090                );
    9191}
  • kernel/arch/mips32/include/mm/as.h

    rbcaca55 r26aafe8  
    3838#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
    3939
    40 #define KERNEL_ADDRESS_SPACE_START_ARCH         (unsigned long) 0x80000000
    41 #define KERNEL_ADDRESS_SPACE_END_ARCH           (unsigned long) 0x9fffffff
    42 #define USER_ADDRESS_SPACE_START_ARCH           (unsigned long) 0x00000000
    43 #define USER_ADDRESS_SPACE_END_ARCH             (unsigned long) 0x7fffffff
    44 
    45 #define USTACK_ADDRESS_ARCH     (0x80000000 - PAGE_SIZE)
     40#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT32_C(0x80000000)
     41#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT32_C(0x9fffffff)
     42#define USER_ADDRESS_SPACE_START_ARCH    UINT32_C(0x00000000)
     43#define USER_ADDRESS_SPACE_END_ARCH      UINT32_C(0x7fffffff)
    4644
    4745typedef struct {
  • kernel/arch/mips32/src/mips32.c

    rbcaca55 r26aafe8  
    220220            cp0_status_um_bit | cp0_status_ie_enabled_bit));
    221221        cp0_epc_write((uintptr_t) kernel_uarg->uspace_entry);
    222         userspace_asm(((uintptr_t) kernel_uarg->uspace_stack + PAGE_SIZE),
     222        userspace_asm(((uintptr_t) kernel_uarg->uspace_stack + STACK_SIZE),
    223223            (uintptr_t) kernel_uarg->uspace_uarg,
    224224            (uintptr_t) kernel_uarg->uspace_entry);
     
    235235void before_thread_runs_arch(void)
    236236{
    237         supervisor_sp = (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE -
    238             SP_DELTA];
     237        supervisor_sp =
     238            (uintptr_t) &THREAD->kstack[STACK_SIZE - SP_DELTA];
    239239}
    240240
  • kernel/arch/ppc32/include/boot/boot.h

    rbcaca55 r26aafe8  
    3737
    3838#define BOOT_OFFSET  0x8000
    39 
    40 /* Temporary stack size for boot process */
    41 #define TEMP_STACK_SIZE  0x1000
    4239
    4340#define TASKMAP_MAX_RECORDS        32
  • kernel/arch/ppc32/include/istate.h

    rbcaca55 r26aafe8  
    7373        uint32_t cr;
    7474        uint32_t pc;
    75         uint32_t srr1;
     75        uint32_t msr;
    7676        uint32_t lr;
    7777        uint32_t ctr;
     
    9090/** Return true if exception happened while in userspace
    9191 *
    92  * The contexts of MSR register was stored in SRR1.
    93  *
    9492 */
    9593NO_TRACE static inline int istate_from_uspace(istate_t *istate)
    9694{
    97         return (istate->srr1 & MSR_PR) != 0;
     95        return (istate->msr & MSR_PR) != 0;
    9896}
    9997
  • kernel/arch/ppc32/include/mm/as.h

    rbcaca55 r26aafe8  
    3838#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
    3939
    40 #define KERNEL_ADDRESS_SPACE_START_ARCH  ((unsigned long) 0x80000000)
    41 #define KERNEL_ADDRESS_SPACE_END_ARCH    ((unsigned long) 0xffffffff)
    42 #define USER_ADDRESS_SPACE_START_ARCH    ((unsigned long) 0x00000000)
    43 #define USER_ADDRESS_SPACE_END_ARCH      ((unsigned long) 0x7fffffff)
    44 
    45 #define USTACK_ADDRESS_ARCH  (0x7fffffff - (PAGE_SIZE - 1))
     40#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT32_C(0x80000000)
     41#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT32_C(0xffffffff)
     42#define USER_ADDRESS_SPACE_START_ARCH    UINT32_C(0x00000000)
     43#define USER_ADDRESS_SPACE_END_ARCH      UINT32_C(0x7fffffff)
    4644
    4745typedef struct {
  • kernel/arch/ppc32/src/boot/boot.S

    rbcaca55 r26aafe8  
    2828
    2929#include <arch/asm/regname.h>
    30 #include <arch/boot/boot.h>
     30#include <config.h>
    3131
    3232.section K_TEXT_START, "ax"
     
    5656.align 12
    5757kernel_stack_bottom:
    58         .space TEMP_STACK_SIZE
     58        .space STACK_SIZE
    5959kernel_stack:
  • kernel/arch/ppc32/src/mm/tlb.c

    rbcaca55 r26aafe8  
    223223                switch (pfrc) {
    224224                case AS_PF_FAULT:
    225                         goto fail;
    226                         break;
     225                        page_table_unlock(as, true);
     226                        pht_refill_fail(badvaddr, istate);
     227                        return;
    227228                case AS_PF_DEFER:
    228229                        /*
     
    242243       
    243244        page_table_unlock(as, true);
    244         return;
    245        
    246 fail:
    247         page_table_unlock(as, true);
    248         pht_refill_fail(badvaddr, istate);
    249245}
    250246
  • kernel/arch/ppc32/src/ppc32.c

    rbcaca55 r26aafe8  
    265265{
    266266        userspace_asm((uintptr_t) kernel_uarg->uspace_uarg,
    267             (uintptr_t) kernel_uarg->uspace_stack +
    268             THREAD_STACK_SIZE - SP_DELTA,
     267            (uintptr_t) kernel_uarg->uspace_stack + STACK_SIZE - SP_DELTA,
    269268            (uintptr_t) kernel_uarg->uspace_entry);
    270269       
  • kernel/arch/ppc32/src/proc/scheduler.c

    rbcaca55 r26aafe8  
    5555        asm volatile (
    5656                "mtsprg0 %[ksp]\n"
    57                 :: [ksp] "r" (KA2PA(&THREAD->kstack[THREAD_STACK_SIZE - SP_DELTA]))
     57                :: [ksp] "r" (KA2PA(&THREAD->kstack[STACK_SIZE - SP_DELTA]))
    5858        );
    5959}
  • kernel/arch/sparc64/include/mm/sun4u/as.h

    rbcaca55 r26aafe8  
    2727 */
    2828
    29 /** @addtogroup sparc64mm       
     29/** @addtogroup sparc64mm
    3030 * @{
    3131 */
     
    3838#include <arch/mm/tte.h>
    3939
    40 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH      1
     40#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  1
    4141
    42 #define KERNEL_ADDRESS_SPACE_START_ARCH         (unsigned long) 0x0000000000000000
    43 #define KERNEL_ADDRESS_SPACE_END_ARCH           (unsigned long) 0xffffffffffffffff
    44 #define USER_ADDRESS_SPACE_START_ARCH           (unsigned long) 0x0000000000000000
    45 #define USER_ADDRESS_SPACE_END_ARCH             (unsigned long) 0xffffffffffffffff
    46 
    47 #define USTACK_ADDRESS_ARCH     (0xffffffffffffffffULL - (PAGE_SIZE - 1))
     42#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT64_C(0x0000000000000000)
     43#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT64_C(0xffffffffffffffff)
     44#define USER_ADDRESS_SPACE_START_ARCH    UINT64_C(0x0000000000000000)
     45#define USER_ADDRESS_SPACE_END_ARCH      UINT64_C(0xffffffffffffffff)
    4846
    4947#ifdef CONFIG_TSB
  • kernel/arch/sparc64/include/mm/sun4v/as.h

    rbcaca55 r26aafe8  
    4040#include <arch/mm/tsb.h>
    4141
    42 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH      1
     42#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  1
    4343
    44 #define KERNEL_ADDRESS_SPACE_START_ARCH         (unsigned long) 0x0000000000000000
    45 #define KERNEL_ADDRESS_SPACE_END_ARCH           (unsigned long) 0xffffffffffffffff
    46 #define USER_ADDRESS_SPACE_START_ARCH           (unsigned long) 0x0000000000000000
    47 #define USER_ADDRESS_SPACE_END_ARCH             (unsigned long) 0xffffffffffffffff
    48 
    49 #define USTACK_ADDRESS_ARCH     (0xffffffffffffffffULL - (PAGE_SIZE - 1))
     44#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT64_C(0x0000000000000000)
     45#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT64_C(0xffffffffffffffff)
     46#define USER_ADDRESS_SPACE_START_ARCH    UINT64_C(0x0000000000000000)
     47#define USER_ADDRESS_SPACE_END_ARCH      UINT64_C(0xffffffffffffffff)
    5048
    5149#ifdef CONFIG_TSB
  • kernel/generic/include/config.h

    rbcaca55 r26aafe8  
    3636#define KERN_CONFIG_H_
    3737
    38 #include <typedefs.h>
    3938#include <arch/mm/page.h>
    4039
    41 #define STACK_SIZE  PAGE_SIZE
     40#define ONE_FRAME    0
     41#define TWO_FRAMES   1
     42#define FOUR_FRAMES  2
     43
     44#define STACK_FRAMES  TWO_FRAMES
     45#define STACK_SIZE    ((1 << STACK_FRAMES) << PAGE_WIDTH)
    4246
    4347#define CONFIG_INIT_TASKS        32
    4448#define CONFIG_TASK_NAME_BUFLEN  32
     49
     50#ifndef __ASM__
     51
     52#include <typedefs.h>
    4553
    4654typedef struct {
     
    8088extern ballocs_t ballocs;
    8189
     90#endif /* __ASM__ */
     91
    8292#endif
    8393
  • kernel/generic/include/cpu.h

    rbcaca55 r26aafe8  
    4141#include <arch/cpu.h>
    4242#include <arch/context.h>
    43 
    44 #define CPU_STACK_SIZE  STACK_SIZE
    4543
    4644/** CPU structure.
  • kernel/generic/include/mm/as.h

    rbcaca55 r26aafe8  
    8484#define USER_ADDRESS_SPACE_END      USER_ADDRESS_SPACE_END_ARCH
    8585
    86 #define USTACK_ADDRESS  USTACK_ADDRESS_ARCH
     86#ifdef USTACK_ADDRESS_ARCH
     87        #define USTACK_ADDRESS  USTACK_ADDRESS_ARCH
     88#else
     89        #define USTACK_ADDRESS  (USER_ADDRESS_SPACE_END - (STACK_SIZE - 1))
     90#endif
    8791
    8892/** Kernel address space. */
  • kernel/generic/include/mm/frame.h

    rbcaca55 r26aafe8  
    4444#include <arch/mm/page.h>
    4545#include <arch/mm/frame.h>
    46 
    47 #define ONE_FRAME    0
    48 #define TWO_FRAMES   1
    49 #define FOUR_FRAMES  2
    50 
    51 
    52 #ifdef ARCH_STACK_FRAMES
    53         #define STACK_FRAMES  ARCH_STACK_FRAMES
    54 #else
    55         #define STACK_FRAMES  ONE_FRAME
    56 #endif
    5746
    5847/** Maximum number of zones in the system. */
  • kernel/generic/include/proc/task.h

    rbcaca55 r26aafe8  
    7878        /** Unique identity of task. */
    7979        task_id_t taskid;
    80         /** Task security context. */
    81         context_id_t context;
     80        /** Task security container. */
     81        container_id_t container;
    8282       
    8383        /** Number of references (i.e. threads). */
  • kernel/generic/include/proc/thread.h

    rbcaca55 r26aafe8  
    4949#include <sysinfo/abi.h>
    5050
    51 #define THREAD_STACK_SIZE   STACK_SIZE
    5251#define THREAD_NAME_BUFLEN  20
    5352
  • kernel/generic/include/proc/uarg.h

    rbcaca55 r26aafe8  
    4040        void *uspace_entry;
    4141        void *uspace_stack;
    42 
     42       
    4343        void (* uspace_thread_function)();
    4444        void *uspace_thread_arg;
  • kernel/generic/include/typedefs.h

    rbcaca55 r26aafe8  
    6464typedef uint64_t thread_id_t;
    6565typedef uint64_t task_id_t;
    66 typedef uint32_t context_id_t;
     66typedef uint32_t container_id_t;
    6767
    6868typedef int32_t inr_t;
  • 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.