mirror of
https://github.com/drasko/codezero.git
synced 2026-04-29 07:01:31 +02:00
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:
@@ -11,22 +11,31 @@
|
||||
#include <kmalloc/kmalloc.h>
|
||||
#include <l4lib/arch/syscalls.h>
|
||||
#include <l4lib/arch/syslib.h>
|
||||
#include <l4lib/utcb.h>
|
||||
#include <task.h>
|
||||
#include <shm.h>
|
||||
#include <file.h>
|
||||
#include <init.h>
|
||||
#include <utcb.h>
|
||||
|
||||
/* Initialise the utcb virtual address pool and its own utcb */
|
||||
/*
|
||||
* Initialise the utcb virtual address pool and its own utcb.
|
||||
* NOTE: This allocates memory so kmalloc must be initialised first.
|
||||
*/
|
||||
void init_utcb(void)
|
||||
{
|
||||
void *utcb_virt, *utcb_page;
|
||||
|
||||
/* Allocate and map one for self */
|
||||
if (utcb_pool_init() < 0)
|
||||
printf("UTCB initialisation failed.\n");
|
||||
utcb_virt = utcb_vaddr_new();
|
||||
printf("%s: Mapping 0x%x as utcb to self.\n", __TASKNAME__, utcb_virt);
|
||||
utcb_page = alloc_page(1);
|
||||
l4_map(utcb_page, utcb_virt, 1, MAP_USR_RW_FLAGS, self_tid());
|
||||
|
||||
/* Also initialise the utcb reference that is used in l4lib. */
|
||||
utcb = utcb_virt;
|
||||
}
|
||||
|
||||
void init_mm(struct initdata *initdata)
|
||||
@@ -43,9 +52,6 @@ void init_mm(struct initdata *initdata)
|
||||
init_devzero();
|
||||
printf("%s: Initialised devzero.\n", __TASKNAME__);
|
||||
|
||||
init_utcb();
|
||||
printf("%s: Initialised own utcb.\n", __TASKNAME__);
|
||||
|
||||
/* Initialise the pager's memory allocator */
|
||||
kmalloc_init();
|
||||
printf("%s: Initialised kmalloc.\n", __TASKNAME__);
|
||||
@@ -53,6 +59,9 @@ void init_mm(struct initdata *initdata)
|
||||
shm_init();
|
||||
printf("%s: Initialised shm structures.\n", __TASKNAME__);
|
||||
|
||||
init_utcb();
|
||||
printf("%s: Initialised own utcb.\n", __TASKNAME__);
|
||||
|
||||
vmfile_init();
|
||||
|
||||
/* Give the kernel some memory to use for its allocators */
|
||||
|
||||
Reference in New Issue
Block a user