Shared tcb structures are made independent

For clone, file descriptor and vm area structures need to be
separate from the tcb and reached via a pointer so that they
can be shared among multiple tcbs.
This commit is contained in:
Bahadir Balban
2008-09-09 22:17:42 +03:00
parent 002fe79a54
commit d7de9aa643
8 changed files with 156 additions and 176 deletions

View File

@@ -25,6 +25,12 @@
#define DEFAULT_UTCB_SIZE PAGE_SIZE
enum tcb_create_flags {
TCB_NO_SHARING = 0,
TCB_SHARED_VM = 1,
TCB_SHARED_FILES = 2,
};
struct vm_file;
struct file_descriptor {
@@ -33,6 +39,17 @@ struct file_descriptor {
struct vm_file *vmfile;
};
struct task_fd_head {
struct file_descriptor fd[TASK_FILES_MAX];
int tcb_refs;
};
struct task_vma_head {
struct list_head list;
int tcb_refs;
};
/* Stores all task information that can be kept in userspace. */
struct tcb {
/* Task list */
@@ -44,6 +61,7 @@ struct tcb {
/* Task ids */
int tid;
int spid;
int tgid;
/* Related task ids */
unsigned int pagerid; /* Task's pager */
@@ -76,10 +94,10 @@ struct tcb {
void *utcb;
/* Virtual memory areas */
struct list_head vm_area_list;
struct task_vma_head *vm_area_head;
/* File descriptors for this task */
struct file_descriptor fd[TASK_FILES_MAX];
struct task_fd_head *files;
};
/* Structures to use when sending new task information to vfs */
@@ -99,8 +117,11 @@ void task_add_global(struct tcb *t);
struct initdata;
void init_pm(struct initdata *initdata);
struct tcb *task_create(struct task_ids *ids, unsigned int flags);
struct tcb *task_create(struct task_ids *ids,
unsigned int ctrl_flags,
unsigned int alloc_flags);
int send_task_data(l4id_t requester);
void task_map_prefault_utcb(struct tcb *mapper, struct tcb *owner);
int copy_tcb(struct tcb *to, struct tcb *from, unsigned int flags);
#endif /* __TASK_H__ */

View File

@@ -243,6 +243,11 @@ int validate_task_range(struct tcb *t, unsigned long start,
/* Changes all shadows and their ptes to read-only */
int vm_freeze_shadows(struct tcb *task);
static inline void task_add_vma(struct tcb *task, struct vm_area *vma)
{
list_add(&vma->list, &task->vm_area_head->list);
}
/* Main page fault entry point */
int page_fault_handler(l4id_t tid, fault_kdata_t *fkdata);