Home | History | Annotate | Line # | Download | only in pmppc
pmppc_locore.S revision 1.1.6.1
      1 /*	$NetBSD: pmppc_locore.S,v 1.1.6.1 2007/11/02 13:34:38 joerg 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 "fs_kernfs.h"
     38 #include "opt_ipkdb.h"
     39 #include "opt_multiprocessor.h"
     40 #include "opt_openpic.h"
     41 #include "opt_ppcparam.h"
     42 #include "assym.h"
     43 
     44 #include <sys/syscall.h>
     45 
     46 #include <machine/param.h>
     47 #include <machine/vmparam.h>
     48 #include <machine/pmap.h>
     49 #include <machine/psl.h>
     50 #include <machine/trap.h>
     51 #define _NOREGNAMES
     52 #include <machine/asm.h>
     53 
     54 #include <powerpc/spr.h>
     55 #include <powerpc/oea/hid.h>
     56 
     57 #include "ksyms.h"
     58 
     59 /*
     60  * Some instructions gas doesn't understand (yet?)
     61  */
     62 #define	bdneq	bdnzf 2,
     63 
     64 /*
     65  * Globals
     66  */
     67 GLOBAL(startsym)
     68 	.long	0			/* start symbol table */
     69 GLOBAL(endsym)
     70 	.long	0			/* end symbol table */
     71 GLOBAL(proc0paddr)
     72 	.long	0			/* proc0 p_addr */
     73 
     74 /*
     75  * This symbol is here for the benefit of kvm_mkdb, and is supposed to
     76  * mark the start of kernel text.
     77  */
     78 	.text
     79 	.globl	_C_LABEL(kernel_text)
     80 _C_LABEL(kernel_text):
     81 
     82 /*
     83  * Startup entry.  Note, this must be the first thing in the text
     84  * segment!
     85  */
     86 	.text
     87 	.globl	__start
     88 __start:
     89 	li	0,0
     90 	mtmsr	0			/* Disable FPU/MMU/exceptions */
     91 	isync
     92 
     93 	/* Enable data and instruction caches */
     94 /*
     95 	mfspr	8,1008
     96 	ori	8, 8, (HID0_ICE | HID0_DCE)@l
     97 	mtspr	1008,8
     98 */
     99 
    100 /* compute end of kernel memory */
    101 	lis	4,_C_LABEL(end)@ha
    102 	addi	4,4,_C_LABEL(end)@l
    103 
    104 	INIT_CPUINFO(4,1,9,0)
    105 
    106 	lis	3,__start@ha
    107 	addi	3,3,__start@l
    108 
    109 	xor	5,5,5
    110 	xor	6,6,6
    111 	bl	_C_LABEL(initppc)
    112 
    113 	sync
    114 	isync
    115 	mfspr	8,SPR_HID0
    116 	ori	8, 8, (HID0_ICE | HID0_DCE)@l
    117 	isync
    118 	mtspr	SPR_HID0,8
    119 	sync
    120 	isync
    121 
    122 	bl	_C_LABEL(main)
    123 
    124 loop:	b	loop			/* XXX not reached */
    125 
    126 	.globl	_C_LABEL(enable_intr)
    127 _C_LABEL(enable_intr):
    128 	mfmsr	3
    129 	ori	3,3,PSL_EE@l
    130 	mtmsr	3
    131 	blr
    132 
    133 	.globl	_C_LABEL(disable_intr)
    134 _C_LABEL(disable_intr):
    135 	mfmsr	3
    136 	andi.	3,3,~PSL_EE@l
    137 	mtmsr	3
    138 	blr
    139 
    140 /*
    141  * Include common switch / setfault code
    142  */
    143 #include <powerpc/powerpc/locore_subr.S>
    144 
    145 /*
    146  * Include common trap / execption code
    147  */
    148 #include <powerpc/powerpc/trap_subr.S>
    149 
    150 /*
    151  * Include PIO routines
    152  */
    153 #include <powerpc/powerpc/pio_subr.S>
    154