Home | History | Annotate | Line # | Download | only in common
start.S revision 1.1.1.1.6.2
      1  1.1.1.1.6.2  jdolecek /* $NetBSD: start.S,v 1.1.1.1.6.2 2017/12/03 11:36:11 jdolecek Exp $ */
      2  1.1.1.1.6.2  jdolecek 
      3  1.1.1.1.6.2  jdolecek /*
      4  1.1.1.1.6.2  jdolecek  * Copyright 2000, 2001
      5  1.1.1.1.6.2  jdolecek  * Broadcom Corporation. All rights reserved.
      6  1.1.1.1.6.2  jdolecek  *
      7  1.1.1.1.6.2  jdolecek  * This software is furnished under license and may be used and copied only
      8  1.1.1.1.6.2  jdolecek  * in accordance with the following terms and conditions.  Subject to these
      9  1.1.1.1.6.2  jdolecek  * conditions, you may download, copy, install, use, modify and distribute
     10  1.1.1.1.6.2  jdolecek  * modified or unmodified copies of this software in source and/or binary
     11  1.1.1.1.6.2  jdolecek  * form. No title or ownership is transferred hereby.
     12  1.1.1.1.6.2  jdolecek  *
     13  1.1.1.1.6.2  jdolecek  * 1) Any source code used, modified or distributed must reproduce and
     14  1.1.1.1.6.2  jdolecek  *    retain this copyright notice and list of conditions as they appear in
     15  1.1.1.1.6.2  jdolecek  *    the source file.
     16  1.1.1.1.6.2  jdolecek  *
     17  1.1.1.1.6.2  jdolecek  * 2) No right is granted to use any trade name, trademark, or logo of
     18  1.1.1.1.6.2  jdolecek  *    Broadcom Corporation.  The "Broadcom Corporation" name may not be
     19  1.1.1.1.6.2  jdolecek  *    used to endorse or promote products derived from this software
     20  1.1.1.1.6.2  jdolecek  *    without the prior written permission of Broadcom Corporation.
     21  1.1.1.1.6.2  jdolecek  *
     22  1.1.1.1.6.2  jdolecek  * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED
     23  1.1.1.1.6.2  jdolecek  *    WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
     24  1.1.1.1.6.2  jdolecek  *    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
     25  1.1.1.1.6.2  jdolecek  *    NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE
     26  1.1.1.1.6.2  jdolecek  *    FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE
     27  1.1.1.1.6.2  jdolecek  *    LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     28  1.1.1.1.6.2  jdolecek  *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     29  1.1.1.1.6.2  jdolecek  *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     30  1.1.1.1.6.2  jdolecek  *    BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     31  1.1.1.1.6.2  jdolecek  *    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     32  1.1.1.1.6.2  jdolecek  *    OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     33  1.1.1.1.6.2  jdolecek  */
     34  1.1.1.1.6.2  jdolecek 
     35  1.1.1.1.6.2  jdolecek #define STACK_SIZE 8192
     36  1.1.1.1.6.2  jdolecek 
     37  1.1.1.1.6.2  jdolecek #include "include/asm.h"
     38  1.1.1.1.6.2  jdolecek 
     39  1.1.1.1.6.2  jdolecek 
     40  1.1.1.1.6.2  jdolecek 	  .bss
     41  1.1.1.1.6.2  jdolecek 
     42  1.1.1.1.6.2  jdolecek 	  .comm stack_bottom,STACK_SIZE
     43  1.1.1.1.6.2  jdolecek 
     44  1.1.1.1.6.2  jdolecek 	.text
     45  1.1.1.1.6.2  jdolecek 
     46  1.1.1.1.6.2  jdolecek LEAF(start)
     47  1.1.1.1.6.2  jdolecek 
     48  1.1.1.1.6.2  jdolecek 	la	gp,_gp
     49  1.1.1.1.6.2  jdolecek 
     50  1.1.1.1.6.2  jdolecek 	la	sp,stack_bottom+STACK_SIZE-32
     51  1.1.1.1.6.2  jdolecek 
     52  1.1.1.1.6.2  jdolecek /*
     53  1.1.1.1.6.2  jdolecek  * On entry: a0 = the firmware handle, a2 = firmware's
     54  1.1.1.1.6.2  jdolecek  * for secondary bootstraps, a1 is the booted device handle
     55  1.1.1.1.6.2  jdolecek  * Don't trash a0..a3 until main is called!
     56  1.1.1.1.6.2  jdolecek  */
     57  1.1.1.1.6.2  jdolecek 
     58  1.1.1.1.6.2  jdolecek 
     59  1.1.1.1.6.2  jdolecek #if defined(STANDALONE_PROGRAM)
     60  1.1.1.1.6.2  jdolecek 	/*
     61  1.1.1.1.6.2  jdolecek 	 * This should not be used anywhere.
     62  1.1.1.1.6.2  jdolecek 	 */
     63  1.1.1.1.6.2  jdolecek 
     64  1.1.1.1.6.2  jdolecek #error "don't do this."
     65  1.1.1.1.6.2  jdolecek 
     66  1.1.1.1.6.2  jdolecek #else /* defined(STANDALONE_PROGRAM) */
     67  1.1.1.1.6.2  jdolecek 
     68  1.1.1.1.6.2  jdolecek #if !defined(PRIMARY_BOOTBLOCK) && !defined(UNIFIED_BOOTBLOCK)
     69  1.1.1.1.6.2  jdolecek 
     70  1.1.1.1.6.2  jdolecek         la      sp,start
     71  1.1.1.1.6.2  jdolecek 
     72  1.1.1.1.6.2  jdolecek #endif /* !defined(PRIMARY_BOOTBLOCK) && !defined(UNIFIED_BOOTBLOCK) */
     73  1.1.1.1.6.2  jdolecek 
     74  1.1.1.1.6.2  jdolecek #endif /* defined(STANDALONE_PROGRAM) */
     75  1.1.1.1.6.2  jdolecek 
     76  1.1.1.1.6.2  jdolecek /*
     77  1.1.1.1.6.2  jdolecek  * Zero BSS
     78  1.1.1.1.6.2  jdolecek  */
     79  1.1.1.1.6.2  jdolecek 
     80  1.1.1.1.6.2  jdolecek 	la	t0,_edata		/* t0 = address */
     81  1.1.1.1.6.2  jdolecek 	la	t1,_end
     82  1.1.1.1.6.2  jdolecek 
     83  1.1.1.1.6.2  jdolecek 1:	sw	zero,0(t0)
     84  1.1.1.1.6.2  jdolecek 	sw	zero,4(t0)
     85  1.1.1.1.6.2  jdolecek 	sw	zero,8(t0)
     86  1.1.1.1.6.2  jdolecek 	sw	zero,16(t0)
     87  1.1.1.1.6.2  jdolecek 	add	t0,16
     88  1.1.1.1.6.2  jdolecek 	ble	t0,t1,1b
     89  1.1.1.1.6.2  jdolecek 
     90  1.1.1.1.6.2  jdolecek 
     91  1.1.1.1.6.2  jdolecek /*
     92  1.1.1.1.6.2  jdolecek  * Run the main program.
     93  1.1.1.1.6.2  jdolecek  */
     94  1.1.1.1.6.2  jdolecek 
     95  1.1.1.1.6.2  jdolecek 	jal     main			/* transfer to C */
     96  1.1.1.1.6.2  jdolecek 
     97  1.1.1.1.6.2  jdolecek XLEAF(halt)
     98  1.1.1.1.6.2  jdolecek 	li	t0,0xBFC00000		/* transfer back to firmware */
     99  1.1.1.1.6.2  jdolecek 	j	t0
    100  1.1.1.1.6.2  jdolecek END(start)
    101  1.1.1.1.6.2  jdolecek 
    102  1.1.1.1.6.2  jdolecek 
    103  1.1.1.1.6.2  jdolecek 
    104  1.1.1.1.6.2  jdolecek LEAF(__main)
    105  1.1.1.1.6.2  jdolecek 	j	ra
    106  1.1.1.1.6.2  jdolecek END(__main)
    107  1.1.1.1.6.2  jdolecek 
    108  1.1.1.1.6.2  jdolecek LEAF(_rtt)
    109  1.1.1.1.6.2  jdolecek 	li	t0,0xBFC00000
    110  1.1.1.1.6.2  jdolecek 	j	t0
    111  1.1.1.1.6.2  jdolecek END(_rtt)
    112