2012-12-14 22:05:21 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the libpayload project.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 Advanced Micro Devices, Inc.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2013-12-13 05:24:48 +01:00
|
|
|
#include <arch/asm.h>
|
2012-12-14 22:05:21 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Our entry point
|
|
|
|
*/
|
2013-12-13 05:24:48 +01:00
|
|
|
ENTRY(_entry)
|
2012-12-14 22:05:21 +01:00
|
|
|
|
|
|
|
/* TODO: disable interrupts */
|
2013-02-27 04:08:28 +01:00
|
|
|
|
2012-12-14 22:05:21 +01:00
|
|
|
/* TODO: Clear BSS */
|
2013-02-27 04:08:28 +01:00
|
|
|
|
|
|
|
/* Setup new stack */
|
2014-01-25 01:23:08 +01:00
|
|
|
ldr sp, 1f
|
2013-02-27 04:08:28 +01:00
|
|
|
|
2013-12-13 05:24:48 +01:00
|
|
|
/* TODO: Save old stack pointer and link register */
|
2012-12-14 22:05:21 +01:00
|
|
|
|
|
|
|
/* Let's rock. */
|
2013-12-13 05:24:48 +01:00
|
|
|
bl start_main
|
2012-12-14 22:05:21 +01:00
|
|
|
|
2013-12-13 05:24:48 +01:00
|
|
|
/* %r0 has the return value - pass it on unmolested */
|
|
|
|
|
|
|
|
/* TODO: restore old stack pointer and link register */
|
2012-12-14 22:05:21 +01:00
|
|
|
|
|
|
|
/* Return to the original context. */
|
2013-12-13 05:24:48 +01:00
|
|
|
bx lr
|
|
|
|
ENDPROC(_entry)
|
2014-01-25 01:23:08 +01:00
|
|
|
|
|
|
|
.align 4
|
|
|
|
1:
|
|
|
|
.word _stack
|