Implemented on screen debug output during boot - to be enabled in the boot loader

safemode menu.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16081 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-01-25 16:12:10 +00:00
parent ab88c5f939
commit 924479179b
6 changed files with 44 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de
* Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de
* Distributed under the terms of the Haiku License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@ -34,6 +34,7 @@ extern status_t debug_init_post_modules(struct kernel_args *args);
extern void debug_early_boot_message(const char *string);
extern void debug_puts(const char *s);
extern bool debug_debugger_running(void);
extern void debug_stop_screen_debug_output(void);
extern void _user_debug_output(const char *userString);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@ -446,6 +446,10 @@ add_safe_mode_menu()
platform_add_menus(safeMenu);
safeMenu->AddItem(item = new MenuItem("Enable on screen debug output"));
item->SetData("debug_screen");
item->SetType(MENU_ITEM_MARKABLE);
safeMenu->AddSeparatorItem();
safeMenu->AddItem(item = new MenuItem("Return to main menu"));

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@ -487,9 +487,10 @@ blue_screen_init(void)
void
blue_screen_enter(void)
blue_screen_enter(bool debugOutput)
{
sScreen.attr = 0x0f; // black on white
sScreen.attr = debugOutput ? 0xf0 : 0x0f;
// black on white for KDL, white on black for debug output
sScreen.x = sScreen.y = 0;
sScreen.state = CONSOLE_STATE_NORMAL;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef BLUE_SCREEN_H
@ -14,7 +14,7 @@ extern "C" {
#endif
status_t blue_screen_init(void);
void blue_screen_enter(void);
void blue_screen_enter(bool debugOutput);
char blue_screen_getchar(void);
void blue_screen_putchar(char c);

View File

@ -45,6 +45,7 @@ int dbg_register_file[B_MAX_CPU_COUNT][14];
static bool sSerialDebugEnabled = false;
static bool sSyslogOutputEnabled = false;
static bool sBlueScreenEnabled = false;
static bool sDebugScreenEnabled = false;
static bool sBlueScreenOutput = true;
static spinlock sSpinlock = 0;
static int32 sDebuggerOnCPU = -1;
@ -482,6 +483,9 @@ syslog_write(const char *text, int32 length)
static status_t
syslog_init_post_threads(void)
{
if (!sSyslogOutputEnabled)
return B_OK;
sSyslogNotify = create_sem(0, "syslog data");
if (sSyslogNotify >= B_OK) {
thread_id thread = spawn_kernel_thread(syslog_sender, "syslog sender",
@ -543,6 +547,13 @@ err1:
// #pragma mark - private kernel API
void
debug_stop_screen_debug_output(void)
{
sDebugScreenEnabled = false;
}
bool
debug_debugger_running(void)
{
@ -606,8 +617,20 @@ debug_init_post_vm(kernel_args *args)
unload_driver_settings(handle);
}
if (sBlueScreenOutput && blue_screen_init() != B_OK)
sBlueScreenOutput = false;
handle = load_driver_settings(B_SAFEMODE_DRIVER_SETTINGS);
if (handle != NULL) {
sDebugScreenEnabled = get_driver_boolean_parameter(handle,
"debug_screen", false, false);
unload_driver_settings(handle);
}
if ((sBlueScreenOutput || sDebugScreenEnabled)
&& blue_screen_init() != B_OK)
sBlueScreenOutput = sDebugScreenEnabled = false;
if (sDebugScreenEnabled)
blue_screen_enter(true);
syslog_init();
@ -734,7 +757,7 @@ kernel_debugger(const char *message)
if (sBlueScreenOutput) {
sBlueScreenEnabled = true;
blue_screen_enter();
blue_screen_enter(false);
}
if (message)
@ -784,7 +807,7 @@ dprintf(const char *format, ...)
arch_debug_serial_puts(sOutputBuffer);
if (sSyslogOutputEnabled)
syslog_write(sOutputBuffer, length);
if (sBlueScreenEnabled)
if (sBlueScreenEnabled || sDebugScreenEnabled)
blue_screen_puts(sOutputBuffer);
release_spinlock(&sSpinlock);

View File

@ -1,8 +1,9 @@
/*
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <KernelExport.h>
#include <kernel.h>
#include <lock.h>
@ -448,6 +449,8 @@ status_t
_user_frame_buffer_update(addr_t baseAddress, int32 width, int32 height,
int32 depth, int32 bytesPerRow)
{
debug_stop_screen_debug_output();
if (geteuid() != 0)
return B_NOT_ALLOWED;
if (IS_USER_ADDRESS(baseAddress) && baseAddress != NULL)