Changeset e0cdb7b6 in mainline


Ignore:
Timestamp:
2005-10-10T11:15:50Z (19 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.

Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • arch/ia64/include/context.h

    rac5665a re0cdb7b6  
    3131
    3232#include <arch/types.h>
     33#include <align.h>
    3334
    3435#define STACK_ITEM_SIZE 16
     36#define STACK_ALIGNMENT 16
    3537
    3638/*
     
    4648#endif
    4749
    48 #define context_set(c, _pc, stack, size)                        \
    49         (c)->pc = (__address) _pc;                              \
    50         (c)->bsp = ((__address) stack) + (sizeof(the_t));       \
     50#define context_set(c, _pc, stack, size)                                                \
     51        (c)->pc = (__address) _pc;                                                      \
     52        (c)->bsp = ((__address) stack) + (ALIGN(sizeof(the_t), STACK_ALIGNMENT));       \
    5153        (c)->sp = ((__address) stack) + (size) - SP_DELTA;
    5254
  • 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.