From 0a88479bf59b8f6dcea55340cb121bc644f4cfac Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 8 Dec 2014 13:52:11 +0100 Subject: Rename functions : - dbg_print_region_stats -> dbg_print_region_info - resume_with_result -> resume_task_with_result --- kernel/include/region.h | 2 +- kernel/include/task.h | 4 ++-- kernel/l0/kmain.c | 27 +++++++++++++++------------ kernel/l0/paging.c | 4 ++-- kernel/l0/region.c | 2 +- kernel/l0/task.c | 4 ++-- 6 files changed, 23 insertions(+), 20 deletions(-) (limited to 'kernel') diff --git a/kernel/include/region.h b/kernel/include/region.h index b45a85d..d7a47c4 100644 --- a/kernel/include/region.h +++ b/kernel/include/region.h @@ -43,6 +43,6 @@ void region_free_unmap_free(void* addr); // region_free_unmap : deletes a region and unmaps all frames that were mapped in it, without freeing them void region_free_unmap(void* addr); -void dbg_print_region_stats(); +void dbg_print_region_info(); /* vim: set ts=4 sw=4 tw=0 noet :*/ diff --git a/kernel/include/task.h b/kernel/include/task.h index b7dc02f..0faa8b3 100644 --- a/kernel/include/task.h +++ b/kernel/include/task.h @@ -35,13 +35,13 @@ typedef struct task { typedef void (*entry_t)(void*); void tasking_setup(entry_t cont, void* data); // never returns -task_t *new_task(entry_t entry); // task is PAUSED, and must be resume_with_result'ed +task_t *new_task(entry_t entry); // task is PAUSED, and must be resume_task_with_result'ed extern task_t *current_task; void yield(); void* wait_for_result(); -void resume_with_result(task_t *task, void* data, bool run_at_once); +void resume_task_with_result(task_t *task, void* data, bool run_at_once); /* vim: set ts=4 sw=4 tw=0 noet :*/ diff --git a/kernel/l0/kmain.c b/kernel/l0/kmain.c index 0a6bed9..2ce3749 100644 --- a/kernel/l0/kmain.c +++ b/kernel/l0/kmain.c @@ -24,28 +24,28 @@ void breakpoint_handler(registers_t *regs) { void region_test1() { void* p = region_alloc(0x1000, REGION_T_HW, 0); dbg_printf("Allocated one-page region: 0x%p\n", p); - dbg_print_region_stats(); + dbg_print_region_info(); void* q = region_alloc(0x1000, REGION_T_HW, 0); dbg_printf("Allocated one-page region: 0x%p\n", q); - dbg_print_region_stats(); + dbg_print_region_info(); void* r = region_alloc(0x2000, REGION_T_HW, 0); dbg_printf("Allocated two-page region: 0x%p\n", r); - dbg_print_region_stats(); + dbg_print_region_info(); void* s = region_alloc(0x10000, REGION_T_CORE_HEAP, 0); dbg_printf("Allocated 16-page region: 0x%p\n", s); - dbg_print_region_stats(); + dbg_print_region_info(); region_free(p); dbg_printf("Freed region 0x%p\n", p); - dbg_print_region_stats(); + dbg_print_region_info(); region_free(q); dbg_printf("Freed region 0x%p\n", q); - dbg_print_region_stats(); + dbg_print_region_info(); region_free(r); dbg_printf("Freed region 0x%p\n", r); - dbg_print_region_stats(); + dbg_print_region_info(); region_free(s); dbg_printf("Freed region 0x%p\n", s); - dbg_print_region_stats(); + dbg_print_region_info(); } void region_test2() { @@ -77,7 +77,7 @@ void region_test2() { void kmalloc_test(void* kernel_data_end) { // Test kmalloc ! - dbg_print_region_stats(); + dbg_print_region_info(); dbg_printf("Begin kmalloc test...\n"); const int m = 200; uint16_t** ptr = kmalloc(m * sizeof(uint32_t)); @@ -88,7 +88,7 @@ void kmalloc_test(void* kernel_data_end) { *ptr[i] = ((i * 211) % 1024); } dbg_printf("Fully allocated.\n"); - dbg_print_region_stats(); + dbg_print_region_info(); for (int i = 0; i < m; i++) { for (int j = i; j < m; j++) { ASSERT(*ptr[j] == (j * 211) % 1024); @@ -97,7 +97,7 @@ void kmalloc_test(void* kernel_data_end) { } kfree(ptr); dbg_printf("Kmalloc test OK.\n"); - dbg_print_region_stats(); + dbg_print_region_info(); } void test_task(void* a) { @@ -113,7 +113,10 @@ void test_task(void* a) { } void kernel_init_stage2(void* data) { task_t *tb = new_task(test_task); - resume_with_result(tb, 0, false); + resume_task_with_result(tb, 0, false); + + dbg_print_region_info(); + dbg_print_frame_stats(); while(1) { dbg_printf("a"); diff --git a/kernel/l0/paging.c b/kernel/l0/paging.c index 93cbc38..9879c9f 100644 --- a/kernel/l0/paging.c +++ b/kernel/l0/paging.c @@ -69,7 +69,7 @@ void page_fault_handler(registers_t *regs) { if ((size_t)vaddr >= PD_MIRROR_ADDR) { dbg_printf("Fault on access to mirrorred PD at 0x%p\n", vaddr); - dbg_print_region_stats(); + dbg_print_region_info(); PANIC("Unhandled kernel space page fault"); } @@ -82,7 +82,7 @@ void page_fault_handler(registers_t *regs) { if (i->pf == 0) { dbg_printf("Kernel pagefault in region with no handler at 0x%p\n", vaddr); dbg_dump_registers(regs); - dbg_print_region_stats(); + dbg_print_region_info(); PANIC("Unhandled kernel space page fault"); } i->pf(get_current_pagedir(), i, vaddr); diff --git a/kernel/l0/region.c b/kernel/l0/region.c index a384a4d..956ec07 100644 --- a/kernel/l0/region.c +++ b/kernel/l0/region.c @@ -371,7 +371,7 @@ void region_free_unmap(void* ptr) { // DEBUG LOG PRINTING FUNCTION // // =========================== // -void dbg_print_region_stats() { +void dbg_print_region_info() { mutex_lock(&ra_mutex); dbg_printf("/ Free kernel regions, by address:\n"); diff --git a/kernel/l0/task.c b/kernel/l0/task.c index 80066d8..cf22f9d 100644 --- a/kernel/l0/task.c +++ b/kernel/l0/task.c @@ -168,7 +168,7 @@ void tasking_setup(entry_t cont, void* arg) { task_t *t = new_task(cont); ASSERT(t != 0); - resume_with_result(t, arg, false); + resume_task_with_result(t, arg, false); run_scheduler(); // never returns ASSERT(false); @@ -204,7 +204,7 @@ void* wait_for_result() { return result; } -void resume_with_result(task_t *task, void* data, bool run_at_once) { +void resume_task_with_result(task_t *task, void* data, bool run_at_once) { bool st = disable_interrupts(); task->has_result = true; -- cgit v1.2.3