From 383a9ac435e037cd13f6a13d2eddf1147d7830eb Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 9 Jul 2008 15:25:01 +0000 Subject: [PATCH] * Added an explicit boot_splash_uninit(). Not really needed, but makes it clear when boot_splash_set_stage() must no longer be used. * Free the memory associated with the kernel args before starting the init process. Unlike the original TODO stated there are quite a few more users of the kernel args (including the boot splash screen), hence we can't really do that earlier, unless we decide to copy the data over to the kernel heap. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26344 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/boot_splash.h | 1 + src/system/kernel/boot_splash.cpp | 7 +++++++ src/system/kernel/main.cpp | 24 ++++++++++-------------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/headers/private/kernel/boot_splash.h b/headers/private/kernel/boot_splash.h index f9482e4e40..768ef0077c 100644 --- a/headers/private/kernel/boot_splash.h +++ b/headers/private/kernel/boot_splash.h @@ -29,6 +29,7 @@ extern "C" { #endif void boot_splash_init(uint8 * boot_splash); +void boot_splash_uninit(void); void boot_splash_set_stage(int stage); #ifdef __cplusplus diff --git a/src/system/kernel/boot_splash.cpp b/src/system/kernel/boot_splash.cpp index 3ee506fdc5..1e57f7856f 100644 --- a/src/system/kernel/boot_splash.cpp +++ b/src/system/kernel/boot_splash.cpp @@ -185,6 +185,13 @@ boot_splash_init(uint8 *boot_splash) } +void +boot_splash_uninit(void) +{ + sInfo = NULL; +} + + void boot_splash_set_stage(int stage) { diff --git a/src/system/kernel/main.cpp b/src/system/kernel/main.cpp index d10628ee48..cad0b6def4 100644 --- a/src/system/kernel/main.cpp +++ b/src/system/kernel/main.cpp @@ -245,17 +245,6 @@ main2(void *unused) boot_splash_set_stage(BOOT_SPLASH_STAGE_1_INIT_MODULES); module_init(&sKernelArgs); - // ToDo: the preloaded image debug data is placed in the kernel args, and - // thus, if they are enabled, the kernel args shouldn't be freed, so - // that we don't have to copy them. - // What is yet missing is a mechanism that controls this (via driver settings). - if (0) { - // module_init() is supposed to be the last user of the kernel args - // Note: don't confuse the kernel_args structure (which is never freed) - // with the kernel args ranges it contains (and which are freed here). - vm_free_kernel_args(&sKernelArgs); - } - // init userland debugging TRACE("Init Userland debugging\n"); init_user_debug(); @@ -297,9 +286,16 @@ main2(void *unused) device_manager_init_post_modules(&sKernelArgs); boot_splash_set_stage(BOOT_SPLASH_STAGE_7_RUN_BOOT_SCRIPT); -// kernel_args_free(sKernelArgs.boot_splash); -// NOTE: We could introduce a syscall to draw more icons indicating -// stages in the boot script itself. Then we should not free the image. + boot_splash_uninit(); + // NOTE: We could introduce a syscall to draw more icons indicating + // stages in the boot script itself. Then we should not free the image. + // In that case we should copy it over to the kernel heap, so that we + // can still free the kernel args. + + // The boot splash screen is the last user of the kernel args. + // Note: don't confuse the kernel_args structure (which is never freed) + // with the kernel args ranges it contains (and which are freed here). + vm_free_kernel_args(&sKernelArgs); // start the init process {