mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
replace create_stack by a call of kmalloc
This commit is contained in:
parent
f18d064084
commit
45cae3f991
3 changed files with 4 additions and 20 deletions
|
@ -81,12 +81,6 @@ void* kmalloc(size_t sz);
|
|||
*/
|
||||
void kfree(void* addr);
|
||||
|
||||
/** @brief Create a new stack for a new task
|
||||
*
|
||||
* @return start address of the new stack
|
||||
*/
|
||||
void* create_stack(tid_t id);
|
||||
|
||||
/** @brief String to long
|
||||
*
|
||||
* @return Long value of the parsed numerical string
|
||||
|
|
|
@ -208,6 +208,9 @@ static void NORETURN do_exit(int arg)
|
|||
curr_task->heap = NULL;
|
||||
}
|
||||
|
||||
if (curr_task->stack)
|
||||
kfree(curr_task->stack);
|
||||
|
||||
// decrease the number of active tasks
|
||||
spinlock_irqsave_lock(&readyqueues[core_id].lock);
|
||||
readyqueues[core_id].nr_tasks--;
|
||||
|
@ -264,7 +267,7 @@ int create_task(tid_t* id, entry_point_t ep, void* arg, uint8_t prio, uint32_t c
|
|||
task_table[i].status = TASK_READY;
|
||||
task_table[i].last_core = 0;
|
||||
task_table[i].last_stack_pointer = NULL;
|
||||
task_table[i].stack = create_stack(i);
|
||||
task_table[i].stack = kmalloc(KERNEL_STACK_SIZE);
|
||||
task_table[i].prio = prio;
|
||||
spinlock_init(&task_table[i].vma_lock);
|
||||
task_table[i].vma_list = NULL;
|
||||
|
|
|
@ -45,7 +45,6 @@ extern uint32_t limit;
|
|||
extern const void kernel_start;
|
||||
extern const void kernel_end;
|
||||
|
||||
static char stack[MAX_TASKS-1][KERNEL_STACK_SIZE];
|
||||
static char bitmap[BITMAP_SIZE];
|
||||
|
||||
static spinlock_t bitmap_lock = SPINLOCK_INIT;
|
||||
|
@ -54,18 +53,6 @@ atomic_int32_t total_pages = ATOMIC_INIT(0);
|
|||
atomic_int32_t total_allocated_pages = ATOMIC_INIT(0);
|
||||
atomic_int32_t total_available_pages = ATOMIC_INIT(0);
|
||||
|
||||
void* create_stack(tid_t id)
|
||||
{
|
||||
// idle task uses stack, which is defined in entry.asm
|
||||
if (BUILTIN_EXPECT(!id, 0))
|
||||
return NULL;
|
||||
// do we have a valid task id?
|
||||
if (BUILTIN_EXPECT(id >= MAX_TASKS, 0))
|
||||
return NULL;
|
||||
|
||||
return (void*) stack[id-1];
|
||||
}
|
||||
|
||||
inline static int page_marked(size_t i)
|
||||
{
|
||||
size_t index = i >> 3;
|
||||
|
|
Loading…
Add table
Reference in a new issue