Subversion Repositories HelenOS-historic

Rev

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

Rev 174 Rev 177
Line 95... Line 95...
95
 */
95
 */
96
void main_bsp(void)
96
void main_bsp(void)
97
{
97
{
98
    config.cpu_count = 1;
98
    config.cpu_count = 1;
99
    config.cpu_active = 1;
99
    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;
100
 
115
 
101
    config.base = hardcoded_load_address;
116
    config.base = hardcoded_load_address;
102
    config.memory_size = get_memory_size();
117
    config.memory_size = get_memory_size();
103
    config.kernel_size = hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE + CONFIG_STACK_SIZE;
118
    config.kernel_size = size + CONFIG_STACK_SIZE;
104
 
119
 
105
    context_save(&ctx);
120
    context_save(&ctx);
106
    context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE, CONFIG_STACK_SIZE);
121
    context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + size, CONFIG_STACK_SIZE);
107
    context_restore(&ctx);
122
    context_restore(&ctx);
108
    /* not reached */
123
    /* not reached */
109
}
124
}
110
 
125
 
111
 
126