mirror of
git://projects.qi-hardware.com/iris.git
synced 2024-11-05 15:49:42 +02:00
66 lines
1.7 KiB
ArmAsm
66 lines
1.7 KiB
ArmAsm
// Iris: micro-kernel for a capability-based operating system.
|
|
// mips/boot.S: Kernel entry point, called by the boot loader.
|
|
// Copyright 2009 Bas Wijnen <wijnen@debian.org>
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#define ASM
|
|
#define ARCH
|
|
#include "arch.hh"
|
|
|
|
// The kernel stack.
|
|
.lcomm kernel_stack, KERNEL_STACK_SIZE
|
|
|
|
.globl __start
|
|
.set noreorder
|
|
|
|
__start:
|
|
bal 1f
|
|
// For some reason the disassembler considers everything
|
|
// after __start non-code until the next label. So I add a label.
|
|
start_hack_for_disassembler:
|
|
nop
|
|
.word _gp
|
|
1: lw $gp, 0($ra)
|
|
|
|
// Flush cache.
|
|
mtc0 $zero, $CP0_TAG_LO
|
|
lui $v1, 0x8000
|
|
ori $v0, $v1, 0x8000
|
|
1:
|
|
// i-cache index invalidate.
|
|
cache 0, 0($v1)
|
|
// d-cache store tag. TagLo has the valid bit cleared, so this clears the d-cache.
|
|
cache 9, 0($v1)
|
|
bne $v1, $v0, 1b
|
|
addiu $v1, $v1, 32
|
|
|
|
// Set kseg0 cachable.
|
|
li $k0, 0x3
|
|
mtc0 $k0, $CP0_CONFIG, 0
|
|
|
|
la $sp, kernel_stack + KERNEL_STACK_SIZE
|
|
|
|
// Clear .bss
|
|
la $a0, _edata
|
|
la $a1, _end
|
|
1: sw $zero, 0($a0)
|
|
bne $a1, $a0, 1b
|
|
addiu $a0, 4
|
|
|
|
// First argument is the memory size.
|
|
la $t9, init
|
|
jr $t9
|
|
li $a0, MEMORY_SIZE
|