mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 10:53:16 +01:00
Added kernel + libl4 changes for full and extended ipc.
- Short ipc working as normal. Full/extended ipc haven't been tested. - Added automated compilation and inclusion of test executable in test0.
This commit is contained in:
@@ -151,7 +151,7 @@ struct address_space *address_space_create(struct address_space *orig)
|
||||
* If its not mapped-in, it generates a page-in request to the thread's
|
||||
* pager. If fault hasn't cleared, aborts.
|
||||
*/
|
||||
int check_access(unsigned long vaddr, unsigned long size, unsigned int flags)
|
||||
int check_access(unsigned long vaddr, unsigned long size, unsigned int flags, int page_in)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -159,20 +159,17 @@ int check_access(unsigned long vaddr, unsigned long size, unsigned int flags)
|
||||
if (size >= USER_AREA_SIZE)
|
||||
return -EINVAL;
|
||||
|
||||
/* Check if in user range, but this is more up to the pager to decide */
|
||||
if (current->tid == PAGER_TID) {
|
||||
if (!(vaddr >= INITTASK_AREA_START && vaddr < INITTASK_AREA_END))
|
||||
return -EINVAL;
|
||||
} else {
|
||||
if (!(vaddr >= USER_AREA_START && vaddr < USER_AREA_END))
|
||||
return -EINVAL;
|
||||
/* Check if the address is mapped with given flags */
|
||||
if (!check_mapping(vaddr, size, 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)
|
||||
return err;
|
||||
} else
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
/* If not mapped, ask pager whether this is possible */
|
||||
if (!check_mapping(vaddr, size, flags))
|
||||
if((err = pager_pagein_request(vaddr, size, flags)) < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ int sys_time(syscall_context_t *args)
|
||||
int set = (int)args->r1;
|
||||
int retries = 20;
|
||||
|
||||
if (check_access((unsigned long)tv, sizeof(*tv), MAP_USR_RW_FLAGS) < 0)
|
||||
if (check_access((unsigned long)tv, sizeof(*tv), MAP_USR_RW_FLAGS, 1) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
/* Get time */
|
||||
|
||||
Reference in New Issue
Block a user