genode/base/src/platform/arm/crt0.s

70 lines
1.5 KiB
ArmAsm

/**
* \brief Startup code for Genode applications on ARM
* \author Norman Feske
* \author Martin Stein
* \date 2007-04-28
*/
/*
* Copyright (C) 2007-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.
*/
/**************************
** .text (program code) **
**************************/
.section ".text.crt0"
/* program entry-point */
.global _start
_start:
/* 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
/* create proper environment for main thread */
bl init_main_thread
/* apply environment that was created by init_main_thread */
ldr sp, =init_main_thread_result
ldr sp, [sp]
/* jump into init C code instead of calling it as it should never return */
b _main
/*********************************
** .bss (non-initialized data) **
*********************************/
.section ".bss"
/* stack of the temporary initial environment */
.p2align 4
.global _stack_low
_stack_low:
.space 128 * 1024
.global _stack_high
_stack_high:
/* initial value of the SP register */
.global __initial_sp
__initial_sp:
.space 4
/* return value of init_main_thread */
.global init_main_thread_result
init_main_thread_result:
.space 4