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
This commit is contained in:
Martin Stein 2013-06-06 14:36:42 +02:00 committed by Norman Feske
parent e20b773bef
commit 6b42fff30e
3 changed files with 2 additions and 65 deletions

View File

@ -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

View File

@ -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;

View File

@ -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