mirror of
https://github.com/drasko/codezero.git
synced 2026-02-28 01:33:13 +01:00
Modified the kernel and all tasks with well-formatted printout messages.
This commit is contained in:
@@ -157,7 +157,7 @@ int do_clone(struct tcb *parent, unsigned long child_stack, unsigned int flags)
|
||||
global_add_task(child);
|
||||
|
||||
/* Start cloned child. */
|
||||
printf("%s/%s: Starting cloned child.\n", __TASKNAME__, __FUNCTION__);
|
||||
// printf("%s/%s: Starting cloned child.\n", __TASKNAME__, __FUNCTION__);
|
||||
l4_thread_control(THREAD_RUN, &ids);
|
||||
|
||||
/* Return child tid to parent */
|
||||
|
||||
@@ -119,7 +119,7 @@ int start_boot_tasks(struct initdata *initdata)
|
||||
} while (1);
|
||||
|
||||
/* MM0 needs partial initialisation since it's already running. */
|
||||
printf("%s: Initialising mm0 tcb.\n", __TASKNAME__);
|
||||
// printf("%s: Initialising mm0 tcb.\n", __TASKNAME__);
|
||||
ids.tid = PAGER_TID;
|
||||
ids.spid = PAGER_TID;
|
||||
ids.tgid = PAGER_TID;
|
||||
@@ -133,13 +133,13 @@ int start_boot_tasks(struct initdata *initdata)
|
||||
ids.spid = VFS_TID;
|
||||
ids.tgid = VFS_TID;
|
||||
|
||||
printf("%s: Initialising fs0\n",__TASKNAME__);
|
||||
// printf("%s: Initialising fs0\n",__TASKNAME__);
|
||||
BUG_ON((IS_ERR(fs0_task = boottask_exec(fs0_file, USER_AREA_START, USER_AREA_END, &ids))));
|
||||
total++;
|
||||
|
||||
/* Initialise other tasks */
|
||||
list_for_each_entry_safe(file, n, &other_files, list) {
|
||||
printf("%s: Initialising new boot task.\n", __TASKNAME__);
|
||||
// printf("%s: Initialising new boot task.\n", __TASKNAME__);
|
||||
ids.tid = TASK_ID_INVALID;
|
||||
ids.spid = TASK_ID_INVALID;
|
||||
ids.tgid = TASK_ID_INVALID;
|
||||
@@ -179,7 +179,7 @@ void init_mm(struct initdata *initdata)
|
||||
printf("SHM initialisation failed.\n");
|
||||
BUG();
|
||||
}
|
||||
printf("%s: Initialised shm structures.\n", __TASKNAME__);
|
||||
// printf("%s: Initialised shm structures.\n", __TASKNAME__);
|
||||
|
||||
if (utcb_pool_init() < 0) {
|
||||
printf("SHM initialisation failed.\n");
|
||||
@@ -204,6 +204,5 @@ void initialise(void)
|
||||
start_boot_tasks(&initdata);
|
||||
|
||||
mm0_test_global_vm_integrity();
|
||||
printf("%s: Initialised the memory/process manager.\n", __TASKNAME__);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,9 +38,7 @@ void print_page_map(struct page_bitmap *map)
|
||||
unsigned int total_used = 0;
|
||||
int numpages = 0;
|
||||
|
||||
printf("Pages start at address 0x%x\n", map->pfn_start << PAGE_BITS);
|
||||
printf("Pages end at address 0x%x\n", map->pfn_end << PAGE_BITS);
|
||||
printf("The used page areas are:\n");
|
||||
// printf("Page map: 0x%x-0x%x\n", map->pfn_start << PAGE_BITS, map->pfn_end << PAGE_BITS);
|
||||
for (int i = 0; i < (PHYSMEM_TOTAL_PAGES >> 5); i++) {
|
||||
for (int x = 0; x < WORD_BITS; x++) {
|
||||
if (map->map[i] & (1 << x)) { /* A used page found? */
|
||||
@@ -52,14 +50,14 @@ void print_page_map(struct page_bitmap *map)
|
||||
if (start_pfn) { /* We had a used page */
|
||||
/* Finished end of used range.
|
||||
* Print and reset. */
|
||||
print_pfn_range(start_pfn, numpages);
|
||||
//print_pfn_range(start_pfn, numpages);
|
||||
start_pfn = 0;
|
||||
numpages = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("Total of %d pages. %d Kbytes.\n", total_used, total_used << 2);
|
||||
printf("%s: Pagemap: Total of %d used physical pages. %d Kbytes used.\n", __TASKNAME__, total_used, total_used << 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ int vma_shrink(struct vm_area *vma, struct tcb *task,
|
||||
const unsigned long pfn_start, const unsigned long pfn_end)
|
||||
{
|
||||
unsigned long diff, unmap_start, unmap_end;
|
||||
int err;
|
||||
|
||||
/* Shrink from the end */
|
||||
if (vma->pfn_start < pfn_start) {
|
||||
@@ -77,8 +78,8 @@ int vma_shrink(struct vm_area *vma, struct tcb *task,
|
||||
BUG();
|
||||
|
||||
/* Unmap the shrinked portion */
|
||||
BUG_ON(l4_unmap((void *)__pfn_to_addr(unmap_start),
|
||||
unmap_end - unmap_start, task->tid) < 0);
|
||||
BUG_ON((err = l4_unmap((void *)__pfn_to_addr(unmap_start),
|
||||
unmap_end - unmap_start, task->tid)) < 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -110,6 +111,8 @@ int vma_destroy_single(struct tcb *task, struct vm_area *vma)
|
||||
int vma_unmap(struct vm_area *vma, struct tcb *task,
|
||||
const unsigned long pfn_start, const unsigned long pfn_end)
|
||||
{
|
||||
// printf("Unmapping vma. Tid: %d, 0x%x-0x%x\n",task->tid, __pfn_to_addr(pfn_start), __pfn_to_addr(pfn_end));
|
||||
|
||||
/* Split needed? */
|
||||
if (vma->pfn_start < pfn_start && vma->pfn_end > pfn_end)
|
||||
return vma_split(vma, task, pfn_start, pfn_end);
|
||||
|
||||
@@ -92,8 +92,8 @@ int file_page_out(struct vm_object *vm_obj, unsigned long page_offset)
|
||||
/* Map the page to vfs task */
|
||||
l4_map(paddr, vaddr, 1, MAP_USR_RW_FLAGS, VFS_TID);
|
||||
|
||||
printf("%s/%s: Writing to vnode %d, at pgoff 0x%x, %d pages, buf at 0x%x\n",
|
||||
__TASKNAME__, __FUNCTION__, vm_file_to_vnum(f), page_offset, 1, vaddr);
|
||||
// printf("%s/%s: Writing to vnode %d, at pgoff 0x%x, %d pages, buf at 0x%x\n",
|
||||
// __TASKNAME__, __FUNCTION__, vm_file_to_vnum(f), page_offset, 1, vaddr);
|
||||
|
||||
/* Syscall to vfs to write page back to file. */
|
||||
if ((err = vfs_write(vm_file_to_vnum(f), page_offset, 1, vaddr)) < 0)
|
||||
|
||||
@@ -623,7 +623,7 @@ int task_start(struct tcb *task)
|
||||
};
|
||||
|
||||
/* Start the thread */
|
||||
printf("Starting task with id %d, spid: %d\n", task->tid, task->spid);
|
||||
printf("%s: Starting task with thread id: %d, space id: %d\n", __TASKNAME__, task->tid, task->spid);
|
||||
if ((err = l4_thread_control(THREAD_RUN, &ids)) < 0) {
|
||||
printf("l4_thread_control failed with %d\n", err);
|
||||
return err;
|
||||
|
||||
Reference in New Issue
Block a user