foc: remove obsolete features (ref #2405)

Removes the following Fiasco.OC specific features:
* GDB extensions for Fiasco.OC
* i.MX53 support for Fiasco.OC
* Kernel debugger terminal driver
* Obsolete interface Native_pd
* Obsolete function of interface Native_cpu
This commit is contained in:
Stefan Kalkowski 2017-05-08 13:08:52 +02:00 committed by Christian Helmuth
parent 9e3fc9414f
commit 10e2e223cd
28 changed files with 15 additions and 959 deletions

View File

@ -1,83 +0,0 @@
#
# Automatically generated file; DO NOT EDIT.
# Fiasco configuration
#
#
# Target configuration
#
# CONFIG_IA32 is not set
# CONFIG_AMD64 is not set
CONFIG_ARM=y
CONFIG_PF_IMX=y
# CONFIG_PF_REALVIEW is not set
# CONFIG_PF_S3C2410 is not set
# CONFIG_PF_TEGRA is not set
# CONFIG_PF_OMAP is not set
# CONFIG_PF_SA1100 is not set
# CONFIG_PF_XSCALE is not set
# CONFIG_PF_EXYNOS is not set
# CONFIG_PF_KIRKWOOD is not set
# CONFIG_PF_INTEGRATOR is not set
# CONFIG_PF_BCM2835 is not set
CONFIG_BSP_NAME="imx"
# CONFIG_PF_IMX_21 is not set
# CONFIG_PF_IMX_35 is not set
# CONFIG_PF_IMX_51 is not set
# CONFIG_PF_IMX_6 is not set
CONFIG_PF_IMX_53=y
CONFIG_PF_IMX_RAM_PHYS_BASE=0x70000000
CONFIG_ABI_VF=y
CONFIG_CAN_ARM_CPU_CORTEX_A8=y
CONFIG_ARM_CORTEX_A8=y
# CONFIG_ARM_ALIGNMENT_CHECK is not set
CONFIG_ARM_EM_STD=y
# CONFIG_ARM_EM_NS is not set
# CONFIG_ARM_EM_TZ is not set
# CONFIG_FPU is not set
# CONFIG_ARM_CPU_ERRATA is not set
#
# Kernel options
#
CONFIG_CONTEXT_4K=y
# CONFIG_FINE_GRAINED_CPUTIME is not set
CONFIG_SCHED_FIXED_PRIO=y
CONFIG_VIRT_OBJ_SPACE=y
#
# Debugging
#
CONFIG_INLINE=y
# CONFIG_NDEBUG is not set
# CONFIG_NO_FRAME_PTR is not set
# CONFIG_STACK_DEPTH is not set
# CONFIG_LIST_ALLOC_SANITY is not set
CONFIG_SERIAL=y
CONFIG_JDB=y
# CONFIG_JDB_LOGGING is not set
# CONFIG_JDB_DISASM is not set
# CONFIG_JDB_GZIP is not set
# CONFIG_VMEM_ALLOC_TEST is not set
# CONFIG_DEBUG_KERNEL_PAGE_FAULTS is not set
# CONFIG_WARN_NONE is not set
CONFIG_WARN_WARNING=y
# CONFIG_WARN_ANY is not set
#
# Compiling
#
CONFIG_CC="gcc"
CONFIG_CXX="g++"
CONFIG_HOST_CC="gcc"
CONFIG_HOST_CXX="g++"
# CONFIG_MAINTAINER_MODE is not set
CONFIG_LABEL=""
# CONFIG_EXPERIMENTAL is not set
CONFIG_PERF_CNT=y
CONFIG_BIT32=y
CONFIG_ARM_V7=y
CONFIG_ARM_V6PLUS=y
CONFIG_WARN_LEVEL=1
CONFIG_XARCH="arm"
CONFIG_ABI="vf"

View File

@ -1,70 +0,0 @@
#
# Automatically generated file; DO NOT EDIT.
# L4Re Configuration
#
# CONFIG_BUILD_ARCH_x86 is not set
# CONFIG_BUILD_ARCH_amd64 is not set
CONFIG_BUILD_ARCH_arm=y
# CONFIG_BUILD_ARCH_ppc32 is not set
# CONFIG_BUILD_ARCH_sparc is not set
CONFIG_BUILD_ARCH="arm"
CONFIG_BUILD_ABI_l4f=y
CONFIG_BUILD_ABI="l4f"
CONFIG_CPU="armv7a"
# CONFIG_CPU_ARM_ARMV4 is not set
# CONFIG_CPU_ARM_ARMV4T is not set
# CONFIG_CPU_ARM_ARMV5 is not set
# CONFIG_CPU_ARM_ARMV5T is not set
# CONFIG_CPU_ARM_ARMV5TE is not set
# CONFIG_CPU_ARM_ARMV6 is not set
# CONFIG_CPU_ARM_ARMV6T2 is not set
# CONFIG_CPU_ARM_ARMV6ZK is not set
CONFIG_CPU_ARM_ARMV7A=y
# CONFIG_CPU_ARM_ARMV7R is not set
CONFIG_CPU_ARMV6KPLUS=y
CONFIG_CPU_ARMV6PLUS=y
CONFIG_PLATFORM_TYPE_imx53=y
# CONFIG_PLATFORM_TYPE_imx35 is not set
# CONFIG_PLATFORM_TYPE_rv_pbx is not set
# CONFIG_PLATFORM_TYPE_exynos5 is not set
# CONFIG_PLATFORM_TYPE_rv is not set
# CONFIG_PLATFORM_TYPE_kirkwood is not set
# CONFIG_PLATFORM_TYPE_pandaboard is not set
# CONFIG_PLATFORM_TYPE_tegra3 is not set
# CONFIG_PLATFORM_TYPE_tegra2 is not set
# CONFIG_PLATFORM_TYPE_imx6 is not set
# CONFIG_PLATFORM_TYPE_exynos4 is not set
# CONFIG_PLATFORM_TYPE_omap3_am33xx is not set
# CONFIG_PLATFORM_TYPE_rpi_b is not set
# CONFIG_PLATFORM_TYPE_rv_vexpress_a15 is not set
# CONFIG_PLATFORM_TYPE_imx51 is not set
# CONFIG_PLATFORM_TYPE_omap3evm is not set
# CONFIG_PLATFORM_TYPE_beagleboard is not set
# CONFIG_PLATFORM_TYPE_imx21 is not set
# CONFIG_PLATFORM_TYPE_rv_vexpress is not set
# CONFIG_PLATFORM_TYPE_rpi_a is not set
# CONFIG_PLATFORM_TYPE_integrator is not set
# CONFIG_PLATFORM_TYPE_custom is not set
CONFIG_PLATFORM_TYPE="imx53"
# CONFIG_USE_DROPS_STDDIR is not set
# CONFIG_USE_DICE is not set
CONFIG_DROPS_STDDIR="/path/to/l4re"
CONFIG_DROPS_INSTDIR="/path/to/l4re"
CONFIG_BID_COLORED_PHASES=y
#
# Building
#
CONFIG_YACC="yacc"
CONFIG_LEX="flex"
CONFIG_CTAGS="ctags"
CONFIG_ETAGS="etags"
CONFIG_HAVE_LDSO=y
CONFIG_INT_CPP_NAME_SWITCH=y
CONFIG_INT_LD_NAME_SWITCH=y
# CONFIG_BID_STRIP_PROGS is not set
# CONFIG_BID_GCC_OMIT_FP is not set
# CONFIG_BID_GENERATE_MAPFILE is not set
# CONFIG_BID_BUILD_DOC is not set
# CONFIG_RELEASE_MODE is not set
CONFIG_MAKECONFS_ADD=""

View File

@ -26,15 +26,9 @@ struct Genode::Foc_native_cpu_client : Rpc_client<Foc_native_cpu>
explicit Foc_native_cpu_client(Capability<Native_cpu> cap)
: Rpc_client<Foc_native_cpu>(static_cap_cast<Foc_native_cpu>(cap)) { }
void enable_vcpu(Thread_capability cap, addr_t vcpu_state) override {
call<Rpc_enable_vcpu>(cap, vcpu_state); }
Native_capability native_cap(Thread_capability cap) override {
return call<Rpc_native_cap>(cap); }
Native_capability alloc_irq() override {
return call<Rpc_alloc_irq>(); }
Foc_thread_state thread_state(Thread_capability cap) override {
return call<Rpc_thread_state>(cap); }
};

View File

@ -24,9 +24,7 @@ namespace Genode { struct Foc_native_cpu; }
struct Genode::Foc_native_cpu : Cpu_session::Native_cpu
{
virtual void enable_vcpu(Thread_capability cap, addr_t vcpu_state) = 0;
virtual Native_capability native_cap(Thread_capability) = 0;
virtual Native_capability alloc_irq() = 0;
virtual Foc_thread_state thread_state(Thread_capability) = 0;
@ -34,12 +32,10 @@ struct Genode::Foc_native_cpu : Cpu_session::Native_cpu
** RPC declaration **
*********************/
GENODE_RPC(Rpc_enable_vcpu, void, enable_vcpu, Thread_capability, addr_t);
GENODE_RPC(Rpc_native_cap, Native_capability, native_cap, Thread_capability);
GENODE_RPC(Rpc_alloc_irq, Native_capability, alloc_irq);
GENODE_RPC(Rpc_thread_state, Foc_thread_state, thread_state, Thread_capability);
GENODE_RPC_INTERFACE(Rpc_enable_vcpu, Rpc_native_cap, Rpc_alloc_irq, Rpc_thread_state);
GENODE_RPC_INTERFACE(Rpc_native_cap, Rpc_thread_state);
};
#endif /* _INCLUDE__FOC_NATIVE_CPU__FOC_NATIVE_CPU_H_ */

View File

@ -1,32 +0,0 @@
/*
* \brief Client-side Fiasco.OC specific PD session interface
* \author Stefan Kalkowski
* \author Norman Feske
* \date 2011-04-14
*/
/*
* Copyright (C) 2011-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _INCLUDE__FOC_NATIVE_PD__CLIENT_H_
#define _INCLUDE__FOC_NATIVE_PD__CLIENT_H_
#include <foc_native_pd/foc_native_pd.h>
#include <base/rpc_client.h>
namespace Genode { struct Foc_native_pd_client; }
struct Genode::Foc_native_pd_client : Rpc_client<Foc_native_pd>
{
explicit Foc_native_pd_client(Capability<Native_pd> cap)
: Rpc_client<Foc_native_pd>(static_cap_cast<Foc_native_pd>(cap)) { }
Native_capability task_cap() { return call<Rpc_task_cap>(); }
};
#endif /* _INCLUDE__FOC_NATIVE_PD__CLIENT_H_ */

View File

@ -1,33 +0,0 @@
/*
* \brief Fiasco.OC-specific part of the PD session interface
* \author Stefan Kalkowski
* \author Norman Feske
* \date 2011-04-14
*/
/*
* Copyright (C) 2011-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _INCLUDE__FOC_NATIVE_PD__FOC_NATIVE_PD_H_
#define _INCLUDE__FOC_NATIVE_PD__FOC_NATIVE_PD_H_
#include <base/capability.h>
#include <base/rpc.h>
#include <pd_session/pd_session.h>
namespace Genode { struct Foc_native_pd; }
struct Genode::Foc_native_pd : Pd_session::Native_pd
{
virtual Native_capability task_cap() = 0;
GENODE_RPC(Rpc_task_cap, Native_capability, task_cap);
GENODE_RPC_INTERFACE(Rpc_task_cap);
};
#endif /* _INCLUDE__FOC_NATIVE_PD__FOC_NATIVE_PD_H_ */

View File

@ -22,7 +22,6 @@ SRC_CC += stack_area.cc \
pd_session_component.cc \
pd_assign_pci.cc \
pd_upgrade_ram_quota.cc \
native_pd_component.cc \
native_cpu_component.cc \
rpc_cap_factory.cc \
platform.cc \

View File

@ -1,3 +0,0 @@
KERNEL_CONFIG := $(REP_DIR)/config/imx53.kernel
include $(REP_DIR)/lib/mk/kernel-foc.inc

View File

@ -1,5 +0,0 @@
L4_CONFIG := $(call select_from_repositories,config/imx53.user)
L4_BIN_DIR := $(LIB_CACHE_DIR)/syscall-foc/build/bin/arm_armv7a
include $(REP_DIR)/lib/mk/spec/arm/syscall-foc.inc

View File

@ -38,9 +38,7 @@ class Genode::Native_cpu_component : public Rpc_object<Foc_native_cpu,
Native_cpu_component(Cpu_session_component &, char const *);
~Native_cpu_component();
void enable_vcpu(Thread_capability, addr_t) override;
Native_capability native_cap(Thread_capability) override;
Native_capability alloc_irq() override;
Foc_thread_state thread_state(Thread_capability) override;
};

View File

@ -1,45 +0,0 @@
/*
* \brief Kernel-specific part of the PD-session interface
* \author Norman Feske
* \date 2016-01-19
*/
/*
* Copyright (C) 2016-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _CORE__INCLUDE__NATIVE_PD_COMPONENT_H_
#define _CORE__INCLUDE__NATIVE_PD_COMPONENT_H_
/* Genode includes */
#include <foc_native_pd/foc_native_pd.h>
/* core-local includes */
#include <rpc_cap_factory.h>
namespace Genode {
class Pd_session_component;
class Native_pd_component;
}
class Genode::Native_pd_component : public Rpc_object<Foc_native_pd>
{
private:
Pd_session_component &_pd_session;
public:
Native_capability task_cap() override;
Native_pd_component(Pd_session_component &pd, char const *args);
~Native_pd_component();
};
#endif /* _CORE__INCLUDE__NATIVE_PD_COMPONENT_H_ */

View File

@ -25,28 +25,6 @@ namespace Fiasco {
#include <l4/sys/factory.h>
}
static Genode::Avl_tree<Genode::Cpu_session_irqs> _irq_tree;
void Genode::Native_cpu_component::enable_vcpu(Genode::Thread_capability thread_cap,
Genode::addr_t vcpu_state)
{
using namespace Genode;
using namespace Fiasco;
auto lambda = [&] (Cpu_thread_component *thread) {
if (!thread) return;
l4_cap_idx_t tid = thread->platform_thread().thread().local.data()->kcap();
l4_msgtag_t tag = l4_thread_vcpu_control(tid, vcpu_state);
if (l4_msgtag_has_error(tag))
warning("l4_thread_vcpu_control failed");
};
_thread_ep.apply(thread_cap, lambda);
}
Genode::Native_capability
Genode::Native_cpu_component::native_cap(Genode::Thread_capability cap)
@ -61,36 +39,6 @@ Genode::Native_cpu_component::native_cap(Genode::Thread_capability cap)
}
Genode::Native_capability Genode::Native_cpu_component::alloc_irq()
{
using namespace Fiasco;
using namespace Genode;
/* find irq object container of this cpu-session */
Cpu_session_irqs* node = _irq_tree.first();
if (node)
node = node->find_by_session(&_cpu_session);
/* if not found, we've to create one */
if (!node) {
node = new (&_cpu_session._md_alloc) Cpu_session_irqs(&_cpu_session);
_irq_tree.insert(node);
}
/* construct irq kernel-object */
Cap_index* i = cap_map()->insert(platform_specific()->cap_id_alloc()->alloc());
l4_msgtag_t res = l4_factory_create_irq(L4_BASE_FACTORY_CAP, i->kcap());
if (l4_error(res)) {
warning("Allocation of irq object failed!");
return Genode::Native_capability();
}
/* construct cap and hold a reference in the irq container object */
Genode::Native_capability cap(*i);
return (node->add(cap)) ? cap : Genode::Native_capability();
}
Genode::Foc_thread_state
Genode::Native_cpu_component::thread_state(Genode::Thread_capability cap)
{

View File

@ -1,40 +0,0 @@
/*
* \brief Kernel-specific part of the PD-session interface
* \author Norman Feske
* \date 2016-01-19
*/
/*
* Copyright (C) 2016-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#include <pd_session_component.h>
#include <native_pd_component.h>
using namespace Genode;
Native_capability Native_pd_component::task_cap()
{
return Native_capability(_pd_session._pd.native_task());
}
Native_pd_component::Native_pd_component(Pd_session_component &pd_session,
char const *args)
:
_pd_session(pd_session)
{
_pd_session._ep.manage(this);
}
Native_pd_component::~Native_pd_component()
{
_pd_session._ep.dissolve(this);
}

View File

@ -42,29 +42,14 @@ append config {
<provides><service name="Timer"/></provides>
<route> <any-service> <parent/> </any-service> </route>
</start>
<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 {
<start name="uart_drv">
<resource name="RAM" quantum="1M"/>
<provides>
<service name="Uart"/>
<service name="Terminal"/>
</provides>
<config> }
# on Fiasco.OC the kdb_uart_drv is always UART 0
append_if [have_spec foc] config {
<policy label_prefix="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 {
<config>
<policy label_prefix="terminal_mux" uart="1" detect_size="yes"/> }
append config {
</config>
<route> <any-service> <parent/> <any-child/> </any-service> </route>
</start>
@ -158,12 +143,9 @@ set boot_modules {
core init timer ld.lib.so noux terminal_mux terminal_log
test-signal cli_monitor test-resource_yield posix.lib.so
libc.lib.so libm.lib.so libc_noux.lib.so libc_terminal.lib.so ncurses.lib.so
vim.tar
vim.tar uart_drv
}
lappend_if [expr ![have_spec foc]] boot_modules uart_drv
lappend_if [have_spec foc] boot_modules kdb_uart_drv
set fiasco_serial_esc_arg ""
build_boot_image $boot_modules
@ -172,11 +154,10 @@ append qemu_args " -m 256 "
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,
# On all 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 file:kdb.log "
append qemu_args " -serial mon:stdio"
run_genode_until forever

View File

@ -50,15 +50,6 @@ class Cpu_sampler::Native_cpu_component : public Rpc_object<Foc_native_cpu,
_cpu_session_component.thread_ep().dissolve(this);
}
void enable_vcpu(Thread_capability thread_cap, addr_t vcpu_state) override
{
auto lambda = [&] (Cpu_sampler::Cpu_thread_component *cpu_thread) {
_foc_native_cpu.enable_vcpu(cpu_thread->parent_thread(), vcpu_state);
};
_cpu_session_component.thread_ep().apply(thread_cap, lambda);
}
Native_capability native_cap(Thread_capability thread_cap) override
{
auto lambda = [&] (Cpu_sampler::Cpu_thread_component *cpu_thread) {
@ -68,11 +59,6 @@ class Cpu_sampler::Native_cpu_component : public Rpc_object<Foc_native_cpu,
return _cpu_session_component.thread_ep().apply(thread_cap, lambda);
}
Native_capability alloc_irq() override
{
return _foc_native_cpu.alloc_irq();
}
Foc_thread_state thread_state(Thread_capability cap) override
{
auto lambda = [&] (Cpu_sampler::Cpu_thread_component *cpu_thread) {

View File

@ -4,8 +4,8 @@
# \date 2013-01-21
#
if {![have_spec foc] && ![have_spec fiasco]} {
puts "Run script only supports Fiasco/Fiasco.OC."; exit 0 }
if {![have_spec fiasco]} {
puts "Run script only supports Fiasco."; exit 0 }
#
# Build

View File

@ -1,5 +0,0 @@
REQUIRES = foc
LIBS += syscall-foc
include $(REP_DIR)/src/drivers/uart/kdb/target.inc

View File

@ -1,8 +0,0 @@
INC_DIR += $(REP_DIR)/src/lib/gdbserver_platform/spec/arm
SRC_C = reg-arm.c \
linux-arm-low.c
CC_OPT_linux-arm-low += -Wno-unused-function
include $(REP_DIR)/lib/mk/gdbserver_platform.inc

View File

@ -1,12 +0,0 @@
REQUIRES += foc
SRC_CC = spec/arm/low.cc \
native_cpu.cc
LIBS += syscall-foc
SHARED_LIB = yes
vpath %.cc $(REP_DIR)/src/lib/gdbserver_platform-foc
include $(REP_DIR)/lib/mk/spec/arm/gdbserver_platform-arm.inc

View File

@ -1,12 +0,0 @@
REQUIRES += foc
SRC_CC = spec/x86_32/low.cc \
native_cpu.cc
LIBS += syscall-foc
SHARED_LIB = yes
vpath %.cc $(REP_DIR)/src/lib/gdbserver_platform-foc
include $(REP_DIR)/lib/mk/spec/x86_32/gdbserver_platform-x86_32.inc

View File

@ -6,13 +6,12 @@
#
#
# Only the NOVA and 32-bit Fiasco.OC base platforms support most of the tested features
# at this time.
# Only the NOVA platform supports most of the tested features at this time.
#
if {![have_include "power_on/qemu"] ||
!([have_spec nova] || ([have_spec foc] && [have_spec 32bit]))} {
puts "Run script is only supported for NOVA or 32-bit Fiasco.OC in Qemu"; exit 0
!([have_spec nova])} {
puts "Run script is only supported for NOVA in Qemu"; exit 0
}
#

View File

@ -1,5 +1,5 @@
if {!([have_spec nova] || ([have_spec foc] && [have_spec 32bit]))} {
puts "\nThe Noux GDB scenario is only supported for NOVA or 32-bit Fiasco.OC\n"
if {!([have_spec nova])} {
puts "\nThe Noux GDB scenario is only supported for NOVA\n"
exit 0
}

View File

@ -1,96 +0,0 @@
/*
* \brief Fiasco.OC-specific 'Native_cpu' setup
* \author Christian Prochaska
* \date 2016-05-13
*/
/*
* Copyright (C) 2016-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/* Genode includes */
#include <foc_native_cpu/client.h>
/* GDB monitor includes */
#include "cpu_session_component.h"
#include "cpu_thread_component.h"
namespace Gdb_monitor {
class Native_cpu_component;
}
using namespace Genode;
class Gdb_monitor::Native_cpu_component : public Rpc_object<Foc_native_cpu,
Native_cpu_component>
{
private:
Cpu_session_component &_cpu_session_component;
Foc_native_cpu_client _foc_native_cpu;
public:
Native_cpu_component(Cpu_session_component &cpu_session_component)
: _cpu_session_component(cpu_session_component),
_foc_native_cpu(_cpu_session_component.parent_cpu_session().native_cpu())
{
_cpu_session_component.thread_ep().manage(this);
}
~Native_cpu_component()
{
_cpu_session_component.thread_ep().dissolve(this);
}
void enable_vcpu(Thread_capability thread_cap, addr_t vcpu_state) override
{
Cpu_thread_component *cpu_thread = _cpu_session_component.lookup_cpu_thread(thread_cap);
_foc_native_cpu.enable_vcpu(cpu_thread->parent_thread_cap(), vcpu_state);
}
Native_capability native_cap(Thread_capability thread_cap) override
{
Cpu_thread_component *cpu_thread = _cpu_session_component.lookup_cpu_thread(thread_cap);
return _foc_native_cpu.native_cap(cpu_thread->parent_thread_cap());
}
Native_capability alloc_irq() override
{
return _foc_native_cpu.alloc_irq();
}
Foc_thread_state thread_state(Thread_capability thread_cap) override
{
Cpu_thread_component *cpu_thread = _cpu_session_component.lookup_cpu_thread(thread_cap);
return _foc_native_cpu.thread_state(cpu_thread->parent_thread_cap());
}
};
Capability<Cpu_session::Native_cpu>
Gdb_monitor::Cpu_session_component::_setup_native_cpu()
{
Native_cpu_component *native_cpu_component =
new (_md_alloc) Native_cpu_component(*this);
return native_cpu_component->cap();
}
void Gdb_monitor::Cpu_session_component::_cleanup_native_cpu()
{
Native_cpu_component *native_cpu_component = nullptr;
_ep.apply(_native_cpu_cap, [&] (Native_cpu_component *c) { native_cpu_component = c; });
if (!native_cpu_component) return;
destroy(_md_alloc, native_cpu_component);
}

View File

@ -1,200 +0,0 @@
/*
* \brief Fiasco.OC(ARM)-specific helper functions for GDB server
* \author Christian Prochaska
* \date 2011-08-01
*/
/*
* Copyright (C) 2011-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/* Genode includes */
#include <base/log.h>
/* GDB monitor includes */
#include "cpu_session_component.h"
#include "reg-arm.h"
#include "gdbserver_platform_helper.h"
#include "genode_child_resources.h"
extern "C" {
#define private _private
#include "genode-low.h"
#define _private private
}
using namespace Genode;
static bool in_syscall(Thread_state const &ts)
{
try {
/* looking for syscall pattern:
* (PC-8: e1a0e00f mov lr, pc)
* PC-4: e3e0f00b mvn pc, #11
* (PC: e1a02004 mov r2, r4)
*/
if ((genode_read_memory_byte((void*)(ts.ip - 1)) == 0xe3) &&
(genode_read_memory_byte((void*)(ts.ip - 2)) == 0xe0) &&
(genode_read_memory_byte((void*)(ts.ip - 3)) == 0xf0) &&
(genode_read_memory_byte((void*)(ts.ip - 4)) == 0x0b))
return true;
} catch (No_memory_at_address) {
return false;
}
return false;
}
extern "C" int genode_fetch_register(int regno, unsigned long *value)
{
Thread_state ts;
try { ts = get_current_thread_state(); }
catch (...) {
error(__PRETTY_FUNCTION__, ": could not get current thread state");
return -1;
}
if (in_syscall(ts) || ts.unresolved_page_fault) {
switch((enum reg_index)regno)
{
case R0: cannot_fetch_register("R0"); return -1;
case R1: cannot_fetch_register("R1"); return -1;
case R2: cannot_fetch_register("R2"); return -1;
case R3: cannot_fetch_register("R3"); return -1;
case R4: cannot_fetch_register("R4"); return -1;
case R5: cannot_fetch_register("R5"); return -1;
case R6: cannot_fetch_register("R6"); return -1;
case R7: cannot_fetch_register("R7"); return -1;
case R8: cannot_fetch_register("R8"); return -1;
case R9: cannot_fetch_register("R9"); return -1;
case R10: cannot_fetch_register("R10"); return -1;
case R11:
if (in_syscall(ts)) {
/* R11 can be calculated from SP. The offset can be found in
* the disassembled 'Fiasco::l4_ipc()' function:
* add r11, sp, #8 -> r11 = sp + 8
* sub sp, sp, #20 -> r11 = (sp + 20) + 8
*/
*value = (ts.sp + 20) + 8;
/* for the debug output, if enabled */
fetch_register("R11", *value, *value);
return 0;
} else {
cannot_fetch_register("R11");
return -1;
}
case R12: cannot_fetch_register("R12"); return -1;
case SP: fetch_register("SP ", ts.sp, *value); return 0;
case LR: cannot_fetch_register("LR"); return -1;
case PC: fetch_register("PC ", ts.ip, *value); return 0;
case F0: cannot_fetch_register("F0"); return -1;
case F1: cannot_fetch_register("F1"); return -1;
case F2: cannot_fetch_register("F2"); return -1;
case F3: cannot_fetch_register("F3"); return -1;
case F4: cannot_fetch_register("F4"); return -1;
case F5: cannot_fetch_register("F5"); return -1;
case F6: cannot_fetch_register("F6"); return -1;
case F7: cannot_fetch_register("F7"); return -1;
case FPS: cannot_fetch_register("FPS"); return -1;
case CPSR: cannot_fetch_register("CPSR"); return -1;
default: error("unhandled register ", regno); return -1;
}
} else {
switch((enum reg_index)regno)
{
case R0: fetch_register("R0 ", ts.r0, *value); return 0;
case R1: fetch_register("R1 ", ts.r1, *value); return 0;
case R2: fetch_register("R2 ", ts.r2, *value); return 0;
case R3: fetch_register("R3 ", ts.r3, *value); return 0;
case R4: fetch_register("R4 ", ts.r4, *value); return 0;
case R5: fetch_register("R5 ", ts.r5, *value); return 0;
case R6: fetch_register("R6 ", ts.r6, *value); return 0;
case R7: fetch_register("R7 ", ts.r7, *value); return 0;
case R8: fetch_register("R8 ", ts.r8, *value); return 0;
case R9: fetch_register("R9 ", ts.r9, *value); return 0;
case R10: fetch_register("R10 ", ts.r10, *value); return 0;
case R11: fetch_register("R11 ", ts.r11, *value); return 0;
case R12: fetch_register("R12 ", ts.r12, *value); return 0;
case SP: fetch_register("SP ", ts.sp, *value); return 0;
case LR: fetch_register("LR ", ts.lr, *value); return 0;
case PC: fetch_register("PC ", ts.ip, *value); return 0;
case F0: cannot_fetch_register("F0"); return -1;
case F1: cannot_fetch_register("F1"); return -1;
case F2: cannot_fetch_register("F2"); return -1;
case F3: cannot_fetch_register("F3"); return -1;
case F4: cannot_fetch_register("F4"); return -1;
case F5: cannot_fetch_register("F5"); return -1;
case F6: cannot_fetch_register("F6"); return -1;
case F7: cannot_fetch_register("F7"); return -1;
case FPS: cannot_fetch_register("FPS"); return -1;
case CPSR: fetch_register("CPSR", ts.cpsr, *value); return 0;
default: error("unhandled register ", regno); return -1;
}
}
return -1;
}
extern "C" void genode_store_register(int regno, unsigned long value)
{
Thread_state ts;
try { ts = get_current_thread_state(); }
catch (...) {
error(__PRETTY_FUNCTION__, ": could not get current thread state");
return;
}
if (in_syscall(ts)) {
log("cannot set registers while thread is in syscall");
return;
}
switch((enum reg_index)regno)
{
case R0: if (!store_register("R0 ", ts.r0, value)) return; break;
case R1: if (!store_register("R1 ", ts.r1, value)) return; break;
case R2: if (!store_register("R2 ", ts.r2, value)) return; break;
case R3: if (!store_register("R3 ", ts.r3, value)) return; break;
case R4: if (!store_register("R4 ", ts.r4, value)) return; break;
case R5: if (!store_register("R5 ", ts.r5, value)) return; break;
case R6: if (!store_register("R6 ", ts.r6, value)) return; break;
case R7: if (!store_register("R7 ", ts.r7, value)) return; break;
case R8: if (!store_register("R8 ", ts.r8, value)) return; break;
case R9: if (!store_register("R9 ", ts.r9, value)) return; break;
case R10: if (!store_register("R10 ", ts.r10, value)) return; break;
case R11: if (!store_register("R11 ", ts.r11, value)) return; break;
case R12: if (!store_register("R12 ", ts.r12, value)) return; break;
case SP: if (!store_register("SP ", ts.sp, value)) return; break;
case LR: if (!store_register("LR ", ts.lr, value)) return; break;
case PC: if (!store_register("PC ", ts.ip, value)) return; break;
case F0: cannot_store_register("F0 ", value); return;
case F1: cannot_store_register("F1 ", value); return;
case F2: cannot_store_register("F2 ", value); return;
case F3: cannot_store_register("F3 ", value); return;
case F4: cannot_store_register("F4 ", value); return;
case F5: cannot_store_register("F5 ", value); return;
case F6: cannot_store_register("F6 ", value); return;
case F7: cannot_store_register("F7 ", value); return;
case FPS: cannot_store_register("FPS", value); return;
case CPSR: if (!store_register("CPSR", ts.cpsr, value)) return; break;
}
set_current_thread_state(ts);
}

View File

@ -1,189 +0,0 @@
/*
* \brief Fiasco.OC(x86_32)-specific helper functions for GDB server
* \author Christian Prochaska
* \date 2011-05-06
*/
/*
* Copyright (C) 2011-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/* Genode includes */
#include <base/log.h>
/* GDB monitor includes */
#include "i386.h"
#include "cpu_session_component.h"
#include "gdbserver_platform_helper.h"
#include "genode_child_resources.h"
extern "C" {
#define private _private
#include "genode-low.h"
#define _private private
}
using namespace Genode;
static bool in_syscall(Thread_state const &thread_state)
{
/* looking for syscall pattern:
* EIP-7: 55 push %ebp
* EIP-6: ff 93 call ...
* EIP: 5d pop %ebp
*/
if ((genode_read_memory_byte((void*)(thread_state.ip)) == 0x5d) &&
(genode_read_memory_byte((void*)(thread_state.ip - 5)) == 0x93) &&
(genode_read_memory_byte((void*)(thread_state.ip - 6)) == 0xff) &&
(genode_read_memory_byte((void*)(thread_state.ip - 7)) == 0x55))
return true;
return false;
}
extern "C" int genode_fetch_register(int regno, unsigned long *value)
{
Thread_state ts;
try { ts = get_current_thread_state(); }
catch (...) {
error(__PRETTY_FUNCTION__, ": could not get current thread state");
return -1;
}
if (in_syscall(ts) || ts.unresolved_page_fault) {
switch((enum reg_index)regno)
{
case EAX: cannot_fetch_register("EAX"); return -1;
case ECX: cannot_fetch_register("ECX"); return -1;
case EDX: cannot_fetch_register("EDX"); return -1;
case EBX:
if (in_syscall(ts)) {
/* When in a syscall, the user EBX has been pushed onto the stack at address ESP+4 */
*value = genode_read_memory_byte((void*)(ts.sp + 4))
+ (genode_read_memory_byte((void*)(ts.sp + 5)) << 8)
+ (genode_read_memory_byte((void*)(ts.sp + 6)) << 16)
+ (genode_read_memory_byte((void*)(ts.sp + 7)) << 24);
/* for the debug output, if enabled */
fetch_register("EBX", *value, *value);
return 0;
} else {
cannot_fetch_register("EBX");
return -1;
}
case UESP: fetch_register("ESP", ts.sp, *value); return 0;
case EBP:
if (in_syscall(ts)) {
/* When in a syscall, the user EBP has been pushed onto the stack at address ESP+0 */
*value = genode_read_memory_byte((void*)(ts.sp + 0))
+ (genode_read_memory_byte((void*)(ts.sp + 1)) << 8)
+ (genode_read_memory_byte((void*)(ts.sp + 2)) << 16)
+ (genode_read_memory_byte((void*)(ts.sp + 3)) << 24);
/* for the debug output, if enabled */
fetch_register("EBP", *value, *value);
return 0;
} else {
cannot_fetch_register("EBP");
return -1;
}
case ESI: cannot_fetch_register("ESI"); return -1;
case EDI: cannot_fetch_register("EDI"); return -1;
case EIP: fetch_register("EIP", ts.ip, *value); return 0;
case EFL: cannot_fetch_register("EFL"); return -1;
case CS: cannot_fetch_register("CS"); return -1;
case SS: cannot_fetch_register("SS"); return -1;
case DS: cannot_fetch_register("DS"); return -1;
case ES: cannot_fetch_register("ES"); return -1;
case FS: cannot_fetch_register("FS"); return -1;
case GS: cannot_fetch_register("GS"); return -1;
default: error("unhandled register ", regno); return -1;
}
} else {
switch((enum reg_index)regno)
{
case EAX: fetch_register("EAX", ts.eax, *value); return 0;
case ECX: fetch_register("ECX", ts.ecx, *value); return 0;
case EDX: fetch_register("EDX", ts.edx, *value); return 0;
case EBX: fetch_register("EBX", ts.ebx, *value); return 0;
case UESP: fetch_register("ESP", ts.sp, *value); return 0;
case EBP: fetch_register("EBP", ts.ebp, *value); return 0;
case ESI: fetch_register("ESI", ts.esi, *value); return 0;
case EDI: fetch_register("EDI", ts.edi, *value); return 0;
case EIP: fetch_register("EIP", ts.ip, *value); return 0;
case EFL: fetch_register("EFL", ts.eflags, *value); return 0;
case CS: cannot_fetch_register("CS"); return -1;
case SS: cannot_fetch_register("SS"); return -1;
case DS: cannot_fetch_register("DS"); return -1;
case ES: cannot_fetch_register("ES"); return -1;
case FS: fetch_register("FS", ts.fs, *value); return 0;
case GS: fetch_register("GS", ts.gs, *value); return 0;
default: error("unhandled register ", regno); return -1;
}
}
return -1;
}
extern "C" void genode_store_register(int regno, unsigned long value)
{
Thread_state ts;
try { ts = get_current_thread_state(); }
catch (...) {
error(__PRETTY_FUNCTION__, ": could not get current thread state");
return;
}
if (in_syscall(ts)) {
log("cannot set registers while thread is in syscall");
return;
}
switch((enum reg_index)regno)
{
case EAX: if (!store_register("EAX", ts.eax, value)) return; break;
case ECX: if (!store_register("ECX", ts.ecx, value)) return; break;
case EDX: if (!store_register("EDX", ts.edx, value)) return; break;
case EBX: if (!store_register("EBX", ts.ebx, value)) return; break;
case UESP: if (!store_register("ESP", ts.sp, value)) return; break;
case EBP: if (!store_register("EBP", ts.ebp, value)) return; break;
case ESI: if (!store_register("ESI", ts.esi, value)) return; break;
case EDI: if (!store_register("EDI", ts.edi, value)) return; break;
case EIP: if (!store_register("EIP", ts.ip, value)) return; break;
case EFL: if (!store_register("EFL", ts.eflags, value)) return; break;
case CS: cannot_store_register("CS", value); return;
case SS: cannot_store_register("SS", value); return;
case DS: cannot_store_register("DS", value); return;
case ES: cannot_store_register("ES", value); return;
case FS: if (!store_register("FS ", ts.fs, value)) return; break;
case GS: if (!store_register("GS ", ts.gs, value)) return; break;
default: error("unhandled register ", regno); return;
}
set_current_thread_state(ts);
}

View File

@ -1,2 +0,0 @@
TARGET = gdbserver_platform-foc
LIBS = gdbserver_platform-foc

View File

@ -1,7 +0,0 @@
REPOSITORIES = $(GENODE_DIR)/repos/base-foc
##
## Kernel-specific run tool configuration
##
RUN_OPT = --include boot_dir/foc

View File

@ -17,7 +17,7 @@ PLATFORMS = x86_32 x86_64 panda pbxa9 rpi arndale imx53_qsb imx53_qsb_tz \
PLATFORMS_DEPR = linux_x86 linux_arm fiasco_x86 okl4_x86 pistachio_x86 \
nova_x86_32 nova_x86_64 hw_x86_64 foc_x86_32 foc_x86_64 \
sel4_x86_32 hw_panda foc_panda hw_pbxa9 foc_pbxa9 hw_rpi \
foc_rpi hw_arndale foc_arndale hw_imx53_qsb foc_imx53 \
foc_rpi hw_arndale foc_arndale hw_imx53_qsb \
hw_imx53_qsb_tz hw_usb_armory hw_wand_quad hw_odroid_xu \
hw_zynq hw_x86_64_muen hw_riscv foc_odroid_x2
@ -41,7 +41,6 @@ PLATFORM_ALT(foc_rpi) = rpi
PLATFORM_ALT(hw_arndale) = arndale
PLATFORM_ALT(foc_arndale) = arndale
PLATFORM_ALT(hw_imx53_qsb) = imx53_qsb
PLATFORM_ALT(foc_imx53) = imx53_qsb
PLATFORM_ALT(hw_imx53_qsb_tz) = imx53_qsb_tz
PLATFORM_ALT(hw_usb_armory) = usb_armory
PLATFORM_ALT(hw_wand_quad) = wand_quad
@ -140,7 +139,7 @@ BUILD_CONF(pbxa9) := run_kernel_hw_foc $(BUILD_CONF_PBXA9)
BUILD_CONF(panda) := run_kernel_hw_foc run_boot_dir repos
BUILD_CONF(rpi) := run_kernel_hw_foc run_boot_dir repos
BUILD_CONF(arndale) := run_kernel_hw_foc run_boot_dir repos
BUILD_CONF(imx53_qsb) := run_kernel_hw_foc run_boot_dir repos
BUILD_CONF(imx53_qsb) := run_kernel_hw run_boot_dir repos
BUILD_CONF(imx53_qsb_tz) := run_kernel_hw run_boot_dir repos
BUILD_CONF(usb_armory) := run_kernel_hw run_boot_dir repos
BUILD_CONF(wand_quad) := run_kernel_hw run_boot_dir repos
@ -172,7 +171,6 @@ BUILD_CONF(foc_rpi) := run_kernel_foc run_boot_dir repos
BUILD_CONF(hw_arndale) := ${BUILD_CONF(arndale)}
BUILD_CONF(foc_arndale) := run_kernel_foc run_boot_dir repos
BUILD_CONF(hw_imx53_qsb) := ${BUILD_CONF(imx53_qsb)}
BUILD_CONF(foc_imx53) := run_kernel_foc run_boot_dir repos
BUILD_CONF(hw_imx53_qsb_tz) := ${BUILD_CONF(imx53_qsb_tz)}
BUILD_CONF(hw_usb_armory) := ${BUILD_CONF(usb_armory)}
BUILD_CONF(hw_wand_quad) := ${BUILD_CONF(wand_quad)}
@ -255,7 +253,6 @@ SPECS(foc_rpi) := foc_rpi rpi
SPECS(hw_arndale) := ${SPECS(arndale)}
SPECS(foc_arndale) := foc_arndale arndale
SPECS(hw_imx53_qsb) := ${SPECS(imx53_qsb)}
SPECS(foc_imx53) := foc_imx53 imx53_qsb
SPECS(hw_imx53_qsb_tz) := ${SPECS(imx53_qsb_tz)}
SPECS(hw_usb_armory) := ${SPECS(usb_armory)}
SPECS(hw_wand_quad) := ${SPECS(wand_quad)}