2011-12-22 16:19:25 +01:00
|
|
|
/**
|
|
|
|
* \brief Startup code for Genode applications on ARM
|
|
|
|
* \author Norman Feske
|
2014-01-28 14:30:36 +01:00
|
|
|
* \author Martin Stein
|
2011-12-22 16:19:25 +01:00
|
|
|
* \date 2007-04-28
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 21:44:47 +01:00
|
|
|
* Copyright (C) 2007-2013 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
2014-01-28 14:30:36 +01:00
|
|
|
|
|
|
|
/**************************
|
|
|
|
** .text (program code) **
|
|
|
|
**************************/
|
|
|
|
|
2011-12-22 16:19:25 +01:00
|
|
|
.section ".text.crt0"
|
|
|
|
|
2014-01-28 14:30:36 +01:00
|
|
|
/* program entry-point */
|
|
|
|
.global _start
|
|
|
|
_start:
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2014-01-28 14:30:36 +01:00
|
|
|
/* make initial value of some registers available to higher-level code */
|
|
|
|
ldr r4, =__initial_sp
|
2013-05-24 11:04:42 +02:00
|
|
|
str sp, [r4]
|
|
|
|
|
2014-01-28 14:30:36 +01:00
|
|
|
/*
|
|
|
|
* Install initial temporary environment that is replaced later by the
|
|
|
|
* environment that init_main_thread creates.
|
|
|
|
*/
|
|
|
|
ldr sp, =_stack_high
|
|
|
|
|
2014-02-05 15:15:39 +01:00
|
|
|
/* if this is the dynamic linker, init_rtld relocates the linker */
|
|
|
|
bl init_rtld
|
|
|
|
|
2014-01-28 14:30:36 +01:00
|
|
|
/* create proper environment for main thread */
|
|
|
|
bl init_main_thread
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2014-01-28 14:30:36 +01:00
|
|
|
/* apply environment that was created by init_main_thread */
|
|
|
|
ldr sp, =init_main_thread_result
|
|
|
|
ldr sp, [sp]
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2014-01-28 14:30:36 +01:00
|
|
|
/* jump into init C code instead of calling it as it should never return */
|
|
|
|
b _main
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************
|
|
|
|
** .bss (non-initialized data) **
|
|
|
|
*********************************/
|
2013-05-24 11:04:42 +02:00
|
|
|
|
2011-12-22 16:19:25 +01:00
|
|
|
.section ".bss"
|
|
|
|
|
2014-01-28 14:30:36 +01:00
|
|
|
/* stack of the temporary initial environment */
|
2012-06-12 14:37:00 +02:00
|
|
|
.p2align 4
|
2014-02-06 01:32:52 +01:00
|
|
|
.space 32 * 1024
|
2014-01-28 14:30:36 +01:00
|
|
|
_stack_high:
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2013-06-06 17:43:13 +02:00
|
|
|
/* initial value of the SP register */
|
2014-01-28 14:30:36 +01:00
|
|
|
.global __initial_sp
|
|
|
|
__initial_sp:
|
|
|
|
.space 4
|