Subversion Repositories HelenOS

Rev

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

Rev 389 Rev 402
Line 35... Line 35...
35
#include <proc/scheduler.h>
35
#include <proc/scheduler.h>
36
#include <proc/thread.h>
36
#include <proc/thread.h>
37
#include <proc/task.h>
37
#include <proc/task.h>
38
#include <main/kinit.h>
38
#include <main/kinit.h>
39
#include <cpu.h>
39
#include <cpu.h>
-
 
40
#include <align.h>
40
 
41
 
41
#ifdef __SMP__
42
#ifdef __SMP__
42
#include <arch/smp/apic.h>
43
#include <arch/smp/apic.h>
43
#include <arch/smp/mps.h>
44
#include <arch/smp/mps.h>
44
#endif /* __SMP__ */
45
#endif /* __SMP__ */
Line 83... Line 84...
83
/*
84
/*
84
 * Size of heap.
85
 * Size of heap.
85
 */
86
 */
86
static size_t heap_size;
87
static size_t heap_size;
87
 
88
 
-
 
89
 
88
/*
90
/*
89
 * Extra space on heap to make the stack start on page boundary.
91
 * Extra space between heap and stack
-
 
92
 * enforced by alignment requirements.
90
 */
93
 */
91
static size_t heap_delta;
94
static size_t heap_delta;
92
 
95
 
93
void main_bsp(void);
96
void main_bsp(void);
94
void main_ap(void);
97
void main_ap(void);
Line 115... Line 118...
115
    config.cpu_active = 1;
118
    config.cpu_active = 1;
116
    config.base = hardcoded_load_address;
119
    config.base = hardcoded_load_address;
117
    config.memory_size = get_memory_size();
120
    config.memory_size = get_memory_size();
118
 
121
 
119
    heap_size = CONFIG_HEAP_SIZE + (config.memory_size/FRAME_SIZE)*sizeof(frame_t);
122
    heap_size = CONFIG_HEAP_SIZE + (config.memory_size/FRAME_SIZE)*sizeof(frame_t);
120
   
-
 
121
    kernel_size = hardcoded_ktext_size + hardcoded_kdata_size + heap_size;
123
    kernel_size = ALIGN(hardcoded_ktext_size + hardcoded_kdata_size + heap_size, PAGE_SIZE);
122
    heap_delta = PAGE_SIZE - ((hardcoded_load_address + kernel_size) % PAGE_SIZE);
124
    heap_delta = kernel_size - (hardcoded_ktext_size + hardcoded_kdata_size + heap_size);
123
    heap_delta = (heap_delta == PAGE_SIZE) ? 0 : heap_delta;
-
 
124
    kernel_size += heap_delta;
-
 
125
   
125
   
126
    config.kernel_size = kernel_size + CONFIG_STACK_SIZE;
126
    config.kernel_size = kernel_size + CONFIG_STACK_SIZE;
127
   
127
   
128
    context_save(&ctx);
128
    context_save(&ctx);
129
    early_mapping(config.base + hardcoded_ktext_size + hardcoded_kdata_size + heap_delta, CONFIG_STACK_SIZE + heap_size);
129
    early_mapping(config.base + hardcoded_ktext_size + hardcoded_kdata_size, CONFIG_STACK_SIZE + heap_size + heap_delta);
130
    context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + kernel_size, CONFIG_STACK_SIZE);
130
    context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + kernel_size, CONFIG_STACK_SIZE);
131
    context_restore(&ctx);
131
    context_restore(&ctx);
132
    /* not reached */
132
    /* not reached */
133
}
133
}
134
 
134