Paul Burton | e853003 | 2014-06-14 00:00:10 +0100 | [diff] [blame] | 1 | /* |
| 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 Burton | e853003 | 2014-06-14 00:00:10 +0100 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | .set noreorder /* Prevent assembler from "optimizing" this code. */ |
| 17 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 18 | .section ".text._start", "ax", %progbits |
Paul Burton | e853003 | 2014-06-14 00:00:10 +0100 | [diff] [blame] | 19 | .globl _start |
| 20 | _start: |
| 21 | /* Set the stack pointer */ |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 22 | la $sp, _estack |
Paul Burton | e853003 | 2014-06-14 00:00:10 +0100 | [diff] [blame] | 23 | |
| 24 | /* |
| 25 | * Initialise the stack to a known value, used later to check for |
| 26 | * overflow. |
| 27 | */ |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 28 | la $t0, _stack |
Paul Burton | e853003 | 2014-06-14 00:00:10 +0100 | [diff] [blame] | 29 | addi $t1, $sp, -4 |
| 30 | li $t2, 0xdeadbeef |
| 31 | 1: sw $t2, 0($t0) |
| 32 | bne $t0, $t1, 1b |
| 33 | addi $t0, $t0, 4 |
| 34 | |
| 35 | /* Run main */ |
| 36 | b main |
| 37 | |
Vadim Bendebury | b92e543 | 2014-10-03 09:47:13 -0700 | [diff] [blame] | 38 | /* |
| 39 | * Should never return from main. Make sure there is no branch in the |
| 40 | * branch delay slot. |
| 41 | */ |
| 42 | 2: nop |
Paul Burton | e853003 | 2014-06-14 00:00:10 +0100 | [diff] [blame] | 43 | b 2b |
Vadim Bendebury | b92e543 | 2014-10-03 09:47:13 -0700 | [diff] [blame] | 44 | nop /* Make sure there is no branch after this either. */ |