The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/mips/mips/locore.S

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $OpenBSD: locore.S,v 1.18 1998/09/15 10:58:53 pefo Exp $        */
    2 /*-
    3  * Copyright (c) 1992, 1993
    4  *      The Regents of the University of California.  All rights reserved.
    5  *
    6  * This code is derived from software contributed to Berkeley by
    7  * Digital Equipment Corporation and Ralph Campbell.
    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. Neither the name of the University nor the names of its contributors
   18  *    may be used to endorse or promote products derived from this software
   19  *    without specific prior written permission.
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31  * SUCH DAMAGE.
   32  *
   33  * Copyright (C) 1989 Digital Equipment Corporation.
   34  * Permission to use, copy, modify, and distribute this software and
   35  * its documentation for any purpose and without fee is hereby granted,
   36  * provided that the above copyright notice appears in all copies.
   37  * Digital Equipment Corporation makes no representations about the
   38  * suitability of this software for any purpose.  It is provided "as is"
   39  * without express or implied warranty.
   40  *
   41  * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/loMem.s,
   42  *      v 1.1 89/07/11 17:55:04 nelson Exp  SPRITE (DECWRL)
   43  * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsm.s,
   44  *      v 9.2 90/01/29 18:00:39 shirriff Exp  SPRITE (DECWRL)
   45  * from: Header: /sprite/src/kernel/vm/ds3100.md/vmPmaxAsm.s,
   46  *      v 1.1 89/07/10 14:27:41 nelson Exp  SPRITE (DECWRL)
   47  *
   48  *      from: @(#)locore.s      8.5 (Berkeley) 1/4/94
   49  *      JNPR: locore.S,v 1.6.2.1 2007/08/29 12:24:49 girish
   50  * $FreeBSD$
   51  */
   52 
   53 /*
   54  * FREEBSD_DEVELOPERS_FIXME
   55  * The start routine below was written for a multi-core CPU
   56  * with each core being hyperthreaded. This serves as an example
   57  * for a complex CPU architecture. For a different CPU complex
   58  * please make necessary changes to read CPU-ID etc.
   59  * A clean solution would be to have a different locore file for
   60  * each CPU type.
   61  */
   62 
   63 /*
   64  *      Contains code that is the first executed at boot time plus
   65  *      assembly language support routines.
   66  */
   67 
   68 #include <machine/asm.h>
   69 #include <machine/cpu.h>
   70 #include <machine/cpuregs.h>
   71 #include <machine/regnum.h>
   72 
   73 #include "assym.inc"
   74 
   75         .data
   76 #ifdef YAMON
   77 GLOBAL(fenvp)
   78         .space 4                        # Assumes mips32?  Is that OK?
   79 #endif
   80 
   81         .set noreorder
   82 
   83         .text
   84 
   85 GLOBAL(btext)
   86 ASM_ENTRY(_start)
   87 VECTOR(_locore, unknown)
   88         /* UNSAFE TO USE a0..a3, need to preserve the args from boot loader */
   89         mtc0    zero, MIPS_COP_0_CAUSE  # Clear soft interrupts
   90         
   91 #if defined(CPU_CNMIPS)
   92         /*
   93          * t1: Bits to set explicitly:
   94          *      Enable FPU
   95          */
   96 
   97         /* Set these bits */
   98         li      t1, (MIPS_SR_COP_0_BIT | MIPS_SR_PX | MIPS_SR_KX | MIPS_SR_UX | MIPS_SR_SX | MIPS_SR_BEV)
   99 
  100         /* Reset these bits */
  101         li      t0, ~(MIPS_SR_DE | MIPS_SR_SR | MIPS_SR_ERL | MIPS_SR_EXL | MIPS_SR_INT_IE | MIPS_SR_COP_2_BIT)
  102 #elif defined (CPU_RMI) || defined (CPU_NLM) 
  103         /* Set these bits */
  104         li      t1, (MIPS_SR_COP_2_BIT | MIPS_SR_COP_0_BIT | MIPS_SR_KX | MIPS_SR_UX)
  105 
  106         /* Reset these bits */
  107         li      t0, ~(MIPS_SR_BEV | MIPS_SR_SR | MIPS_SR_INT_IE)
  108 #else
  109         /*
  110          * t0: Bits to preserve if set:
  111          *      Soft reset
  112          *      Boot exception vectors (firmware-provided)
  113          */
  114         li      t0, (MIPS_SR_BEV | MIPS_SR_SR)
  115         /*
  116          * t1: Bits to set explicitly:
  117          *      Enable FPU
  118          */
  119         li      t1, MIPS_SR_COP_1_BIT
  120 #if defined(__mips_n32) || defined(__mips_n64)
  121         or      t1, MIPS_SR_FR
  122 #endif
  123 #ifdef __mips_n64
  124         or      t1, MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX
  125 #endif
  126 #endif
  127         /*
  128          * Read coprocessor 0 status register, clear bits not
  129          * preserved (namely, clearing interrupt bits), and set
  130          * bits we want to explicitly set.
  131          */
  132         mfc0    t2, MIPS_COP_0_STATUS
  133         and     t2, t0
  134         or      t2, t1
  135         mtc0    t2, MIPS_COP_0_STATUS
  136         COP0_SYNC
  137 
  138         /* Make sure KSEG0 is cached */
  139         li      t0, MIPS_CCA_CACHED
  140         mtc0    t0, MIPS_COP_0_CONFIG
  141         COP0_SYNC
  142 
  143         /*xxximp
  144          * now that we pass a0...a3 to the platform_init routine, do we need
  145          * to stash this stuff here?
  146          */
  147 #ifdef YAMON
  148         /* Save YAMON boot environment pointer */
  149         sw      a2, _C_LABEL(fenvp)
  150 #endif
  151 
  152 #if defined(CPU_CNMIPS) && defined(SMP)
  153         .set push
  154         .set mips32r2
  155         rdhwr   t2, $0
  156         beqz    t2, 1f
  157         nop
  158         j       octeon_ap_wait
  159         nop
  160         .set pop
  161 1:
  162 #endif
  163 
  164 #if defined(CPU_MALTA) && defined(SMP)
  165         .set push
  166         .set mips32r2
  167         jal     malta_cpu_configure
  168         nop
  169         jal     platform_processor_id
  170         nop
  171         beqz    v0, 1f
  172         nop
  173         j       malta_ap_wait
  174         nop
  175         .set pop
  176 1:
  177 #endif
  178 
  179         /*
  180          * Initialize stack and call machine startup.
  181          */
  182         PTR_LA          sp, _C_LABEL(pcpu_space)
  183         PTR_ADDU        sp, (PAGE_SIZE * 2) - CALLFRAME_SIZ
  184 
  185         REG_S   zero, CALLFRAME_RA(sp)  # Zero out old ra for debugger
  186         REG_S   zero, CALLFRAME_SP(sp)  # Zero out old fp for debugger
  187 
  188         PTR_LA  gp, _C_LABEL(_gp)
  189 
  190         /* Call the platform-specific startup code. */
  191         jal     _C_LABEL(platform_start)
  192         nop
  193 
  194         PTR_LA  sp, _C_LABEL(thread0_st)
  195         PTR_L   a0, TD_PCB(sp)
  196         REG_LI  t0, ~7
  197         and     a0, a0, t0
  198         PTR_SUBU        sp, a0, CALLFRAME_SIZ
  199 
  200         jal     _C_LABEL(mi_startup)            # mi_startup(frame)
  201         sw      zero, CALLFRAME_SIZ - 8(sp)     # Zero out old fp for debugger
  202 
  203         PANIC("Startup failed!")
  204 
  205 VECTOR_END(_locore)

Cache object: 24e4d68c080f6260ebe9d2faaf6b4886


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.