Changeset 46c20c8 in mainline for boot/arch/sparc64/src/asm.S
- Timestamp:
- 2010-11-26T20:08:10Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 45df59a
- Parents:
- fb150d78 (diff), ffdd2b9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 moved
-
boot/arch/sparc64/src/asm.S (moved) (moved from boot/arch/sparc64/loader/asm.S ) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/sparc64/src/asm.S
rfb150d78 r46c20c8 1 1 # 2 2 # Copyright (c) 2006 Martin Decky 3 # Copyright (c) 2006 Jakub Jermar 3 # Copyright (c) 2006 Jakub Jermar 4 4 # All rights reserved. 5 5 # … … 28 28 # 29 29 30 #include <stack.h> 31 #include <register.h> 30 #include <arch/arch.h> 31 32 #define ICACHE_SIZE 8192 33 #define ICACHE_LINE_SIZE 32 34 #define ICACHE_SET_BIT (1 << 13) 35 #define ASI_ICACHE_TAG 0x67 32 36 33 37 .register %g2, #scratch 34 38 .register %g3, #scratch 39 .register %g6, #scratch 40 .register %g7, #scratch 41 42 .global start 43 .global halt 44 .global jump_to_kernel 45 46 .section BOOTSTRAP, "ax" 47 48 start: 49 ba %xcc, 1f 50 nop 51 52 /* 53 * This header forces SILO to load the image at 0x4000. 54 * More precisely, SILO will think this is an old version of Linux. 55 */ 56 .ascii "HdrS" 57 .word 0 58 .half 0 59 .half 0 60 .half 0 61 .half 0 62 .word 0 63 .word 0 64 65 .align 8 66 1: 67 ! Disable interrupts and disable address masking. 68 69 wrpr %g0, PSTATE_PRIV_BIT, %pstate 70 71 wrpr %g0, NWINDOWS - 2, %cansave ! Set maximum saveable windows 72 wrpr %g0, 0, %canrestore ! Get rid of windows we will never need again 73 wrpr %g0, 0, %otherwin ! Make sure the window state is consistent 74 wrpr %g0, NWINDOWS - 1, %cleanwin ! Prevent needless clean_window traps for kernel 75 76 set initial_stack, %sp 77 add %sp, -STACK_BIAS, %sp 78 79 set ofw_cif, %l0 80 81 ! Initialize OpenFirmware 82 83 call ofw_init 84 stx %o4, [%l0] 85 86 ba %xcc, bootstrap 87 nop 88 89 .align STACK_ALIGNMENT 90 .space STACK_SIZE 91 initial_stack: 92 .space STACK_WINDOW_SAVE_AREA_SIZE 35 93 36 94 .text 37 38 .global halt39 .global memcpy40 .global jump_to_kernel41 95 42 96 halt: … … 44 98 nop 45 99 46 memcpy:47 mov %o0, %o3 ! save dst48 add %o1, 7, %g149 and %g1, -8, %g150 cmp %o1, %g151 be,pn %xcc, 3f52 add %o0, 7, %g153 mov 0, %g354 55 0:56 brz,pn %o2, 2f57 mov 0, %g258 59 1:60 ldub [%g3 + %o1], %g161 add %g2, 1, %g262 cmp %o2, %g263 stb %g1, [%g3 + %o0]64 bne,pt %xcc, 1b65 mov %g2, %g366 67 2:68 jmp %o7 + 8 ! exit point69 mov %o3, %o070 71 3:72 and %g1, -8, %g173 cmp %o0, %g174 bne,pt %xcc, 0b75 mov 0, %g376 srlx %o2, 3, %g477 brz,pn %g4, 5f78 mov 0, %g579 80 4:81 sllx %g3, 3, %g282 add %g5, 1, %g383 ldx [%o1 + %g2], %g184 mov %g3, %g585 cmp %g4, %g386 bne,pt %xcc, 4b87 stx %g1, [%o0 + %g2]88 89 5:90 and %o2, 7, %o291 brz,pn %o2, 2b92 sllx %g4, 3, %g193 mov 0, %g294 add %g1, %o0, %o095 add %g1, %o1, %g496 mov 0, %g397 98 6:99 ldub [%g2 + %g4], %g1100 stb %g1, [%g2 + %o0]101 add %g3, 1, %g2102 cmp %o2, %g2103 bne,pt %xcc, 6b104 mov %g2, %g3105 106 jmp %o7 + 8 ! exit point107 mov %o3, %o0108 109 100 jump_to_kernel: 110 101 /* 111 * We have copied code and now we need to guarantee cache coherence.102 * Guarantee cache coherence: 112 103 * 1. Make sure that the code we have moved has drained to main memory. 113 104 * 2. Invalidate I-cache. … … 118 109 * US3 processors have a write-invalidate cache, so explicitly 119 110 * invalidating it is not required. Whether to invalidate I-cache 120 * or not is decided according to the value of the 5thargument121 * (subarch itecture).111 * or not is decided according to the value of the 3rd argument 112 * (subarch). 122 113 */ 123 cmp % i4,3114 cmp %o2, SUBARCH_US3 124 115 be %xcc, 1f 125 116 nop … … 137 128 flush %i7 138 129 139 mov %o0, %l1 140 mov %o1, %o0 141 mov %o2, %o1 142 mov %o3, %o2 143 jmp %l1 ! jump to kernel 130 ! Jump to kernel 131 jmp %o3 144 132 nop 145 146 #define ICACHE_SIZE 8192147 #define ICACHE_LINE_SIZE 32148 #define ICACHE_SET_BIT (1 << 13)149 #define ASI_ICACHE_TAG 0x67150 133 151 134 # Flush I-cache … … 162 145 membar #Sync 163 146 retl 147 164 148 ! SF Erratum #51 149 165 150 nop 166 151 … … 171 156 ldx [%l0], %l0 172 157 173 rdpr %pstate, %l1174 and %l1, ~PSTATE_AM_BIT, %l2175 wrpr %l2, 0, %pstate158 rdpr %pstate, %l1 159 and %l1, ~PSTATE_AM_BIT, %l2 160 wrpr %l2, 0, %pstate 176 161 177 162 jmpl %l0, %o7
Note:
See TracChangeset
for help on using the changeset viewer.
