genode/repos/base/src/lib/startup/spec/arm/crt0.s

67 lines
1.4 KiB
ArmAsm
Raw Normal View History

2011-12-22 16:19:25 +01:00
/**
* \brief Startup code for Genode applications on ARM
* \author Norman Feske
* \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.
*/
/**************************
** .text (program code) **
**************************/
2011-12-22 16:19:25 +01:00
.section ".text.crt0"
/* program entry-point */
.global _start
_start:
.global _start_initial_stack
_start_initial_stack:
2011-12-22 16:19:25 +01:00
/* make initial value of some registers available to higher-level code */
ldr r4, =__initial_sp
str sp, [r4]
/*
* Install initial temporary environment that is replaced later by the
* environment that init_main_thread creates.
*/
ldr sp, =_stack_high
/* if this is the dynamic linker, init_rtld relocates the linker */
bl init_rtld
/* create proper environment for main thread */
bl init_main_thread
2011-12-22 16:19:25 +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
/* jump into init C code instead of calling it as it should never return */
b _main
/*********************************
** .bss (non-initialized data) **
*********************************/
2011-12-22 16:19:25 +01:00
.section ".bss"
/* stack of the temporary initial environment */
.p2align 4
.space 32 * 1024
_stack_high:
2011-12-22 16:19:25 +01:00
/* initial value of the SP register */
.global __initial_sp
__initial_sp:
.space 4