File indexing completed on 2025-05-11 08:24:09
0001 #
0002 # Copyright (c) 2006 Martin Decky
0003 # Copyright (c) 2006 Jakub Jermar
0004 # All rights reserved.
0005 #
0006 # Redistribution and use in source and binary forms, with or without
0007 # modification, are permitted provided that the following conditions
0008 # are met:
0009 #
0010 # - Redistributions of source code must retain the above copyright
0011 # notice, this list of conditions and the following disclaimer.
0012 # - Redistributions in binary form must reproduce the above copyright
0013 # notice, this list of conditions and the following disclaimer in the
0014 # documentation and/or other materials provided with the distribution.
0015 # - The name of the author may not be used to endorse or promote products
0016 # derived from this software without specific prior written permission.
0017 #
0018 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
0019 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0020 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0021 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0022 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0023 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0024 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0025 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0026 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0027 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0028 #
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #include <rtems/asm.h>
0045 #include <rtems/score/cpu.h>
0046
0047 #define PSTATE_PRIV_BIT 4
0048
0049 .register %g2, #scratch
0050 .register %g3, #scratch
0051 .register %g6, #scratch
0052 .register %g7, #scratch
0053
0054 .section BOOTSTRAP, "ax"
0055
0056 PUBLIC(_start)
0057 .global _start
0058 SYM(_start):
0059 start:
0060 b 1f
0061 nop
0062
0063
0064
0065
0066
0067 .ascii "HdrS"
0068 .word 0
0069 .half 0
0070 .half 0
0071 .half 0
0072 .half 0
0073 .global silo_ramdisk_image
0074 silo_ramdisk_image:
0075 .word 0
0076 .global silo_ramdisk_size
0077 silo_ramdisk_size:
0078 .word 0
0079
0080 .align 8
0081 1:
0082
0083
0084
0085 wrpr %g0, PSTATE_PRIV_BIT, %pstate
0086
0087 wrpr %g0, SPARC_NUMBER_OF_REGISTER_WINDOWS - 2, %cansave ! set maximum saveable windows
0088 wrpr %g0, 0, %canrestore ! get rid of windows we will never need again
0089 wrpr %g0, 0, %otherwin ! make sure the window state is consistent
0090 wrpr %g0, SPARC_NUMBER_OF_REGISTER_WINDOWS - 1, %cleanwin ! prevent needless clean_window traps for kernel
0091
0092
0093 mov %g0, %g4
0094
0095
0096 setx SYM(bss_start), %l0, %g2 ! g2 = start of bss
0097 setx SYM(_end), %l0, %g3 ! g3 = end of bss
0098 zerobss:
0099 stx %g0, [%g2]
0100 add %g2, 8, %g2
0101 cmp %g2, %g3
0102 bleu,a zerobss
0103 nop
0104
0105
0106 set SYM(_ISR_Stack_area_end), %sp
0107 add %sp, -SPARC64_MINIMUM_STACK_FRAME_SIZE, %sp
0108 add %sp, -STACK_BIAS, %sp
0109
0110
0111 call SYM(_BSP_init)
0112 nop
0113
0114 setx ofw_cif, %l0, %l1
0115
0116 call ofw_init ! initialize OpenFirmware
0117 stx %o4, [%l1]
0118
0119 call bootstrap
0120 nop
0121
0122
0123
0124 setx SYM(syscall), %l0, %o1
0125 setx param_space, %l0, %o2
0126 call SYM(_CPU_ISR_install_raw_handler)
0127 mov 0x100, %o0
0128
0129
0130
0131 mov %g0, %o0 ! clear command line passed to main
0132 call SYM(boot_card)
0133 sub %sp, 0x60, %sp ! make room on stack (necessary?)
0134
0135 call SYM(halt)
0136 nop
0137
0138 halted: nop
0139 b SYM(halted)
0140
0141 .section BOOTSTRAP
0142 .align CPU_ALIGNMENT
0143 param_space:
0144 .space 8