Modified task initialisation so that stack now comes beneath the environment

Environment is backed by a special per-task file maintained by mm0 for each task.
This file is filled in by the env pager, by simple copying of env data into the
faulty page upon a fault. UTCB and all anon regions (stack) could use the same
scheme.

Fixed IS_ERR(x) to accept negative values that are above -1000 for errors. This
protects against false positives for pointers such as 0xE0000000.

	modified:   include/l4/generic/scheduler.h
	modified:   include/l4/macros.h
	modified:   src/arch/arm/exception.c
	modified:   tasks/fs0/include/linker.lds
	modified:   tasks/libl4/src/init.c
	modified:   tasks/libposix/shm.c
	new file:   tasks/mm0/include/env.h
	modified:   tasks/mm0/include/file.h
	new file:   tasks/mm0/include/lib/addr.h
	deleted:    tasks/mm0/include/lib/vaddr.h
	modified:   tasks/mm0/include/task.h
	new file:   tasks/mm0/include/utcb.h
	new file:   tasks/mm0/src/env.c
	modified:   tasks/mm0/src/fault.c
	modified:   tasks/mm0/src/file.c
	modified:   tasks/mm0/src/init.c
	new file:   tasks/mm0/src/lib/addr.c
	modified:   tasks/mm0/src/lib/idpool.c
	deleted:    tasks/mm0/src/lib/vaddr.c
	modified:   tasks/mm0/src/mmap.c
	modified:   tasks/mm0/src/shm.c
	modified:   tasks/mm0/src/task.c
	new file:   tasks/mm0/src/utcb.c
	modified:   tasks/test0/include/linker.lds
This commit is contained in:
Bahadir Balban
2008-02-29 01:43:56 +00:00
parent 5b7bb88008
commit 617d24b4f0
24 changed files with 316 additions and 144 deletions

View File

@@ -4,6 +4,9 @@
* Copyright (C) 2007 Bahadir Balban
*/
#include <l4lib/kip.h>
#include <l4lib/arch/syslib.h>
#include <l4/macros.h>
#include INC_GLUE(memlayout.h)
__l4_ipc_t __l4_ipc = 0;
__l4_map_t __l4_map = 0;
@@ -22,22 +25,32 @@ struct kip *kip;
/* UTCB address of this task. */
struct utcb *utcb;
#include <stdio.h>
void __l4_init(void)
{
kip = l4_kernel_interface(0, 0, 0);
kip = l4_kernel_interface(0, 0, 0);
__l4_ipc = (__l4_ipc_t)kip->ipc;
__l4_map = (__l4_map_t)kip->map;
__l4_unmap = (__l4_unmap_t)kip->unmap;
__l4_kread = (__l4_kread_t)kip->kread;
__l4_getid = (__l4_getid_t)kip->getid;
__l4_thread_switch = (__l4_thread_switch_t)kip->thread_switch;
__l4_thread_control= (__l4_thread_control_t)kip->thread_control;
__l4_ipc_control= (__l4_ipc_control_t)kip->ipc_control;
__l4_space_control= (__l4_space_control_t)kip->space_control;
__l4_exchange_registers =
(__l4_exchange_registers_t)kip->exchange_registers;
__l4_kmem_grant = (__l4_kmem_grant_t)kip->kmem_grant;
__l4_kmem_reclaim = (__l4_kmem_reclaim_t)kip->kmem_reclaim;
/* Initialise utcb only if we're not the pager */
if (self_tid() != PAGER_TID) {
utcb = *(struct utcb **)(USER_AREA_END - 8);
printf("UTCB Read from userspace as: 0x%x\n",
(unsigned long)utcb);
}
__l4_ipc = (__l4_ipc_t)kip->ipc;
__l4_map = (__l4_map_t)kip->map;
__l4_unmap = (__l4_unmap_t)kip->unmap;
__l4_kread = (__l4_kread_t)kip->kread;
__l4_getid = (__l4_getid_t)kip->getid;
__l4_thread_switch =(__l4_thread_switch_t)kip->thread_switch;
__l4_thread_control=(__l4_thread_control_t)kip->thread_control;
__l4_ipc_control= (__l4_ipc_control_t)kip->ipc_control;
__l4_space_control=(__l4_space_control_t)kip->space_control;
__l4_exchange_registers =(__l4_exchange_registers_t)kip->exchange_registers;
__l4_kmem_grant =(__l4_kmem_grant_t)kip->kmem_grant;
__l4_kmem_reclaim =(__l4_kmem_reclaim_t)kip->kmem_reclaim;
}