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:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2005, Axel Dörfler, [email protected]
|
* Copyright 2002-2006, Axel Dörfler, [email protected]
|
||||||
* Distributed under the terms of the Haiku License.
|
* Distributed under the terms of the Haiku License.
|
||||||
*
|
*
|
||||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
* 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_early_boot_message(const char *string);
|
||||||
extern void debug_puts(const char *s);
|
extern void debug_puts(const char *s);
|
||||||
extern bool debug_debugger_running(void);
|
extern bool debug_debugger_running(void);
|
||||||
|
extern void debug_stop_screen_debug_output(void);
|
||||||
|
|
||||||
extern void _user_debug_output(const char *userString);
|
extern void _user_debug_output(const char *userString);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2005, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2003-2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -446,6 +446,10 @@ add_safe_mode_menu()
|
|||||||
|
|
||||||
platform_add_menus(safeMenu);
|
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->AddSeparatorItem();
|
||||||
safeMenu->AddItem(item = new MenuItem("Return to main menu"));
|
safeMenu->AddItem(item = new MenuItem("Return to main menu"));
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2005-2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -487,9 +487,10 @@ blue_screen_init(void)
|
|||||||
|
|
||||||
|
|
||||||
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.x = sScreen.y = 0;
|
||||||
sScreen.state = CONSOLE_STATE_NORMAL;
|
sScreen.state = CONSOLE_STATE_NORMAL;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2005-2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef BLUE_SCREEN_H
|
#ifndef BLUE_SCREEN_H
|
||||||
@@ -14,7 +14,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
status_t blue_screen_init(void);
|
status_t blue_screen_init(void);
|
||||||
void blue_screen_enter(void);
|
void blue_screen_enter(bool debugOutput);
|
||||||
|
|
||||||
char blue_screen_getchar(void);
|
char blue_screen_getchar(void);
|
||||||
void blue_screen_putchar(char c);
|
void blue_screen_putchar(char c);
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ int dbg_register_file[B_MAX_CPU_COUNT][14];
|
|||||||
static bool sSerialDebugEnabled = false;
|
static bool sSerialDebugEnabled = false;
|
||||||
static bool sSyslogOutputEnabled = false;
|
static bool sSyslogOutputEnabled = false;
|
||||||
static bool sBlueScreenEnabled = false;
|
static bool sBlueScreenEnabled = false;
|
||||||
|
static bool sDebugScreenEnabled = false;
|
||||||
static bool sBlueScreenOutput = true;
|
static bool sBlueScreenOutput = true;
|
||||||
static spinlock sSpinlock = 0;
|
static spinlock sSpinlock = 0;
|
||||||
static int32 sDebuggerOnCPU = -1;
|
static int32 sDebuggerOnCPU = -1;
|
||||||
@@ -482,6 +483,9 @@ syslog_write(const char *text, int32 length)
|
|||||||
static status_t
|
static status_t
|
||||||
syslog_init_post_threads(void)
|
syslog_init_post_threads(void)
|
||||||
{
|
{
|
||||||
|
if (!sSyslogOutputEnabled)
|
||||||
|
return B_OK;
|
||||||
|
|
||||||
sSyslogNotify = create_sem(0, "syslog data");
|
sSyslogNotify = create_sem(0, "syslog data");
|
||||||
if (sSyslogNotify >= B_OK) {
|
if (sSyslogNotify >= B_OK) {
|
||||||
thread_id thread = spawn_kernel_thread(syslog_sender, "syslog sender",
|
thread_id thread = spawn_kernel_thread(syslog_sender, "syslog sender",
|
||||||
@@ -543,6 +547,13 @@ err1:
|
|||||||
// #pragma mark - private kernel API
|
// #pragma mark - private kernel API
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
debug_stop_screen_debug_output(void)
|
||||||
|
{
|
||||||
|
sDebugScreenEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
debug_debugger_running(void)
|
debug_debugger_running(void)
|
||||||
{
|
{
|
||||||
@@ -606,8 +617,20 @@ debug_init_post_vm(kernel_args *args)
|
|||||||
unload_driver_settings(handle);
|
unload_driver_settings(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sBlueScreenOutput && blue_screen_init() != B_OK)
|
handle = load_driver_settings(B_SAFEMODE_DRIVER_SETTINGS);
|
||||||
sBlueScreenOutput = false;
|
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();
|
syslog_init();
|
||||||
|
|
||||||
@@ -734,7 +757,7 @@ kernel_debugger(const char *message)
|
|||||||
|
|
||||||
if (sBlueScreenOutput) {
|
if (sBlueScreenOutput) {
|
||||||
sBlueScreenEnabled = true;
|
sBlueScreenEnabled = true;
|
||||||
blue_screen_enter();
|
blue_screen_enter(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message)
|
if (message)
|
||||||
@@ -784,7 +807,7 @@ dprintf(const char *format, ...)
|
|||||||
arch_debug_serial_puts(sOutputBuffer);
|
arch_debug_serial_puts(sOutputBuffer);
|
||||||
if (sSyslogOutputEnabled)
|
if (sSyslogOutputEnabled)
|
||||||
syslog_write(sOutputBuffer, length);
|
syslog_write(sOutputBuffer, length);
|
||||||
if (sBlueScreenEnabled)
|
if (sBlueScreenEnabled || sDebugScreenEnabled)
|
||||||
blue_screen_puts(sOutputBuffer);
|
blue_screen_puts(sOutputBuffer);
|
||||||
|
|
||||||
release_spinlock(&sSpinlock);
|
release_spinlock(&sSpinlock);
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2005-2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <lock.h>
|
#include <lock.h>
|
||||||
@@ -448,6 +449,8 @@ status_t
|
|||||||
_user_frame_buffer_update(addr_t baseAddress, int32 width, int32 height,
|
_user_frame_buffer_update(addr_t baseAddress, int32 width, int32 height,
|
||||||
int32 depth, int32 bytesPerRow)
|
int32 depth, int32 bytesPerRow)
|
||||||
{
|
{
|
||||||
|
debug_stop_screen_debug_output();
|
||||||
|
|
||||||
if (geteuid() != 0)
|
if (geteuid() != 0)
|
||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
if (IS_USER_ADDRESS(baseAddress) && baseAddress != NULL)
|
if (IS_USER_ADDRESS(baseAddress) && baseAddress != NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user