locore32.S (278495) | locore32.S (279750) |
---|---|
1/* $FreeBSD: head/sys/powerpc/aim/locore32.S 278495 2015-02-10 06:35:16Z rpaulo $ */ | 1/* $FreeBSD: head/sys/powerpc/aim/locore32.S 279750 2015-03-07 20:14:46Z nwhitehorn $ */ |
2/* $NetBSD: locore.S,v 1.24 2000/05/31 05:09:17 thorpej Exp $ */ 3 4/*- 5 * Copyright (C) 2001 Benno Rice 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 93 unchanged lines hidden (view full) --- 103 104/* 105 * Startup entry. Note, this must be the first thing in the text 106 * segment! 107 */ 108 .text 109 .globl __start 110__start: | 2/* $NetBSD: locore.S,v 1.24 2000/05/31 05:09:17 thorpej Exp $ */ 3 4/*- 5 * Copyright (C) 2001 Benno Rice 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 93 unchanged lines hidden (view full) --- 103 104/* 105 * Startup entry. Note, this must be the first thing in the text 106 * segment! 107 */ 108 .text 109 .globl __start 110__start: |
111 li 8,0 112 li 9,0x100 113 mtctr 9 1141: 115 dcbf 0,8 116 icbi 0,8 117 addi 8,8,0x20 118 bdnz 1b 119 sync 120 isync | 111 /* Figure out where we are */ 112 bl 1f 113 .long _DYNAMIC-. 114 .long _GLOBAL_OFFSET_TABLE_-. 115 .long tmpstk-. 1161: mflr %r30 |
121 | 117 |
122 /* Zero bss, in case we were started by something unhelpful */ 123 li 0,0 124 lis 8,_edata@ha 125 addi 8,8,_edata@l 126 lis 9,_end@ha 127 addi 9,9,_end@l 1282: stw 0,0(8) 129 addi 8,8,4 130 cmplw 8,9 131 blt 2b | 118 /* Set up temporary stack pointer */ 119 lwz %r1,8(%r30) 120 add %r1,%r1,%r30 121 addi %r1,%r1,(8+TMPSTKSZ-32) 122 123 /* Relocate self */ 124 stw %r3,16(%r1) 125 stw %r4,20(%r1) 126 stw %r5,24(%r1) 127 stw %r6,28(%r1) 128 129 lwz %r3,0(%r30) /* _DYNAMIC in %r3 */ 130 add %r3,%r3,%r30 131 lwz %r4,4(%r30) /* GOT pointer */ 132 add %r4,%r4,%r30 133 lwz %r4,4(%r4) /* got[0] is _DYNAMIC link addr */ 134 subf %r4,%r4,%r3 /* subtract to calculate relocbase */ 135 bl elf_reloc_self |
132 | 136 |
133 lis 1,(tmpstk+TMPSTKSZ-16)@ha 134 addi 1,1,(tmpstk+TMPSTKSZ-16)@l | 137 lwz %r3,16(%r1) 138 lwz %r4,20(%r1) 139 lwz %r5,24(%r1) 140 lwz %r6,28(%r1) |
135 | 141 |
142 /* MD setup */ |
|
136 bl powerpc_init | 143 bl powerpc_init |
144 145 /* Set stack pointer to new value and branch to mi_startup */ |
|
137 mr %r1, %r3 138 li %r3, 0 139 stw %r3, 0(%r1) 140 bl mi_startup | 146 mr %r1, %r3 147 li %r3, 0 148 stw %r3, 0(%r1) 149 bl mi_startup |
150 151 /* If mi_startup somehow returns, exit. This would be bad. */ |
|
141 b OF_exit 142 143/* 144 * int setfault() 145 * 146 * Similar to setjmp to setup for handling faults on accesses to user memory. 147 * Any routine using this may only call bcopy, either the form below, 148 * or the (currently used) C code optimized, so it doesn't use any non-volatile --- 17 unchanged lines hidden --- | 152 b OF_exit 153 154/* 155 * int setfault() 156 * 157 * Similar to setjmp to setup for handling faults on accesses to user memory. 158 * Any routine using this may only call bcopy, either the form below, 159 * or the (currently used) C code optimized, so it doesn't use any non-volatile --- 17 unchanged lines hidden --- |