Changeset e0cdb7b6 in mainline for src/main/main.c


Ignore:
Timestamp:
2005-10-10T11:15:50Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a016b63
Parents:
ac5665a
Message:

Add ALIGN() macro.

Fix usage of early_mapping() in main.c.
The previous version would not map part of the heap.
Please, review.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/main.c

    rac5665a re0cdb7b6  
    3838#include <main/kinit.h>
    3939#include <cpu.h>
     40#include <align.h>
    4041
    4142#ifdef __SMP__
     
    8687static size_t heap_size;
    8788
    88 /*
    89  * Extra space on heap to make the stack start on page boundary.
     89
     90/*
     91 * Extra space between heap and stack
     92 * enforced by alignment requirements.
    9093 */
    9194static size_t heap_delta;
     
    118121
    119122        heap_size = CONFIG_HEAP_SIZE + (config.memory_size/FRAME_SIZE)*sizeof(frame_t);
    120        
    121         kernel_size = hardcoded_ktext_size + hardcoded_kdata_size + heap_size;
    122         heap_delta = PAGE_SIZE - ((hardcoded_load_address + kernel_size) % PAGE_SIZE);
    123         heap_delta = (heap_delta == PAGE_SIZE) ? 0 : heap_delta;
    124         kernel_size += heap_delta;
     123        kernel_size = ALIGN(hardcoded_ktext_size + hardcoded_kdata_size + heap_size, PAGE_SIZE);
     124        heap_delta = kernel_size - (hardcoded_ktext_size + hardcoded_kdata_size + heap_size);
    125125       
    126126        config.kernel_size = kernel_size + CONFIG_STACK_SIZE;
    127127       
    128128        context_save(&ctx);
    129         early_mapping(config.base + hardcoded_ktext_size + hardcoded_kdata_size + heap_delta, CONFIG_STACK_SIZE + heap_size);
     129        early_mapping(config.base + hardcoded_ktext_size + hardcoded_kdata_size, CONFIG_STACK_SIZE + heap_size + heap_delta);
    130130        context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + kernel_size, CONFIG_STACK_SIZE);
    131131        context_restore(&ctx);
Note: See TracChangeset for help on using the changeset viewer.