Changeset d6e8529 in mainline for generic/src/main/main.c


Ignore:
Timestamp:
2005-12-20T00:34:12Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fa7450c
Parents:
75e1db0
Message:

remove arch/$ARCH/boot where not needed, change global Makefile accordingly
remove early_mapping() (breaks ppc32 for now)
change early heap initialization (required for init to work)

File:
1 edited

Legend:

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

    r75e1db0 rd6e8529  
    8383#endif
    8484
    85 
    8685config_t config;
    8786context_t ctx;
     
    9897__address init_addr = 0;
    9998size_t init_size = 0;
    100 
    101 /**
    102  * Size of memory in bytes taken by kernel and heap.
    103  */
    104 static size_t kernel_size;
    105 
    106 /**
    107  * Size of heap.
    108  */
    109 static size_t heap_size;
    110 
    111 
    112 /**
    113  * Extra space between heap and stack
    114  * enforced by alignment requirements.
    115  */
    116 static size_t heap_delta;
    11799
    118100void main_bsp(void);
     
    141123        config.cpu_count = 1;
    142124        config.cpu_active = 1;
     125       
    143126        config.base = hardcoded_load_address;
    144127        config.memory_size = get_memory_size();
    145128        config.init_addr = init_addr;
    146129        config.init_size = init_size;
    147 
    148         heap_size = CONFIG_HEAP_SIZE + (config.memory_size/FRAME_SIZE)*sizeof(frame_t);
    149         kernel_size = ALIGN_UP(hardcoded_ktext_size + hardcoded_kdata_size + heap_size, PAGE_SIZE);
    150         heap_delta = kernel_size - (hardcoded_ktext_size + hardcoded_kdata_size + heap_size);
    151        
    152         config.kernel_size = kernel_size + CONFIG_STACK_SIZE;
     130       
     131        if (init_size > 0)
     132                config.heap_addr = init_addr + init_size;
     133        else
     134                config.heap_addr = hardcoded_load_address + hardcoded_ktext_size + hardcoded_kdata_size;
     135       
     136        config.heap_size = CONFIG_HEAP_SIZE + (config.memory_size / FRAME_SIZE) * sizeof(frame_t);
     137       
     138        config.kernel_size = ALIGN_UP(config.heap_addr - hardcoded_load_address + config.heap_size, PAGE_SIZE);
     139        config.heap_delta = config.kernel_size - (config.heap_addr - hardcoded_load_address + config.heap_size);
     140        config.kernel_size = config.kernel_size + CONFIG_STACK_SIZE;
    153141       
    154142        context_save(&ctx);
    155         early_mapping(config.base + hardcoded_ktext_size + hardcoded_kdata_size, CONFIG_STACK_SIZE + heap_size + heap_delta);
    156         context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + kernel_size, CONFIG_STACK_SIZE);
     143        context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + config.kernel_size, CONFIG_STACK_SIZE);
    157144        context_restore(&ctx);
    158145        /* not reached */
     
    186173       
    187174        arch_pre_mm_init();
    188         early_heap_init(config.base + hardcoded_ktext_size + hardcoded_kdata_size, heap_size + heap_delta);
     175        early_heap_init(config.heap_addr, config.heap_size + config.heap_delta);
    189176        frame_init();
    190177        page_init();
    191178        tlb_init();
    192179        arch_post_mm_init();
    193 
     180       
    194181        printf("%s, release %s (%s)%s\nBuilt%s for %s\n%s\n", project, release, name, revision, timestamp, arch, copyright);
    195182        printf("%P: hardcoded_ktext_size=%dK, hardcoded_kdata_size=%dK\n",
Note: See TracChangeset for help on using the changeset viewer.