Added first part of extended ipc support.

- Extended ipc tests
- Need to copy from ktcb-to-ktcb instead of ktcb-to-user
- Need to check flags of both ipc parties before ipc copy type.
This commit is contained in:
Bahadir Balban
2009-05-27 14:07:17 +03:00
parent 19c71cc658
commit 3ff519439b
8 changed files with 222 additions and 41 deletions

View File

@@ -162,17 +162,24 @@ struct address_space *address_space_create(struct address_space *orig)
int check_access(unsigned long vaddr, unsigned long size, unsigned int flags, int page_in)
{
int err;
unsigned long start, end, mapsize;
/* Do not allow ridiculously big sizes */
if (size >= USER_AREA_SIZE)
return -EINVAL;
/* Get lower and upper page boundaries */
start = page_align(vaddr);
end = page_align_up(vaddr + size);
mapsize = end - start;
/* Check if the address is mapped with given flags */
if (!check_mapping(vaddr, size, flags)) {
if (!check_mapping(start, mapsize, flags)) {
/* Is a page in requested? */
if (page_in) {
/* Ask pager if paging in is possible */
if((err = pager_pagein_request(vaddr, size, flags)) < 0)
if((err = pager_pagein_request(start, mapsize,
flags)) < 0)
return err;
} else
return -EFAULT;

View File

@@ -182,6 +182,14 @@ int tcb_check_and_lazy_map_utcb(struct ktcb *task)
BUG_ON(!task->utcb_address);
/*
* FIXME:
*
* A task may have the utcb mapping of a destroyed thread
* at the given virtual address. This would silently be accepted
* as *mapped*. We need to ensure utcbs of destroyed tasks
* are cleared from all other task's page tables.
*/
if ((ret = check_access(task->utcb_address, UTCB_SIZE,
MAP_SVC_RW_FLAGS, 0)) < 0) {
/* Current task simply hasn't mapped its utcb */