From 6b42fff30ec1dcdc80dd398b715b66f310b41055 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Thu, 6 Jun 2013 14:36:42 +0200 Subject: [PATCH] hw: use generic crt0.s for progs other than core Use '__initial_sp' instead of '_main_utcb' to receive a main threads UTCB pointer outside core. Ref #766 --- base-hw/lib/mk/arm/startup.mk | 10 ------ base-hw/src/base/thread_support.cc | 4 +-- base-hw/src/platform/arm/crt0.s | 53 ------------------------------ 3 files changed, 2 insertions(+), 65 deletions(-) delete mode 100755 base-hw/lib/mk/arm/startup.mk delete mode 100644 base-hw/src/platform/arm/crt0.s diff --git a/base-hw/lib/mk/arm/startup.mk b/base-hw/lib/mk/arm/startup.mk deleted file mode 100755 index 715f95ff5..000000000 --- a/base-hw/lib/mk/arm/startup.mk +++ /dev/null @@ -1,10 +0,0 @@ -# -# \brief Linked against any program expect LDSO and dynamic binaries -# \author Martin Stein -# \date 2012-04-16 -# - -include $(BASE_DIR)/lib/mk/startup.inc - -vpath crt0.s $(REP_DIR)/src/platform/arm - diff --git a/base-hw/src/base/thread_support.cc b/base-hw/src/base/thread_support.cc index e917027cd..dc53e774a 100644 --- a/base-hw/src/base/thread_support.cc +++ b/base-hw/src/base/thread_support.cc @@ -19,7 +19,7 @@ using namespace Genode; -extern Native_utcb * _main_utcb; +extern Native_utcb * __initial_sp; namespace Genode { Rm_session *env_context_area_rm_session(); } @@ -31,7 +31,7 @@ namespace Genode { Rm_session *env_context_area_rm_session(); } Native_utcb * Thread_base::utcb() { /* this is a main thread, so CRT0 provides UTCB through '_main_utcb' */ - if (!this) return _main_utcb; + if (!this) return __initial_sp; /* otherwise we have a valid thread base */ return &_context->utcb; diff --git a/base-hw/src/platform/arm/crt0.s b/base-hw/src/platform/arm/crt0.s deleted file mode 100644 index dba4a8adc..000000000 --- a/base-hw/src/platform/arm/crt0.s +++ /dev/null @@ -1,53 +0,0 @@ - -/** - * \brief Startup code for Genode programs on Cortex A9 - * \author Martin Stein - * \date 2011-10-01 - */ - -/* - * Copyright (C) 2012-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. - */ - -.section .text - - /* ELF entry symbol */ - .global _start - _start: - - /* fetch thread-entry arguments to their destinations in BSS */ - ldr r0, =_main_utcb - str sp, [r0] - - /* call _main routine */ - ldr sp, =_stack_high - .extern _main - bl _main - 1: b 1b - - /* dynamic symbol object handle */ - .p2align 2 - .global __dso_handle - __dso_handle: .long 0 - - .global __initial_sp - __initial_sp: .long 0 - -.section .bss - - /* main-thread stack */ - .p2align 2 - .global _stack_low - _stack_low: - .space 64*1024 - .global _stack_high - _stack_high: - - /* main-thread UTCB-pointer for the Genode thread-API */ - .p2align 2 - .global _main_utcb - _main_utcb: .long 0 -