source: rtems/c/src/lib/libbsp/sparc64/shared/start/start.S @ b7d3a2ca

4.115
Last change on this file since b7d3a2ca was 566a1806, checked in by Joel Sherrill <joel.sherrill@…>, on 06/17/10 at 16:20:46

2010-06-17 Joel Sherrill <joel.sherrill@…>

  • ChangeLog?, Makefile.am, acinclude.m4, configure.ac, shared/asm/asm.S, shared/clock/ckinit.c, shared/console/conscfg.c, shared/helenos/LICENSE, shared/helenos/README, shared/helenos/boot/genarch/balloc.c, shared/helenos/boot/genarch/ofw.c, shared/helenos/boot/genarch/ofw_tree.c, shared/helenos/boot/generic/string.c, shared/helenos/boot/include/align.h, shared/helenos/boot/include/balloc.h, shared/helenos/boot/include/gentypes.h, shared/helenos/boot/include/main.h, shared/helenos/boot/include/ofw.h, shared/helenos/boot/include/ofw_tree.h, shared/helenos/boot/include/ofwarch.h, shared/helenos/boot/include/register.h, shared/helenos/boot/include/stack.h, shared/helenos/boot/include/types.h, shared/helenos/boot/sparc64/loader/main.c, shared/helenos/boot/sparc64/loader/ofwarch.c, shared/helenos/boot/sparc64/loader/ofwasm.S, shared/helenos/kernel/genarch/include/ofw/ofw_tree.h, shared/helenos/kernel/generic/include/align.h, shared/helenos/kernel/sparc64/include/arch.h, shared/helenos/kernel/sparc64/include/boot.h, shared/helenos/kernel/sparc64/include/regdef.h, shared/helenos/kernel/sparc64/include/stack.h, shared/helenos/kernel/sparc64/include/mm/cache_spec.h, shared/helenos/kernel/sparc64/include/mm/frame.h, shared/helenos/kernel/sparc64/include/mm/mmu.h, shared/helenos/kernel/sparc64/include/mm/page.h, shared/helenos/kernel/sparc64/include/mm/tlb.h, shared/helenos/kernel/sparc64/include/mm/tte.h, shared/helenos/kernel/sparc64/include/mm/sun4u/frame.h, shared/helenos/kernel/sparc64/include/mm/sun4u/mmu.h, shared/helenos/kernel/sparc64/include/mm/sun4u/page.h, shared/helenos/kernel/sparc64/include/mm/sun4u/tlb.h, shared/helenos/kernel/sparc64/include/mm/sun4u/tte.h, shared/helenos/kernel/sparc64/include/sun4u/arch.h, shared/helenos/kernel/sparc64/src/cache.S, shared/helenos/kernel/sparc64/src/sun4u/takemmu.S, shared/include/asm.h, shared/include/traptable.h, shared/start/start.S, shared/start/trap_table.S, shared/startup/bspgetworkarea.c, shared/startup/bspstart.c, shared/startup/linkcmds, shared/startup/setvec.c: New files.
  • Property mode set to 100644
File size: 4.3 KB
Line 
1#
2# Copyright (c) 2006 Martin Decky
3# Copyright (c) 2006 Jakub Jermar
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9#
10# - Redistributions of source code must retain the above copyright
11#   notice, this list of conditions and the following disclaimer.
12# - Redistributions in binary form must reproduce the above copyright
13#   notice, this list of conditions and the following disclaimer in the
14#   documentation and/or other materials provided with the distribution.
15# - The name of the author may not be used to endorse or promote products
16#   derived from this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29
30/*
31 * start.S
32 *
33 * Start code for Sparc64 RTEMS
34 *
35 * This is based on the boot.S file of the HelenOS sparc64 architecture.
36 * http://www.helenos.org/
37 * ${helenos}/boot/arch/sparc64/loader/boot.S
38 *
39 * Modifications for the RTEMS executive are
40 *   COPYRIGHT (c) 2010 Gedare Bloom.
41 *   COPYRIGHT (c) 2010 Eugen Leontie.
42 *
43 * $Id$
44 */
45
46#include <rtems/asm.h>
47#include <rtems/score/cpu.h>
48
49#define PSTATE_PRIV_BIT 4
50
51.register %g2, #scratch
52.register %g3, #scratch
53.register %g6, #scratch
54.register %g7, #scratch
55
56#if 0
57#define _BSP_DEBUG
58#endif
59
60#if _BSP_DEBUG
61/*
62 * This is for debug and script support to identify RTEMS app termination
63 */
64.section        .data
65        .align 8
66_end_token_string:
67        .asciz "END_TOKEN\n"
68#endif
69
70.section BOOTSTRAP, "ax"
71
72PUBLIC(_start)
73  .global _start
74  SYM(_start):
75    start:
76    b 1f
77    nop
78
79    /*
80     * This header forces SILO to load the image at 0x4000.
81     * More precisely, SILO will think this is an old version of Linux.
82     */
83    .ascii "HdrS"
84    .word 0
85    .half 0
86    .half 0
87    .half 0
88    .half 0
89    .global silo_ramdisk_image
90    silo_ramdisk_image:
91    .word 0
92    .global silo_ramdisk_size
93    silo_ramdisk_size:
94    .word 0
95
96    .align 8
97    1: 
98    /*
99     * Disable interrupts and disable address masking.
100     */
101    wrpr %g0, PSTATE_PRIV_BIT, %pstate
102
103    wrpr %g0, SPARC_NUMBER_OF_REGISTER_WINDOWS - 2, %cansave    ! set maximum saveable windows
104    wrpr %g0, 0, %canrestore            ! get rid of windows we will never need again
105    wrpr %g0, 0, %otherwin                      ! make sure the window state is consistent
106    wrpr %g0, SPARC_NUMBER_OF_REGISTER_WINDOWS - 1, %cleanwin   ! prevent needless clean_window traps for kernel
107
108  /* g4 needs to be cleared for gcc */
109  mov %g0, %g4
110
111  /* Clear the bss */
112        setx    SYM(bss_start), %l0, %g2        ! g2 = start of bss
113        setx    SYM(_end), %l0, %g3                 ! g3 = end of bss
114zerobss:
115        stx     %g0, [%g2]
116        add     %g2, 8, %g2
117        cmp     %g2, %g3
118        bleu,a  zerobss
119        nop
120
121  /* Install stack */
122setstack:
123        set SYM(StackStart), %sp
124        add %sp, -STACK_BIAS, %sp
125
126        setx ofw_cif, %l0, %l1
127 
128        call ofw_init           ! initialize OpenFirmware
129        stx %o4, [%l1]
130
131  call bootstrap
132  nop
133
134  /* BSP-specific pre-bootcard initializations */
135  call SYM(_BSP_init)
136  nop
137
138  /* Set up ISR handler for interrupt enable/disable */
139        setx SYM(syscall), %l0, %o1
140        setx param_space, %l0, %o2
141        call SYM(_CPU_ISR_install_raw_handler)
142        mov 0x100, %o0
143
144  /* Don't need to copy initialized data to RAM--link puts all in RAM already */
145
146        mov     %g0, %o0                ! clear command line passed to main
147        call SYM(boot_card)
148        sub     %sp, 0x60, %sp          ! make room on stack (necessary?)
149
150#if _BSP_DEBUG
151  /* execution returns here when RTEMS terminates */
152        sethi %hi(_end_token_string), %g1
153        add %g1, %lo(_end_token_string), %o0
154        call SYM(printk)
155        nop
156#endif
157
158  call SYM(halt)
159  nop
160
161halted: nop
162            b SYM(halted)
163
164  .align CPU_ALIGNMENT
165  param_space:
166        .space 8
167
168    .global _fini
169    _fini:
170    nop
171    nop
172
173    .global _init
174    _init:
175    nop
176    nop
Note: See TracBrowser for help on using the repository browser.