Rev 298 | Rev 373 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 298 | Rev 369 | ||
---|---|---|---|
Line 78... | Line 78... | ||
78 | * Size of memory in bytes taken by kernel and heap. |
78 | * Size of memory in bytes taken by kernel and heap. |
79 | */ |
79 | */ |
80 | static size_t kernel_size; |
80 | static size_t kernel_size; |
81 | 81 | ||
82 | /* |
82 | /* |
- | 83 | * Size of heap. |
|
- | 84 | */ |
|
- | 85 | static size_t heap_size; |
|
- | 86 | ||
- | 87 | /* |
|
83 | * Extra space on heap to make the stack start on page boundary. |
88 | * Extra space on heap to make the stack start on page boundary. |
84 | */ |
89 | */ |
85 | static size_t heap_delta; |
90 | static size_t heap_delta; |
86 | 91 | ||
87 | void main_bsp(void); |
92 | void main_bsp(void); |
Line 105... | Line 110... | ||
105 | */ |
110 | */ |
106 | void main_bsp(void) |
111 | void main_bsp(void) |
107 | { |
112 | { |
108 | config.cpu_count = 1; |
113 | config.cpu_count = 1; |
109 | config.cpu_active = 1; |
114 | config.cpu_active = 1; |
- | 115 | config.base = hardcoded_load_address; |
|
- | 116 | config.memory_size = get_memory_size(); |
|
- | 117 | ||
- | 118 | heap_size = CONFIG_HEAP_SIZE + (config.memory_size/FRAME_SIZE)*sizeof(frame_t); |
|
110 | 119 | ||
111 | kernel_size = hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE; |
120 | kernel_size = hardcoded_ktext_size + hardcoded_kdata_size + heap_size; |
112 | heap_delta = PAGE_SIZE - ((hardcoded_load_address + kernel_size) % PAGE_SIZE); |
121 | heap_delta = PAGE_SIZE - ((hardcoded_load_address + kernel_size) % PAGE_SIZE); |
113 | heap_delta = (heap_delta == PAGE_SIZE) ? 0 : heap_delta; |
122 | heap_delta = (heap_delta == PAGE_SIZE) ? 0 : heap_delta; |
114 | kernel_size += heap_delta; |
123 | kernel_size += heap_delta; |
115 | 124 | ||
116 | config.base = hardcoded_load_address; |
- | |
117 | config.memory_size = get_memory_size(); |
- | |
118 | config.kernel_size = kernel_size + CONFIG_STACK_SIZE; |
125 | config.kernel_size = kernel_size + CONFIG_STACK_SIZE; |
119 | 126 | ||
120 | context_save(&ctx); |
127 | context_save(&ctx); |
121 | early_mapping(config.base + hardcoded_ktext_size + hardcoded_kdata_size + heap_delta, CONFIG_STACK_SIZE + CONFIG_HEAP_SIZE); |
128 | early_mapping(config.base + hardcoded_ktext_size + hardcoded_kdata_size + heap_delta, CONFIG_STACK_SIZE + heap_size); |
122 | context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + kernel_size, CONFIG_STACK_SIZE); |
129 | context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + kernel_size, CONFIG_STACK_SIZE); |
123 | context_restore(&ctx); |
130 | context_restore(&ctx); |
124 | /* not reached */ |
131 | /* not reached */ |
125 | } |
132 | } |
126 | 133 | ||
Line 137... | Line 144... | ||
137 | thread_t *t; |
144 | thread_t *t; |
138 | 145 | ||
139 | the_initialize(THE); |
146 | the_initialize(THE); |
140 | 147 | ||
141 | arch_pre_mm_init(); |
148 | arch_pre_mm_init(); |
142 | heap_init(config.base + hardcoded_ktext_size + hardcoded_kdata_size, CONFIG_HEAP_SIZE + heap_delta); |
149 | heap_init(config.base + hardcoded_ktext_size + hardcoded_kdata_size, heap_size + heap_delta); |
143 | frame_init(); |
150 | frame_init(); |
144 | page_init(); |
151 | page_init(); |
145 | tlb_init(); |
152 | tlb_init(); |
146 | 153 | ||
147 | arch_post_mm_init(); |
154 | arch_post_mm_init(); |