mirror of
https://github.com/drasko/codezero.git
synced 2026-02-26 16:53:14 +01:00
SCHED_RESUME was omitted on execve() during thread_recycle. Now we do sched_init().
This caused the scheduler not to increment total priority count which in turn caused the system to have wrong amount of priorities.
This commit is contained in:
@@ -49,13 +49,35 @@ int thread_suspend(struct task_ids *ids)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int arch_clear_thread(struct ktcb *task)
|
int arch_clear_thread(struct ktcb *tcb)
|
||||||
{
|
{
|
||||||
memset(&task->context, 0, sizeof(task->context));
|
/* Remove from the global list */
|
||||||
task->context.spsr = ARM_MODE_USR;
|
tcb_remove(tcb);
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
BUG_ON(!is_page_aligned(tcb));
|
||||||
|
BUG_ON(tcb->wqh_pager.sleepers > 0);
|
||||||
|
BUG_ON(tcb->wqh_send.sleepers > 0);
|
||||||
|
BUG_ON(tcb->wqh_recv.sleepers > 0);
|
||||||
|
BUG_ON(!list_empty(&tcb->task_list));
|
||||||
|
BUG_ON(!list_empty(&tcb->rq_list));
|
||||||
|
BUG_ON(tcb->rq);
|
||||||
|
BUG_ON(tcb->nlocks);
|
||||||
|
BUG_ON(tcb->waiting_on);
|
||||||
|
BUG_ON(tcb->wq);
|
||||||
|
|
||||||
|
/* Reinitialise the context */
|
||||||
|
memset(&tcb->context, 0, sizeof(tcb->context));
|
||||||
|
tcb->context.spsr = ARM_MODE_USR;
|
||||||
|
|
||||||
/* Clear the page tables */
|
/* Clear the page tables */
|
||||||
remove_mapping_pgd_all_user(TASK_PGD(task));
|
remove_mapping_pgd_all_user(TASK_PGD(tcb));
|
||||||
|
|
||||||
|
/* Reinitialize all other fields */
|
||||||
|
tcb_init(tcb);
|
||||||
|
|
||||||
|
/* Add back to global list */
|
||||||
|
tcb_add(tcb);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -293,7 +315,7 @@ int thread_create(struct task_ids *ids, unsigned int flags)
|
|||||||
|
|
||||||
if ((err = thread_setup_space(new, ids, flags)) < 0) {
|
if ((err = thread_setup_space(new, ids, flags)) < 0) {
|
||||||
/* Since it hasn't initialised maturely, we delete it this way */
|
/* Since it hasn't initialised maturely, we delete it this way */
|
||||||
free_page(new);
|
free_page(new);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user