NanoPayload

stage1/head1.S

88:e75e6bb0021e
2016-01-17 Paul Boddie Initialise registers so that the stage 2 payload may use interrupts. stage2-non-pic
     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 #define CP0_STATUS $12    29 #define CP0_CAUSE $13    30     31 _start:    32 	b real_start    33 	nop    34     35 	/* 8 words for firmware parameters (0x80002008), struct fw_args */    36     37 	.word 0x0    38 	.word 0x0    39 	.word 0x0    40 	.word 0x0    41 	.word 0x0    42 	.word 0x0    43 	.word 0x0    44 	.word 0x0    45     46 real_start:    47 	/*    48 	Reset various registers. Otherwise, interrupts do not apparently get    49 	re-enabled properly later when requested.    50 	*/    51     52 	li $t0, 0x0040fc04 /* BEV=1, interrupts enabled, ERL=1 */    53 	mtc0 $t0, CP0_STATUS    54     55         li $t0, 0x00800000 /* IV=1 */    56         mtc0 $t0, CP0_CAUSE     57     58 	/* Setup stack, jump to C code. */    59     60 	la $sp, 0x80004000    61 	j c_main    62 	nop    63     64 .set reorder