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:
Michael Lotz 2012-11-27 22:33:38 +01:00
parent 297feca8e5
commit 94b364b469
4 changed files with 82 additions and 0 deletions

View File

@ -22,6 +22,11 @@ local kernelLibArchObjects =
<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 :
debug_uart_8250.cpp
arch_uart_8250.cpp
@ -33,6 +38,11 @@ BootMergeObject boot_arch_$(TARGET_KERNEL_ARCH).o :
arch_cpu.cpp
arch_mmu.cpp
arch_start_kernel.S
# Reuse a subset of kernel debugging.
kernel_stubs.cpp
$(kernelDebugSources)
$(librootArchObjects)
: -fno-pic
:
@ -47,3 +57,6 @@ SEARCH on [ FGristFiles debug_uart_8250.cpp ]
SEARCH on [ FGristFiles $(librootArchObjects) ]
= [ FDirName $(HAIKU_TOP) src system libroot posix string arch $(TARGET_ARCH) ] ;
SEARCH on [ FGristFiles $(kernelDebugSources) ]
= [ FDirName $(HAIKU_TOP) src system kernel debug ] ;

View File

@ -0,0 +1,53 @@
/*
* Copyright 2012 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Michael Lotz, mmlr@mlotz.ch
*/
// 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)
{
}

View File

@ -568,6 +568,7 @@ parse_character(char c)
}
#ifndef _BOOT_MODE
static int
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");
return 0;
}
#endif // !_BOOT_MODE
// #pragma mark -
@ -604,11 +606,15 @@ blue_screen_init(void)
return B_ERROR;
sModule = &gFrameBufferConsoleModule;
#ifdef _BOOT_MODE
sScreen.paging = false;
#else
sScreen.paging = !get_safemode_boolean(
"disable_onscreen_paging", false);
sScreen.paging_timeout = false;
add_debugger_command("paging", set_paging, "Enable or disable paging");
#endif
return B_OK;
}
@ -659,6 +665,7 @@ blue_screen_clear_screen(void)
}
#ifndef _BOOT_MODE
int
blue_screen_try_getchar(void)
{
@ -671,6 +678,7 @@ blue_screen_getchar(void)
{
return arch_debug_blue_screen_getchar();
}
#endif
void

View File

@ -18,9 +18,12 @@
#include <vm/vm.h>
#include <fs/devfs.h>
#include <boot/kernel_args.h>
#ifndef _BOOT_MODE
#include <vesa_info.h>
#include <edid.h>
#endif
#include "font.h"
@ -79,8 +82,11 @@ static uint32 sPalette32[] = {
};
static struct console_info sConsole;
#ifndef _BOOT_MODE
static struct frame_buffer_boot_info sBootInfo;
static struct vesa_mode* sVesaModes;
#endif
static inline uint8
@ -404,6 +410,7 @@ frame_buffer_update(addr_t baseAddress, int32 width, int32 height, int32 depth,
}
#ifndef _BOOT_MODE
status_t
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);
}
#endif