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