1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2024-11-16 18:37:10 +02:00
iris/mips/boot.S

68 lines
1.8 KiB
ArmAsm
Raw Normal View History

2009-06-01 15:26:42 +03:00
// Iris: micro-kernel for a capability-based operating system.
// mips/boot.S: Kernel entry point, called by the boot loader.
2009-06-01 15:26:42 +03:00
// 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"
2012-09-26 20:03:36 +03:00
#define MEMORY_SIZE (32 << 20)
#define KERNEL_STACK_SIZE 0x1000
2009-06-01 15:26:42 +03:00
// 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:
2009-07-20 01:23:45 +03:00
nop
.word _gp
2009-06-01 15:26:42 +03:00
1: lw $gp, 0($ra)
2009-07-21 13:17:52 +03:00
// Flush cache.
2010-08-22 23:03:06 +03:00
mtc0 $zero, $CP0_TAG_LO
2009-07-21 13:17:52 +03:00
lui $v1, 0x8000
ori $v0, $v1, 0x8000
1:
2010-08-22 23:03:06 +03:00
// i-cache index invalidate.
2009-07-21 13:17:52 +03:00
cache 0, 0($v1)
2010-08-22 23:03:06 +03:00
// d-cache store tag. TagLo has the valid bit cleared, so this clears the d-cache.
cache 9, 0($v1)
2009-07-21 13:17:52 +03:00
bne $v1, $v0, 1b
addiu $v1, $v1, 32
2009-06-01 15:26:42 +03:00
// Set kseg0 cachable.
li $k0, 0x3
mtc0 $k0, $CP0_CONFIG, 0
2009-06-01 15:26:42 +03:00
2010-08-22 23:03:06 +03:00
la $sp, kernel_stack + KERNEL_STACK_SIZE
2009-06-01 15:26:42 +03:00
// Clear .bss
la $a0, _edata
la $a1, _end
1: sw $zero, 0($a0)
bne $a1, $a0, 1b
2010-08-22 23:03:06 +03:00
addiu $a0, 4
2009-06-01 15:26:42 +03:00
// First argument is the memory size.
2009-06-01 15:26:42 +03:00
la $t9, init
jr $t9
li $a0, MEMORY_SIZE