Changeset d1da1ff2 in mainline for kernel/generic/src/main/main.c


Ignore:
Timestamp:
2018-11-01T22:20:13Z (5 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2e4343b
Parents:
a6e55886
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-11-01 16:25:16)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-11-01 22:20:13)
Message:

Fix kernel stack allocation

File:
1 edited

Legend:

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

    ra6e55886 rd1da1ff2  
    173173            ALIGN_UP((uintptr_t) kdata_end - config.base, PAGE_SIZE);
    174174
     175        // XXX: All kernel stacks must be aligned to STACK_SIZE,
     176        //      see get_current().
     177
    175178        /* Place the stack after the kernel, init and ballocs. */
    176         config.stack_base = config.base + config.kernel_size;
     179        config.stack_base =
     180            ALIGN_UP(config.base + config.kernel_size, STACK_SIZE);
    177181        config.stack_size = STACK_SIZE;
    178182
     
    181185        for (i = 0; i < init.cnt; i++) {
    182186                uintptr_t p = init.tasks[i].paddr + init.tasks[i].size;
    183                 uintptr_t bottom = PA2KA(ALIGN_UP(p, PAGE_SIZE));
     187                uintptr_t bottom = PA2KA(ALIGN_UP(p, STACK_SIZE));
    184188
    185189                if (config.stack_base < bottom)
     
    190194        if (ballocs.size) {
    191195                uintptr_t bottom =
    192                     ALIGN_UP(ballocs.base + ballocs.size, PAGE_SIZE);
     196                    ALIGN_UP(ballocs.base + ballocs.size, STACK_SIZE);
    193197                if (config.stack_base < bottom)
    194198                        config.stack_base = bottom;
     
    196200
    197201        if (config.stack_base < stack_safe)
    198                 config.stack_base = ALIGN_UP(stack_safe, PAGE_SIZE);
     202                config.stack_base = ALIGN_UP(stack_safe, STACK_SIZE);
    199203
    200204        context_save(&ctx);
Note: See TracChangeset for help on using the changeset viewer.