mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 10:01:57 +00:00
lx_emul: set task 'stack' member
Instead of allocating the stack via 'kmalloc' point it to the actual stack used by the task. This addresses issues with the USB host-controller driver where sometimes hub port enumeration is not working. Fixes #4522.
This commit is contained in:
parent
9375e8d010
commit
9d383037e4
@ -42,6 +42,8 @@ void lx_emul_task_schedule(int block);
|
||||
|
||||
void lx_emul_task_name(struct task_struct * task, const char * name);
|
||||
|
||||
void *lx_emul_task_stack(struct task_struct const * task);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -73,6 +73,7 @@ class Lx_kit::Task : public Genode::List<Lx_kit::Task>::Element
|
||||
Name name() const;
|
||||
void * lx_task() const;
|
||||
int pid() const;
|
||||
void * stack() const;
|
||||
|
||||
void block();
|
||||
void unblock();
|
||||
|
@ -77,13 +77,22 @@ pid_t kernel_thread(int (* fn)(void *),void * arg,unsigned long flags)
|
||||
.signal = signal,
|
||||
};
|
||||
|
||||
#ifndef CONFIG_THREAD_INFO_IN_TASK
|
||||
/* On arm, the 'thread_info' is hidden behind 'task->stack', we must
|
||||
* therefore initialise the member before calling 'task_thread_info()'. */
|
||||
task->stack = kmalloc(sizeof(struct thread_info), THREADINFO_GFP);
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_X86
|
||||
task_thread_info(task)->preempt_count = 0;
|
||||
#endif
|
||||
|
||||
lx_emul_task_create(task, "kthread", task->pid, fn, arg);
|
||||
|
||||
#ifdef CONFIG_THREAD_INFO_IN_TASK
|
||||
task->stack = lx_emul_task_stack(task);
|
||||
#endif
|
||||
|
||||
return task->pid;
|
||||
|
||||
err_task:
|
||||
|
@ -87,3 +87,16 @@ extern "C" void lx_emul_task_name(struct task_struct * t, const char * name)
|
||||
{
|
||||
Lx_kit::env().scheduler.task((void*)t).name(name);
|
||||
}
|
||||
|
||||
|
||||
extern "C" void * lx_emul_task_stack(struct task_struct const * t)
|
||||
{
|
||||
void * ret = nullptr;
|
||||
|
||||
Lx_kit::env().scheduler.for_each_task([&] (Lx_kit::Task const & task) {
|
||||
if (t == task.lx_task())
|
||||
ret = task.stack();
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -50,6 +50,9 @@ Task::Type Task::type() const { return _type; }
|
||||
void * Task::lx_task() const { return _lx_task; }
|
||||
|
||||
|
||||
void * Task::stack() const { return _stack; }
|
||||
|
||||
|
||||
int Task::pid() const { return _pid; }
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user