Changeset 1fbbcd6 in mainline for src/main/main.c
- Timestamp:
- 2005-08-29T20:31:23Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 81887b7
- Parents:
- 4dd0704
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/main.c
r4dd0704 r1fbbcd6 74 74 size_t hardcoded_kdata_size = 0; 75 75 76 /* 77 * Size of memory in bytes taken by kernel and heap. 78 */ 79 static size_t kernel_size; 80 81 /* 82 * Extra space on heap to make the stack start on page boundary. 83 */ 84 static size_t heap_delta; 85 76 86 void main_bsp(void); 77 87 void main_ap(void); … … 86 96 static void main_ap_separated_stack(void); 87 97 88 89 98 /** Bootstrap CPU main kernel routine 90 99 * … … 98 107 config.cpu_count = 1; 99 108 config.cpu_active = 1; 100 size_t size, delta; 101 102 /* 103 * Calculate 'size' that kernel and heap occupies in memory. 104 */ 105 size = hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE; 106 107 /* 108 * We need the boot stack to start on page boundary. 109 * That is why 'delta' is calculated. 110 */ 111 delta = PAGE_SIZE - ((hardcoded_load_address + size) % PAGE_SIZE); 112 delta = (delta == PAGE_SIZE) ? 0 : delta; 113 114 size += delta; 109 110 kernel_size = hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE; 111 heap_delta = PAGE_SIZE - ((hardcoded_load_address + kernel_size) % PAGE_SIZE); 112 heap_delta = (heap_delta == PAGE_SIZE) ? 0 : heap_delta; 113 kernel_size += heap_delta; 115 114 116 115 config.base = hardcoded_load_address; 117 116 config.memory_size = get_memory_size(); 118 config.kernel_size = size + CONFIG_STACK_SIZE;117 config.kernel_size = kernel_size + CONFIG_STACK_SIZE; 119 118 120 119 context_save(&ctx); 121 context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + size, CONFIG_STACK_SIZE);120 context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + kernel_size, CONFIG_STACK_SIZE); 122 121 context_restore(&ctx); 123 122 /* not reached */ … … 136 135 thread_t *t; 137 136 137 THE->preemption_disabled = 0; 138 THE->cpu = NULL; 139 THE->thread = NULL; 140 THE->task = NULL; 141 138 142 arch_pre_mm_init(); 139 140 heap_init(config.base + hardcoded_ktext_size + hardcoded_kdata_size, CONFIG_HEAP_SIZE); 143 heap_init(config.base + hardcoded_ktext_size + hardcoded_kdata_size, CONFIG_HEAP_SIZE + heap_delta); 141 144 frame_init(); 142 145 page_init();
Note:
See TracChangeset
for help on using the changeset viewer.