TASK_CREATE

Purpose

task_create creates a new task. 

Synopsis

#include <types.h> 
#include <stub.h> 

int task_create(Capability *code_seg, Capability *data_seg, Capability *task); 

Parameters

Description

task_create creates a new task with the code segment specified by code and the data segment specified by data. The created task is associated to a new capability that is returned through task. 

The code segment must contain only code. It is attached to the task's address space at address 0 and marked read-only. The entry point in the code segment must always be 0x00000000. The data segment is attached to the task's address space at address 0x00400000 (4 Mbytes). 

Return Values

On success, task_create returns 0 and task contains a valid owner capability for the created task. 

On fail, task_create returns a negative value indicating one of the following errors: 

See Also

task_destroy, task_status, task_self, task_exit, task_wait 

Notes

The current version restricts the segment size to 4 Mbytes, thus, it is impossible to create a task with more than 4 Mbytes of code. The data limitation is not so hard, because it is possible to allocate several memory segments for a task.