Hi,
On 09/17/2014 10:23 AM, Björn Döbel wrote:
An fpage() wants an address and a size. Your malloc() call yields an address (note: this is probably unaligned, maybe prefer to use posix_memalign()), the size is what you pass to malloc(). What would be the problem?
Still the same problem, I'm getting page faults at the head of the thread function with the following new code:
// Out of function l4_umword_t *thread_stacks[THREAD_MAX_NUM]; // ... void foo() { // ... unsigned stack_size = THREAD_STACK_SIZE * sizeof(l4_umword_t); if (posix_memalign((void**)&thread_stacks[count], (size_t)L4_LOG2_PAGESIZE, (size_t)stack_size) != 0) return -1; // ... l4_touch_rw(thread_stacks[count], stack_size); l4_task_map(task_cap, L4RE_THIS_TASK_CAP, l4_fpage((unsigned long)thread_stacks[count],
stack_size, L4_FPAGE_RWX),
l4_map_control((l4_umword_t)thread_stacks[count], 0, L4_MAP_ITEM_MAP));
// ... }
That is, if you execute the thread code within the parent?
Yes, I simply bind the new threads to the current task (L4RE_THIS_TASK_CAP) in this case.
Best regards, Valentin