diff --git a/ports/lib/mk/nova_x86_32/gdbserver_platform.mk b/ports/lib/mk/nova_x86_32/gdbserver_platform.mk new file mode 100644 index 0000000000..49d21272c5 --- /dev/null +++ b/ports/lib/mk/nova_x86_32/gdbserver_platform.mk @@ -0,0 +1,3 @@ +SRC_CC = nova_x86_32_low.cc + +include $(REP_DIR)/lib/mk/x86_32/gdbserver_platform_x86_32.inc diff --git a/ports/run/gdb_monitor.run b/ports/run/gdb_monitor.run index c5e73328a0..8aff604830 100644 --- a/ports/run/gdb_monitor.run +++ b/ports/run/gdb_monitor.run @@ -6,10 +6,14 @@ # # -# Only Genode/Fiasco.OC supports all the tested features at this time +# Only Genode/Fiasco.OC and Genode/NOVA supports all the tested features +# at this time # -assert_spec foc +if {![have_spec foc] && ![have_spec nova]} { + puts "Run script requires foc or nova"; exit 0 +} + # # Build diff --git a/ports/src/lib/gdbserver_platform/nova_x86_32_low.cc b/ports/src/lib/gdbserver_platform/nova_x86_32_low.cc new file mode 100644 index 0000000000..505b2144e7 --- /dev/null +++ b/ports/src/lib/gdbserver_platform/nova_x86_32_low.cc @@ -0,0 +1,49 @@ +/* + * \brief NOVA specific helper functions for GDB server + * \author Alexander Boettcher + * \date 2012-08-09 + */ + +/* + * Copyright (C) 2012-2012 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 "i386.h" +#include "cpu_session_component.h" +#include "gdbserver_platform_helper.h" +#include "gdb_stub_thread.h" + +using namespace Genode; + +extern "C" int genode_fetch_register(int regno, unsigned long *reg_content) +{ + Thread_state thread_state; + + if (!get_current_thread_state(thread_state)) + return -1; + + switch((enum reg_index)regno) + { + case EAX: *reg_content = thread_state.eax; return 0; + case ECX: *reg_content = thread_state.ecx; return 0; + case EDX: *reg_content = thread_state.edx; return 0; + case EBX: *reg_content = thread_state.ebx; return 0; + case UESP: *reg_content = thread_state.sp; return 0; + case EBP: *reg_content = thread_state.ebp; return 0; + case ESI: *reg_content = thread_state.esi; return 0; + case EDI: *reg_content = thread_state.edi; return 0; + case EIP: *reg_content = thread_state.ip; return 0; + case EFL: *reg_content = thread_state.eflags; return 0; + case CS: return -1; + case SS: return -1; + case DS: return -1; + case ES: return -1; + case FS: *reg_content = thread_state.fs; return 0; + case GS: *reg_content = thread_state.gs; return 0; + } + + return -1; +}