Add blue_screen and frame_buffer_console into the bootloader.
These can be used for on-screen debug output with relatively little effort, as they just need a plain framebuffer definition to work. Some stubs are added to not clutter up the kernel sources with too many ifdefs.
This commit is contained in:
@@ -22,6 +22,11 @@ local kernelLibArchObjects =
|
|||||||
<src!system!kernel!lib!arch!$(TARGET_ARCH)>memset.o
|
<src!system!kernel!lib!arch!$(TARGET_ARCH)>memset.o
|
||||||
;
|
;
|
||||||
|
|
||||||
|
local kernelDebugSources =
|
||||||
|
blue_screen.cpp
|
||||||
|
frame_buffer_console.cpp
|
||||||
|
;
|
||||||
|
|
||||||
BootMergeObject boot_arch_$(TARGET_KERNEL_ARCH).o :
|
BootMergeObject boot_arch_$(TARGET_KERNEL_ARCH).o :
|
||||||
debug_uart_8250.cpp
|
debug_uart_8250.cpp
|
||||||
arch_uart_8250.cpp
|
arch_uart_8250.cpp
|
||||||
@@ -33,6 +38,11 @@ BootMergeObject boot_arch_$(TARGET_KERNEL_ARCH).o :
|
|||||||
arch_cpu.cpp
|
arch_cpu.cpp
|
||||||
arch_mmu.cpp
|
arch_mmu.cpp
|
||||||
arch_start_kernel.S
|
arch_start_kernel.S
|
||||||
|
|
||||||
|
# Reuse a subset of kernel debugging.
|
||||||
|
kernel_stubs.cpp
|
||||||
|
$(kernelDebugSources)
|
||||||
|
|
||||||
$(librootArchObjects)
|
$(librootArchObjects)
|
||||||
: -fno-pic
|
: -fno-pic
|
||||||
:
|
:
|
||||||
@@ -47,3 +57,6 @@ SEARCH on [ FGristFiles debug_uart_8250.cpp ]
|
|||||||
|
|
||||||
SEARCH on [ FGristFiles $(librootArchObjects) ]
|
SEARCH on [ FGristFiles $(librootArchObjects) ]
|
||||||
= [ FDirName $(HAIKU_TOP) src system libroot posix string arch $(TARGET_ARCH) ] ;
|
= [ FDirName $(HAIKU_TOP) src system libroot posix string arch $(TARGET_ARCH) ] ;
|
||||||
|
|
||||||
|
SEARCH on [ FGristFiles $(kernelDebugSources) ]
|
||||||
|
= [ FDirName $(HAIKU_TOP) src system kernel debug ] ;
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012 Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Michael Lotz, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This file just collects stubs that allow kernel sources to be used in the
|
||||||
|
// bootloader more easily.
|
||||||
|
|
||||||
|
#include <OS.h>
|
||||||
|
#include <lock.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" bool
|
||||||
|
in_command_invocation()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
abort_debugger_command()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" char
|
||||||
|
kgetc()
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
spin(bigtime_t time)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" status_t
|
||||||
|
_mutex_lock(mutex*, bool)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
_mutex_unlock(mutex*, bool)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
@@ -568,6 +568,7 @@ parse_character(char c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _BOOT_MODE
|
||||||
static int
|
static int
|
||||||
set_paging(int argc, char **argv)
|
set_paging(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -588,6 +589,7 @@ set_paging(int argc, char **argv)
|
|||||||
kprintf("paging is turned %s now.\n", sScreen.paging ? "on" : "off");
|
kprintf("paging is turned %s now.\n", sScreen.paging ? "on" : "off");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif // !_BOOT_MODE
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
@@ -604,11 +606,15 @@ blue_screen_init(void)
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
sModule = &gFrameBufferConsoleModule;
|
sModule = &gFrameBufferConsoleModule;
|
||||||
|
#ifdef _BOOT_MODE
|
||||||
|
sScreen.paging = false;
|
||||||
|
#else
|
||||||
sScreen.paging = !get_safemode_boolean(
|
sScreen.paging = !get_safemode_boolean(
|
||||||
"disable_onscreen_paging", false);
|
"disable_onscreen_paging", false);
|
||||||
sScreen.paging_timeout = false;
|
sScreen.paging_timeout = false;
|
||||||
|
|
||||||
add_debugger_command("paging", set_paging, "Enable or disable paging");
|
add_debugger_command("paging", set_paging, "Enable or disable paging");
|
||||||
|
#endif
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -659,6 +665,7 @@ blue_screen_clear_screen(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _BOOT_MODE
|
||||||
int
|
int
|
||||||
blue_screen_try_getchar(void)
|
blue_screen_try_getchar(void)
|
||||||
{
|
{
|
||||||
@@ -671,6 +678,7 @@ blue_screen_getchar(void)
|
|||||||
{
|
{
|
||||||
return arch_debug_blue_screen_getchar();
|
return arch_debug_blue_screen_getchar();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -18,9 +18,12 @@
|
|||||||
#include <vm/vm.h>
|
#include <vm/vm.h>
|
||||||
#include <fs/devfs.h>
|
#include <fs/devfs.h>
|
||||||
#include <boot/kernel_args.h>
|
#include <boot/kernel_args.h>
|
||||||
|
|
||||||
|
#ifndef _BOOT_MODE
|
||||||
#include <vesa_info.h>
|
#include <vesa_info.h>
|
||||||
|
|
||||||
#include <edid.h>
|
#include <edid.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
|
||||||
@@ -79,8 +82,11 @@ static uint32 sPalette32[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct console_info sConsole;
|
static struct console_info sConsole;
|
||||||
|
|
||||||
|
#ifndef _BOOT_MODE
|
||||||
static struct frame_buffer_boot_info sBootInfo;
|
static struct frame_buffer_boot_info sBootInfo;
|
||||||
static struct vesa_mode* sVesaModes;
|
static struct vesa_mode* sVesaModes;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static inline uint8
|
static inline uint8
|
||||||
@@ -404,6 +410,7 @@ frame_buffer_update(addr_t baseAddress, int32 width, int32 height, int32 depth,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _BOOT_MODE
|
||||||
status_t
|
status_t
|
||||||
frame_buffer_console_init(kernel_args* args)
|
frame_buffer_console_init(kernel_args* args)
|
||||||
{
|
{
|
||||||
@@ -483,4 +490,5 @@ _user_frame_buffer_update(addr_t baseAddress, int32 width, int32 height,
|
|||||||
|
|
||||||
return frame_buffer_update(baseAddress, width, height, depth, bytesPerRow);
|
return frame_buffer_update(baseAddress, width, height, depth, bytesPerRow);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user