/trunk/kernel/generic/include/config.h |
---|
55,7 → 55,17 |
init_task_t tasks[CONFIG_INIT_TASKS]; |
} init_t; |
/** Boot allocations. |
* |
* Allocatations made by the boot that are meant to be used by the kernel |
* are all recorded in the ballocs_t type. |
*/ |
typedef struct { |
uintptr_t base; |
size_t size; |
} ballocs_t; |
typedef struct { |
count_t cpu_count; /**< Number of processors detected. */ |
volatile count_t cpu_active; /**< Number of processors that are up and running. */ |
69,6 → 79,7 |
extern config_t config; |
extern init_t init; |
extern ballocs_t ballocs; |
#endif |
/trunk/kernel/generic/src/main/main.c |
---|
94,6 → 94,12 |
0 |
}; |
/** Boot allocations. */ |
ballocs_t ballocs = { |
.base = NULL, |
.size = 0 |
}; |
context_t ctx; |
/* |
105,7 → 111,7 |
size_t hardcoded_ktext_size = 0; /**< Size of the kernel code in bytes. */ |
size_t hardcoded_kdata_size = 0; /**< Size of the kernel data in bytes. */ |
uintptr_t stack_safe = 0; /**< Lowest safe stack virtual address */ |
uintptr_t stack_safe = 0; /**< Lowest safe stack virtual address */ |
void main_bsp(void); |
void main_ap(void); |
152,6 → 158,12 |
if (PA_overlaps(config.stack_base, config.stack_size, init.tasks[i].addr, init.tasks[i].size)) |
config.stack_base = ALIGN_UP(init.tasks[i].addr + init.tasks[i].size, config.stack_size); |
} |
/* Avoid placing stack on top of boot allocations. */ |
if (ballocs.size) { |
if (PA_overlaps(config.stack_base, config.stack_size, ballocs.base, ballocs.size)) |
config.stack_base = ALIGN_UP(ballocs.base + ballocs.size, PAGE_SIZE); |
} |
if (config.stack_base < stack_safe) |
config.stack_base = ALIGN_UP(stack_safe, PAGE_SIZE); |
/trunk/kernel/generic/src/mm/frame.c |
---|
1077,6 → 1077,9 |
for (i = 0; i < init.cnt; i++) |
frame_mark_unavailable(ADDR2PFN(KA2PA(init.tasks[i].addr)), SIZE2FRAMES(init.tasks[i].size)); |
if (ballocs.size) |
frame_mark_unavailable(ADDR2PFN(KA2PA(ballocs.base)), SIZE2FRAMES(ballocs.size)); |
/* Black list first frame, as allocating NULL would |
* fail in some places */ |
frame_mark_unavailable(0, 1); |