mirror of
https://github.com/drasko/codezero.git
synced 2026-01-20 14:53:16 +01:00
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:
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user