First step in detaching pager struct from tasks

This commit is contained in:
Bahadir Balban
2009-11-03 14:50:22 +02:00
parent 00a9f2e3c9
commit 6c69f181db
7 changed files with 17 additions and 26 deletions

View File

@@ -28,7 +28,7 @@ int read_task_capabilities(void *userbuf)
* Currently only pagers can
* read their own capabilities
*/
if (current != current->pager->tcb)
if (current->tid != current->pagerid)
return -EPERM;
/* Determine size of pager capabilities (FIXME: partial!) */
@@ -126,7 +126,7 @@ int sys_capability_control(unsigned int req, unsigned int flags, void *userbuf)
switch(req) {
/* Return number of capabilities the thread has */
case CAP_CONTROL_NCAPS:
if (current != current->pager->tcb)
if (current->tid != current->pagerid)
return -EPERM;
if ((err = check_access((unsigned long)userbuf,

View File

@@ -132,7 +132,7 @@ int sys_exchange_registers(struct exregs_data *exregs, l4id_t tid)
* be the pagers making the call on themselves.
*/
if (task->state != TASK_INACTIVE && exregs->valid_vect &&
current != task && task->pager->tcb != current) {
current != task && task->pagerid != current->tid) {
err = -EACTIVE;
goto out;
}

View File

@@ -556,7 +556,7 @@ struct capability *cap_match_mem(struct capability *cap,
*
* It seems it would be reasonable for a pager to have memory
* capabilities with a resid of its own id, and rtype of
* CAP_RTYPE_PGGROUP, effectively allowing it to do map
* CAP_RTYPE_CONTAINER, effectively allowing it to do map
* operations on itself and its group of paged children.
*/
}

View File

@@ -110,8 +110,6 @@ int init_pager(struct pager *pager,
task_init_registers(task, pager->start_address);
/* Initialize container/pager relationships */
pager->tcb = task;
task->pager = pager;
task->pagerid = task->tid;
task->tgid = task->tid;
task->container = cont;
@@ -142,7 +140,7 @@ int init_pager(struct pager *pager,
cap->resid = CAP_RESID_NONE;
}
printk("%s: Mapping %lx bytes (%lx pages) from 0x%lx to 0x%lx for %s\n",
printk("%s: Mapping 0x%lx bytes (0x%lx pages) from 0x%lx to 0x%lx for %s\n",
__KERNELNAME__, pager->memsize,
__pfn(page_align_up(pager->memsize)),
pager->start_lma, pager->start_vma, cont->name);

View File

@@ -363,9 +363,6 @@ void init_kernel_resources(struct kernel_resources *kres)
/* Initialize container head */
container_head_init(&kres->containers);
/* Get first container id for itself */
kres->cid = id_new(&kres->container_ids);
/* Initialize kernel capability lists */
cap_list_init(&kres->physmem_used);
cap_list_init(&kres->physmem_free);
@@ -521,6 +518,10 @@ void setup_containers(struct boot_resources *bootres,
/* Initialize pagers */
container_init_pagers(kres, current_pgd);
/* Assign next unused container id for kernel resources */
kres->cid = id_new(&kres->container_ids);
}
/*
@@ -559,8 +560,8 @@ void copy_boot_capabilities(struct cap_list *caplist)
* Creates capabilities allocated with a real id, and from the
* capability cache, in place of ones allocated at boot-time.
*/
void kres_setup_capabilities(struct boot_resources *bootres,
struct kernel_resources *kres)
void kernel_setup_capabilities(struct boot_resources *bootres,
struct kernel_resources *kres)
{
struct capability *cap;
@@ -861,7 +862,7 @@ int init_system_resources(struct kernel_resources *kres)
init_resource_allocators(&bootres, kres);
kres_setup_capabilities(&bootres, kres);
kernel_setup_capabilities(&bootres, kres);
setup_containers(&bootres, kres);

View File

@@ -257,11 +257,11 @@ void init_finalize(struct kernel_resources *kres)
/* Get the first container */
c = link_to_struct(kres->containers.list.next,
struct container,
list);
struct container, list);
/* Get the first pager ktcb */
first_task = c->pager[0].tcb;
/* Get the first pager in container */
first_task = link_to_struct(c->ktcb_list.list.next,
struct ktcb, task_list);
/* Calculate first stack address */
newstack = align((unsigned long)first_task + PAGE_SIZE - 1,