blob: 849c168fd0cf7045be00f43ddc501e4c94cc0746 [file] [log] [blame]
Paul Burtone8530032014-06-14 00:00:10 +01001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2014 Imagination Technologies
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Paul Burtone8530032014-06-14 00:00:10 +010014 */
15
16.set noreorder /* Prevent assembler from "optimizing" this code. */
17
Julius Wernerec5e5e02014-08-20 15:29:56 -070018.section ".text._start", "ax", %progbits
Paul Burtone8530032014-06-14 00:00:10 +010019.globl _start
20_start:
21 /* Set the stack pointer */
Julius Wernerec5e5e02014-08-20 15:29:56 -070022 la $sp, _estack
Paul Burtone8530032014-06-14 00:00:10 +010023
24 /*
25 * Initialise the stack to a known value, used later to check for
26 * overflow.
27 */
Julius Wernerec5e5e02014-08-20 15:29:56 -070028 la $t0, _stack
Paul Burtone8530032014-06-14 00:00:10 +010029 addi $t1, $sp, -4
30 li $t2, 0xdeadbeef
311: sw $t2, 0($t0)
32 bne $t0, $t1, 1b
33 addi $t0, $t0, 4
34
35 /* Run main */
36 b main
37
Vadim Bendeburyb92e5432014-10-03 09:47:13 -070038 /*
39 * Should never return from main. Make sure there is no branch in the
40 * branch delay slot.
41 */
422: nop
Paul Burtone8530032014-06-14 00:00:10 +010043 b 2b
Vadim Bendeburyb92e5432014-10-03 09:47:13 -070044 nop /* Make sure there is no branch after this either. */