Bugfix: remove duplicate error check when loading a userspace ELF program
Also, remember to delete the allocated task, since we do not want memory leaks :)
This commit is contained in:
parent
159d025d9f
commit
309058888c
@ -121,16 +121,11 @@ void Scheduler::load_user_task(const char* filename)
|
|||||||
if (!image)
|
if (!image)
|
||||||
{
|
{
|
||||||
kerrorln("Failed to load %s from initrd", filename);
|
kerrorln("Failed to load %s from initrd", filename);
|
||||||
|
delete new_task;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new_task->regs.rip = image->entry;
|
new_task->regs.rip = image->entry;
|
||||||
new_task->image = image;
|
new_task->image = image;
|
||||||
if (!new_task->regs.rip)
|
|
||||||
{
|
|
||||||
kwarnln("Failed to load user task %s", filename);
|
|
||||||
delete new_task;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
new_task->allocated_stack = (uint64_t)MemoryManager::get_pages(
|
new_task->allocated_stack = (uint64_t)MemoryManager::get_pages(
|
||||||
TASK_PAGES_IN_STACK, MAP_READ_WRITE | MAP_USER); // 16 KB is enough for everyone, right?
|
TASK_PAGES_IN_STACK, MAP_READ_WRITE | MAP_USER); // 16 KB is enough for everyone, right?
|
||||||
new_task->regs.rsp = new_task->allocated_stack + (PAGE_SIZE * TASK_PAGES_IN_STACK) - sizeof(uintptr_t);
|
new_task->regs.rsp = new_task->allocated_stack + (PAGE_SIZE * TASK_PAGES_IN_STACK) - sizeof(uintptr_t);
|
||||||
|
Loading…
Reference in New Issue
Block a user