NanoPayload

Annotated stage1/head1.S

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