1 /* 2 * Initialisation for the stage 1 payload with support for boot parameters. 3 * 4 * Copyright (C) 2009 Qi Hardware Inc. 5 * Author: Wolfgang Spraul <wolfgang@sharism.cc> 6 * 7 * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 8 * 9 * This program is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation, either version 3 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 23 .text 24 .extern c_main 25 .globl _start 26 .set noreorder 27 28 #include "mips.h" 29 30 _start: 31 b real_start 32 nop 33 34 /* 8 words for firmware parameters (0x80002008), struct fw_args */ 35 36 .word 0x0 37 .word 0x0 38 .word 0x0 39 .word 0x0 40 .word 0x0 41 .word 0x0 42 .word 0x0 43 .word 0x0 44 45 real_start: 46 /* 47 Reset various registers. Otherwise, interrupts do not apparently get 48 re-enabled properly later when requested. 49 */ 50 51 li $t0, 0x0040fc04 /* BEV=1, interrupts enabled, ERL=1 */ 52 mtc0 $t0, CP0_STATUS 53 54 li $t0, 0x00800000 /* IV=1 */ 55 mtc0 $t0, CP0_CAUSE 56 57 /* Setup stack, jump to C code. */ 58 59 la $sp, 0x80004000 60 j c_main 61 nop 62 63 .set reorder