// Iris: micro-kernel for a capability-based operating system. // mips/boot.S: Kernel entry point, called by the boot loader. // Copyright 2009 Bas Wijnen // // 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 . #define ASM #define ARCH #include "arch.hh" #define MEMORY_SIZE (32 << 20) #define KERNEL_STACK_SIZE 0x1000 // 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