mirror of
https://github.com/drasko/codezero.git
synced 2026-02-14 02:43:25 +01:00
Various minor fixes.
Removed some commented out code. Removed excessive printfs. Fixed spid not initialising for mm0 Fixed some faults with fs0. TODO: - Need to store vfs files in a separate list. - Need to define vnum as a vfs-file-specific data, i.e. in priv_data field of vm_file. - Need to then fix vfs_receive_sys_open.
This commit is contained in:
@@ -22,32 +22,32 @@ void init_mm(struct initdata *initdata)
|
||||
{
|
||||
/* Initialise the page and bank descriptors */
|
||||
init_physmem(initdata, membank);
|
||||
printf("%s: Initialised physmem.\n", __TASKNAME__);
|
||||
// printf("%s: Initialised physmem.\n", __TASKNAME__);
|
||||
|
||||
/* Initialise the page allocator on first bank. */
|
||||
init_page_allocator(membank[0].free, membank[0].end);
|
||||
printf("%s: Initialised page allocator.\n", __TASKNAME__);
|
||||
// printf("%s: Initialised page allocator.\n", __TASKNAME__);
|
||||
|
||||
/* Initialise the pager's memory allocator */
|
||||
kmalloc_init();
|
||||
printf("%s: Initialised kmalloc.\n", __TASKNAME__);
|
||||
// printf("%s: Initialised kmalloc.\n", __TASKNAME__);
|
||||
|
||||
/* Initialise the zero page */
|
||||
init_devzero();
|
||||
printf("%s: Initialised devzero.\n", __TASKNAME__);
|
||||
// printf("%s: Initialised devzero.\n", __TASKNAME__);
|
||||
|
||||
/* Initialise in-memory boot files */
|
||||
init_boot_files(initdata);
|
||||
printf("%s: Initialised in-memory boot files.\n", __TASKNAME__);
|
||||
// printf("%s: Initialised in-memory boot files.\n", __TASKNAME__);
|
||||
|
||||
shm_init();
|
||||
printf("%s: Initialised shm structures.\n", __TASKNAME__);
|
||||
// printf("%s: Initialised shm structures.\n", __TASKNAME__);
|
||||
|
||||
if (utcb_pool_init() < 0) {
|
||||
printf("UTCB initialisation failed.\n");
|
||||
BUG();
|
||||
}
|
||||
printf("%s: Initialised utcb address pool.\n", __TASKNAME__);
|
||||
// printf("%s: Initialised utcb address pool.\n", __TASKNAME__);
|
||||
|
||||
/* Give the kernel some memory to use for its allocators */
|
||||
l4_kmem_grant(__pfn(alloc_page(__pfn(SZ_1MB))), __pfn(SZ_1MB));
|
||||
|
||||
@@ -564,8 +564,8 @@ int do_mmap(struct vm_file *mapfile, unsigned long file_offset,
|
||||
}
|
||||
|
||||
/* Finished initialising the vma, add it to task */
|
||||
printf("%s: Mapping 0x%x - 0x%x\n", __FUNCTION__,
|
||||
map_address, map_address + npages * PAGE_SIZE);
|
||||
dprintf("%s: Mapping 0x%x - 0x%x\n", __FUNCTION__,
|
||||
map_address, map_address + npages * PAGE_SIZE);
|
||||
list_add(&new->list, &task->vm_area_list);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -34,6 +34,15 @@ struct tcb_head {
|
||||
int total; /* Total threads */
|
||||
} tcb_head;
|
||||
|
||||
void print_tasks(void)
|
||||
{
|
||||
struct tcb *task;
|
||||
printf("Tasks:\n========\n");
|
||||
list_for_each_entry(task, &tcb_head.list, list) {
|
||||
printf("Task tid: %d, spid: %d\n", task->tid, task->spid);
|
||||
}
|
||||
}
|
||||
|
||||
struct tcb *find_task(int tid)
|
||||
{
|
||||
struct tcb *t;
|
||||
@@ -73,14 +82,12 @@ struct tcb *task_create(struct task_ids *ids)
|
||||
int err;
|
||||
|
||||
/* Create the thread structures and address space */
|
||||
printf("Creating new thread with ids: %d, %d.\n", ids->tid, ids->spid);
|
||||
if ((err = l4_thread_control(THREAD_CREATE, ids)) < 0) {
|
||||
printf("l4_thread_control failed with %d.\n", err);
|
||||
return PTR_ERR(err);
|
||||
}
|
||||
|
||||
/* Create a task and use given space and thread ids. */
|
||||
printf("New task with id: %d, space id: %d\n", ids->tid, ids->spid);
|
||||
if (IS_ERR(task = tcb_alloc_init()))
|
||||
return PTR_ERR(task);
|
||||
|
||||
@@ -195,7 +202,7 @@ int task_start(struct tcb *task, struct task_ids *ids)
|
||||
int err;
|
||||
|
||||
/* Start the thread */
|
||||
printf("Starting task with id %d\n", task->tid);
|
||||
printf("Starting task with id %d, spid: %d\n", task->tid, task->spid);
|
||||
if ((err = l4_thread_control(THREAD_RUN, ids)) < 0) {
|
||||
printf("l4_thread_control failed with %d\n", err);
|
||||
return err;
|
||||
@@ -409,7 +416,7 @@ struct vm_file *initdata_next_bootfile(struct initdata *initdata)
|
||||
*/
|
||||
int start_boot_tasks(struct initdata *initdata)
|
||||
{
|
||||
struct vm_file *file, *fs0, *mm0, *n;
|
||||
struct vm_file *file = 0, *fs0 = 0, *mm0 = 0, *n;
|
||||
struct svc_image *img;
|
||||
struct task_ids ids;
|
||||
struct list_head files;
|
||||
@@ -438,7 +445,7 @@ int start_boot_tasks(struct initdata *initdata)
|
||||
/* MM0 needs partial initialisation, since its already running. */
|
||||
printf("%s: Initialising mm0 tcb.\n", __TASKNAME__);
|
||||
ids.tid = PAGER_TID;
|
||||
ids.tid = PAGER_TID;
|
||||
ids.spid = PAGER_TID;
|
||||
if (mm0_task_init(mm0, INITTASK_AREA_START, INITTASK_AREA_END, &ids) < 0)
|
||||
BUG();
|
||||
total++;
|
||||
@@ -460,14 +467,6 @@ int start_boot_tasks(struct initdata *initdata)
|
||||
BUG();
|
||||
total++;
|
||||
}
|
||||
{
|
||||
struct tcb *t;
|
||||
printf("Tasks:\n========\n");
|
||||
list_for_each_entry(t, &tcb_head.list, list) {
|
||||
printf("Task tid: %d, spid: %d\n", t->tid, t->spid);
|
||||
BUG_ON(t->tid != t->spid);
|
||||
}
|
||||
}
|
||||
|
||||
if (!total) {
|
||||
printf("%s: Could not start any tasks.\n", __TASKNAME__);
|
||||
|
||||
Reference in New Issue
Block a user