Subversion Repositories HelenOS-historic

Rev

Rev 640 | Rev 671 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 640 Rev 651
Line 80... Line 80...
80
    char *timestamp = " on " TIMESTAMP;
80
    char *timestamp = " on " TIMESTAMP;
81
#else
81
#else
82
    char *timestamp = "";
82
    char *timestamp = "";
83
#endif
83
#endif
84
 
84
 
85
 
-
 
86
config_t config;
85
config_t config;
87
context_t ctx;
86
context_t ctx;
88
 
87
 
89
/**
88
/**
90
 * These 'hardcoded' variables will be intialized by
89
 * These 'hardcoded' variables will be intialized by
Line 96... Line 95...
96
size_t hardcoded_kdata_size = 0;
95
size_t hardcoded_kdata_size = 0;
97
 
96
 
98
__address init_addr = 0;
97
__address init_addr = 0;
99
size_t init_size = 0;
98
size_t init_size = 0;
100
 
99
 
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;
-
 
117
 
-
 
118
void main_bsp(void);
100
void main_bsp(void);
119
void main_ap(void);
101
void main_ap(void);
120
 
102
 
121
/*
103
/*
122
 * These two functions prevent stack from underflowing during the
104
 * These two functions prevent stack from underflowing during the
Line 138... Line 120...
138
 */
120
 */
139
void main_bsp(void)
121
void main_bsp(void)
140
{
122
{
141
    config.cpu_count = 1;
123
    config.cpu_count = 1;
142
    config.cpu_active = 1;
124
    config.cpu_active = 1;
-
 
125
   
143
    config.base = hardcoded_load_address;
126
    config.base = hardcoded_load_address;
144
    config.memory_size = get_memory_size();
127
    config.memory_size = get_memory_size();
145
    config.init_addr = init_addr;
128
    config.init_addr = init_addr;
146
    config.init_size = init_size;
129
    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
   
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);
152
    config.kernel_size = kernel_size + CONFIG_STACK_SIZE;
140
    config.kernel_size = config.kernel_size + CONFIG_STACK_SIZE;
153
   
141
   
154
    context_save(&ctx);
142
    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);
157
    context_restore(&ctx);
144
    context_restore(&ctx);
158
    /* not reached */
145
    /* not reached */
159
}
146
}
160
 
147
 
161
 
148
 
Line 183... Line 170...
183
     * starts adding it's own handlers
170
     * starts adding it's own handlers
184
     */
171
     */
185
    exc_init();
172
    exc_init();
186
   
173
   
187
    arch_pre_mm_init();
174
    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);
189
    frame_init();
176
    frame_init();
190
    page_init();
177
    page_init();
191
    tlb_init();
178
    tlb_init();
192
    arch_post_mm_init();
179
    arch_post_mm_init();
193
 
180
   
194
    printf("%s, release %s (%s)%s\nBuilt%s for %s\n%s\n", project, release, name, revision, timestamp, arch, copyright);
181
    printf("%s, release %s (%s)%s\nBuilt%s for %s\n%s\n", project, release, name, revision, timestamp, arch, copyright);
195
    printf("%P: hardcoded_ktext_size=%dK, hardcoded_kdata_size=%dK\n",
182
    printf("%P: hardcoded_ktext_size=%dK, hardcoded_kdata_size=%dK\n",
196
        config.base, hardcoded_ktext_size/1024, hardcoded_kdata_size/1024);
183
        config.base, hardcoded_ktext_size/1024, hardcoded_kdata_size/1024);
197
 
184
 
198
    arch_pre_smp_init();
185
    arch_pre_smp_init();