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:
111 /* Figure out where we are */
112 bl 1f
113 .long _DYNAMIC-.
114 .long _GLOBAL_OFFSET_TABLE_-.
115 .long tmpstk-.
1161: mflr %r30
117
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
136
137 lwz %r3,16(%r1)
138 lwz %r4,20(%r1)
139 lwz %r5,24(%r1)
140 lwz %r6,28(%r1)
141
142 /* MD setup */
143 bl powerpc_init
144
145 /* Set stack pointer to new value and branch to 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. */
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 ---
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 /* Figure out where we are */
112 bl 1f
113 .long _DYNAMIC-.
114 .long _GLOBAL_OFFSET_TABLE_-.
115 .long tmpstk-.
1161: mflr %r30
117
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
136
137 lwz %r3,16(%r1)
138 lwz %r4,20(%r1)
139 lwz %r5,24(%r1)
140 lwz %r6,28(%r1)
141
142 /* MD setup */
143 bl powerpc_init
144
145 /* Set stack pointer to new value and branch to 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. */
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 ---