source: mainline/boot/arch/sparc64/src/asm.S

Last change on this file was a35b458, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 7 years ago

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

  • Property mode set to 100644
File size: 4.1 KB
RevLine 
[b7b5f83]1#
[df4ed85]2# Copyright (c) 2006 Martin Decky
[4872160]3# Copyright (c) 2006 Jakub Jermar
[b7b5f83]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
[a52e2f4]30#include <abi/asmtool.h>
[4872160]31#include <arch/arch.h>
32
[1b34360]33#if defined(PROCESSOR_us) || defined(PROCESSOR_us3)
[4872160]34#define ICACHE_SIZE 8192
35#define ICACHE_LINE_SIZE 32
36#define ICACHE_SET_BIT (1 << 13)
37#define ASI_ICACHE_TAG 0x67
[1b34360]38#endif /* PROCESSOR_us || PROCESSOR_us3 */
[2e672fd]39
[e731b0d]40.register %g2, #scratch
41.register %g3, #scratch
[4872160]42.register %g6, #scratch
43.register %g7, #scratch
[da349da0]44
[4872160]45.section BOOTSTRAP, "ax"
46
[a52e2f4]47SYMBOL(start)
[4872160]48 ba %xcc, 1f
49 nop
50
51/*
52 * This header forces SILO to load the image at 0x4000.
53 * More precisely, SILO will think this is an old version of Linux.
54 */
55.ascii "HdrS"
56.word 0
57.half 0
58.half 0
59.half 0
60.half 0
61.word 0
62.word 0
63
64.align 8
651:
66 ! Disable interrupts and disable address masking.
[a35b458]67
[4872160]68 wrpr %g0, PSTATE_PRIV_BIT, %pstate
[a35b458]69
[4872160]70 wrpr %g0, NWINDOWS - 2, %cansave ! Set maximum saveable windows
71 wrpr %g0, 0, %canrestore ! Get rid of windows we will never need again
72 wrpr %g0, 0, %otherwin ! Make sure the window state is consistent
73 wrpr %g0, NWINDOWS - 1, %cleanwin ! Prevent needless clean_window traps for kernel
[a35b458]74
[4872160]75 set initial_stack, %sp
76 add %sp, -STACK_BIAS, %sp
[a35b458]77
[4872160]78 set ofw_cif, %l0
[a35b458]79
[4872160]80 ! Initialize OpenFirmware
[a35b458]81
[4872160]82 call ofw_init
83 stx %o4, [%l0]
[a35b458]84
[4872160]85 ba %xcc, bootstrap
86 nop
87
88.align STACK_ALIGNMENT
89 .space STACK_SIZE
90initial_stack:
91 .space STACK_WINDOW_SAVE_AREA_SIZE
92
93.text
94
[a52e2f4]95FUNCTION_BEGIN(halt)
[a1a83e5e]96 ba %xcc, halt
[b7b5f83]97 nop
[a52e2f4]98FUNCTION_END(halt)
[c82950a]99
[a52e2f4]100FUNCTION_BEGIN(jump_to_kernel)
[0af4f9e]101 /*
[4872160]102 * Guarantee cache coherence:
[1eb154f]103 * 1. Make sure that the code we have moved has drained to main memory.
104 * 2. Invalidate I-cache.
105 * 3. Flush instruction pipeline.
[965dc18]106 */
[a35b458]107
[965dc18]108 /*
109 * US3 processors have a write-invalidate cache, so explicitly
110 * invalidating it is not required. Whether to invalidate I-cache
[4872160]111 * or not is decided according to the value of the 3rd argument
112 * (subarch).
[965dc18]113 */
[b97b348]114 cmp %o2, SUBARCH_US3
[a1a83e5e]115 be %xcc, 1f
[965dc18]116 nop
[a35b458]117
[e731b0d]118 0:
119 call icache_flush
120 nop
[a35b458]121
[e731b0d]122 1:
123 membar #StoreStore
[a35b458]124
[965dc18]125 /*
126 * Flush the instruction pipeline.
127 */
[e731b0d]128 flush %i7
[a35b458]129
[4872160]130 ! Jump to kernel
[b97b348]131 jmp %o3
[94d614e]132 nop
[a52e2f4]133FUNCTION_END(jump_to_kernel)
[2e672fd]134
[1eb154f]135# Flush I-cache
136icache_flush:
[1b34360]137#if defined(PROCESSOR_us) || defined(PROCESSOR_us3)
[e731b0d]138 set ((ICACHE_SIZE - ICACHE_LINE_SIZE) | ICACHE_SET_BIT), %g1
139 stxa %g0, [%g1] ASI_ICACHE_TAG
[a35b458]140
[e731b0d]141 0:
142 membar #Sync
143 subcc %g1, ICACHE_LINE_SIZE, %g1
144 bnz,pt %xcc, 0b
[a35b458]145
[e731b0d]146 stxa %g0, [%g1] ASI_ICACHE_TAG
147 membar #Sync
[1eb154f]148 retl
[a35b458]149
[1eb154f]150 ! SF Erratum #51
[a35b458]151
[1eb154f]152 nop
[1b34360]153#else
154 // TODO: sun4v
155 retl
156 nop
157#endif /* PROCESSOR_us || PROCESSOR_us3 */
[e731b0d]158
[a52e2f4]159FUNCTION_BEGIN(ofw)
[b9c229b]160 save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
[2e672fd]161 set ofw_cif, %l0
162 ldx [%l0], %l0
[a35b458]163
[4872160]164 rdpr %pstate, %l1
165 and %l1, ~PSTATE_AM_BIT, %l2
166 wrpr %l2, 0, %pstate
[a35b458]167
[2e672fd]168 jmpl %l0, %o7
169 mov %i0, %o0
[a35b458]170
[2e672fd]171 wrpr %l1, 0, %pstate
[a35b458]172
[2e672fd]173 ret
174 restore %o0, 0, %o0
[a52e2f4]175FUNCTION_END(ofw)
Note: See TracBrowser for help on using the repository browser.