cli_monitor: Add foc-specific kdebug command

This commit is contained in:
Norman Feske 2013-03-21 15:50:32 +01:00
parent 022e762a40
commit dfe4fd177d
8 changed files with 141 additions and 8 deletions

View File

@ -22,7 +22,7 @@ exec tar cfv bin/vim.tar -h -C bin/vim .
create_boot_directory
append config {
<config verbose="yes">
<config>
<parent-provides>
<service name="ROM"/>
<service name="LOG"/>
@ -44,15 +44,29 @@ append config {
<provides><service name="Timer"/></provides>
<route> <any-service> <parent/> </any-service> </route>
</start>
<start name="uart_drv">
<start name="uart_drv">}
# use kernel debugger as UART on Fiasco.OC
append_if [have_spec foc] config {
<binary name="kdb_uart_drv"/>}
append config {
<resource name="RAM" quantum="1M"/>
<provides>
<service name="Uart"/>
<service name="Terminal"/>
</provides>
<config>
<policy label="terminal_mux" uart="1" detect_size="yes"/>
<policy label="noux" uart="1" detect_size="yes"/>
<config> }
# on Fiasco.OC the kdb_uart_drv is always UART 0
append_if [have_spec foc] config {
<policy label="terminal_mux" uart="0" detect_size="yes"/> }
# on all other kernels, direct terminal_mux to UART 1 (Qemu stdio, see below)
append_if [expr ![have_spec foc]] config {
<policy label="terminal_mux" uart="1" detect_size="yes"/> }
append config {
</config>
<route> <any-service> <parent/> </any-service> </route>
</start>
@ -134,11 +148,22 @@ set boot_modules {
vim.tar
}
lappend_if [have_spec foc] boot_modules kdb_uart_drv
set fiasco_serial_esc_arg ""
build_boot_image $boot_modules
append qemu_args " -m 256 "
#append qemu_args " -nographic -serial mon:stdio -serial file:/tmp/foo"
append qemu_args " -nographic -serial file:kdb.log -serial mon:stdio"
append qemu_args " -nographic "
#
# On Fiasco.OC, we use only one UART via the kernel debugger.
# On all other kernels, we write the core debug output to the kdb.log file,
# and use qemu's stdio as the UART used by terminal_mux.
#
append_if [expr ![have_spec foc]] qemu_args " -serial file:kdb.log "
append qemu_args " -serial mon:stdio"
run_genode_until forever

4
os/lib/mk/cli_monitor.mk Normal file
View File

@ -0,0 +1,4 @@
SRC_CC = no_extension.cc
INC_DIR += $(REP_DIR)/src/app/cli_monitor
vpath no_extension.cc $(REP_DIR)/src/app/cli_monitor

View File

@ -0,0 +1,4 @@
SRC_CC = extension.cc
INC_DIR += $(REP_DIR)/src/app/cli_monitor
vpath extension.cc $(REP_DIR)/src/app/cli_monitor/foc

View File

@ -0,0 +1,25 @@
/*
* \brief Interface for platform-specific CLI-monitor commands
* \author Norman Feske
* \date 2013-03-21
*/
/*
* Copyright (C) 2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _EXTENSION_H_
#define _EXTENSION_H_
/* local includes */
#include <line_editor.h>
/**
* Initialize and register platform-specific commands
*/
void init_extension(Command_registry &);
#endif /* _EXTENSION_H_ */

View File

@ -0,0 +1,53 @@
/*
* \brief Fiasco.OC-specific CLI-monitor extensions
* \author Norman Feske
* \date 2013-03-18
*/
/*
* Copyright (C) 2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* local includes */
#include <extension.h>
#include <terminal_util.h>
/* Fiasco includes */
namespace Fiasco {
#include <l4/sys/kdebug.h>
#include <l4/sys/ipc.h>
}
struct Kdebug_command : Command
{
Kdebug_command() : Command("kdebug", "enter kernel debugger (via serial console)") { }
void execute(Command_line &, Terminal::Session &terminal)
{
tprintf(terminal, " Entering kernel debugger...\n");
tprintf(terminal, " Press [g] to continue execution.\n");
using namespace Fiasco;
/*
* Wait a bit to give the terminal a chance to print the usage
* information before the kernel debugger takes over.
*/
l4_ipc_sleep(l4_timeout(L4_IPC_TIMEOUT_NEVER, l4_timeout_rel(244, 11)));
enter_kdebug("");
tprintf(terminal, "\n");
}
};
void init_extension(Command_registry &commands)
{
static Kdebug_command kdebug_command;
commands.insert(&kdebug_command);
}

View File

@ -25,6 +25,7 @@
#include <line_editor.h>
#include <command_line.h>
#include <terminal_util.h>
#include <extension.h>
using Terminal::tprintf;
using Genode::Xml_node;
@ -534,6 +535,10 @@ int main(int argc, char **argv)
static Command_registry commands;
static Child_registry children;
/* initialize platform-specific commands */
init_extension(commands);
/* initialize generic commands */
commands.insert(new Help_command);
Kill_command kill_command(children);
commands.insert(&kill_command);

View File

@ -0,0 +1,17 @@
/*
* \brief Dummy implementation of CLI extension interface
* \author Norman Feske
* \date 2013-03-21
*/
/*
* Copyright (C) 2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#include <extension.h>
void init_extension(Command_registry &) { }

View File

@ -1,4 +1,4 @@
TARGET = cli_monitor
SRC_CC = main.cc
LIBS = base
LIBS = base cli_monitor
INC_DIR += $(PRG_DIR)