1/* $NetBSD: pmppc_locore.S,v 1.9 2011/01/17 08:23:55 matt Exp $ */ 2/* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */ 3 4/* 5 * Copyright (C) 1995, 1996 Wolfgang Solfrank. 6 * Copyright (C) 1995, 1996 TooLs GmbH. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed by TooLs GmbH. 20 * 4. The name of TooLs GmbH may not be used to endorse or promote products 21 * derived from this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 29 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 31 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 */ 34 35#include "opt_ddb.h" 36#include "opt_kgdb.h" 37#include "opt_ipkdb.h" 38#include "opt_multiprocessor.h" 39#include "opt_openpic.h" 40#include "opt_ppcparam.h" 41#include "assym.h" 42 43#include <sys/syscall.h> 44 45#include <machine/param.h> 46#include <machine/vmparam.h> 47#include <machine/pmap.h> 48#include <machine/psl.h> 49#include <machine/trap.h> 50#include <machine/asm.h> 51 52#include <powerpc/spr.h> 53#include <powerpc/oea/spr.h> 54#include <powerpc/oea/hid.h> 55 56#include "ksyms.h" 57 58/* 59 * Some instructions gas doesn't understand (yet?) 60 */ 61#define bdneq bdnzf 2, 62 63/* 64 * Globals 65 */ 66GLOBAL(startsym) 67 .long 0 /* start symbol table */ 68GLOBAL(endsym) 69 .long 0 /* end symbol table */ 70GLOBAL(oeacpufeat) 71 .long 0 /* cpu features */ 72/* 73 * This symbol is here for the benefit of kvm_mkdb, and is supposed to 74 * mark the start of kernel text. 75 */ 76 .text 77 .globl _C_LABEL(kernel_text) 78_C_LABEL(kernel_text): 79 80/* 81 * Startup entry. Note, this must be the first thing in the text 82 * segment! 83 */ 84 .text 85 .globl __start 86__start: 87 li 0,0 88 mtmsr 0 /* Disable FPU/MMU/exceptions */ 89 isync 90 91 /* Enable data and instruction caches */ 92/* 93 mfspr 8,1008 94 ori 8, 8, (HID0_ICE | HID0_DCE)@l 95 mtspr 1008,8 96*/ 97 98/* compute end of kernel memory */ 99 lis 4,_C_LABEL(end)@ha 100 addi 4,4,_C_LABEL(end)@l 101 102 INIT_CPUINFO(4,1,9,5) 103 104 lis 3,__start@ha 105 addi 3,3,__start@l 106 107 xor 5,5,5 108 xor 6,6,6 109 bl _C_LABEL(initppc) 110 111 sync 112 isync 113 mfspr 8,SPR_HID0 114 ori 8, 8, (HID0_ICE | HID0_DCE)@l 115 isync 116 mtspr SPR_HID0,8 117 sync 118 isync 119 120 bl _C_LABEL(main) 121 122loop: b loop /* XXX not reached */ 123 124 .globl _C_LABEL(enable_intr) 125_C_LABEL(enable_intr): 126 mfmsr 3 127 ori 3,3,PSL_EE@l 128 mtmsr 3 129 blr 130 131 .globl _C_LABEL(disable_intr) 132_C_LABEL(disable_intr): 133 mfmsr 3 134 andi. 3,3,~PSL_EE@l 135 mtmsr 3 136 blr 137 138/* 139 * Include common switch / setfault code 140 */ 141#include <powerpc/powerpc/locore_subr.S> 142 143/* 144 * Include common trap / exception code 145 */ 146#include <powerpc/powerpc/trap_subr.S> 147 148/* 149 * Include PIO routines 150 */ 151#include <powerpc/powerpc/pio_subr.S> 152