diff options
Diffstat (limited to 'firmware/target/arm/pnx0101/crt0-pnx0101.S')
-rw-r--r-- | firmware/target/arm/pnx0101/crt0-pnx0101.S | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/firmware/target/arm/pnx0101/crt0-pnx0101.S b/firmware/target/arm/pnx0101/crt0-pnx0101.S index c8c4232a3a..f297c29d0c 100644 --- a/firmware/target/arm/pnx0101/crt0-pnx0101.S +++ b/firmware/target/arm/pnx0101/crt0-pnx0101.S | |||
@@ -115,16 +115,6 @@ start: | |||
115 | strhi r4, [r2], #4 | 115 | strhi r4, [r2], #4 |
116 | bhi 1b | 116 | bhi 1b |
117 | 117 | ||
118 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
119 | ldr sp, =stackend | ||
120 | mov r3, sp | ||
121 | ldr r2, =stackbegin | ||
122 | ldr r4, =0xdeadbeef | ||
123 | 1: | ||
124 | cmp r3, r2 | ||
125 | strhi r4, [r2], #4 | ||
126 | bhi 1b | ||
127 | |||
128 | /* Set up stack for IRQ mode */ | 118 | /* Set up stack for IRQ mode */ |
129 | msr cpsr_c, #0xd2 | 119 | msr cpsr_c, #0xd2 |
130 | ldr sp, =irq_stack | 120 | ldr sp, =irq_stack |
@@ -132,14 +122,27 @@ start: | |||
132 | msr cpsr_c, #0xd1 | 122 | msr cpsr_c, #0xd1 |
133 | ldr sp, =fiq_stack | 123 | ldr sp, =fiq_stack |
134 | 124 | ||
135 | /* Let abort and undefined modes use IRQ stack */ | 125 | /* Let svc, abort and undefined modes use irq stack */ |
126 | msr cpsr_c, #0xd3 | ||
127 | ldr sp =irq_stack | ||
136 | msr cpsr_c, #0xd7 | 128 | msr cpsr_c, #0xd7 |
137 | ldr sp, =irq_stack | 129 | ldr sp, =irq_stack |
138 | msr cpsr_c, #0xdb | 130 | msr cpsr_c, #0xdb |
139 | ldr sp, =irq_stack | 131 | ldr sp, =irq_stack |
140 | /* Switch to supervisor mode */ | 132 | |
141 | msr cpsr_c, #0xd3 | 133 | /* Switch to sys mode */ |
134 | msr cpsr_c, #0xdf | ||
135 | |||
136 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
142 | ldr sp, =stackend | 137 | ldr sp, =stackend |
138 | mov r3, sp | ||
139 | ldr r2, =stackbegin | ||
140 | ldr r4, =0xdeadbeef | ||
141 | 1: | ||
142 | cmp r3, r2 | ||
143 | strhi r4, [r2], #4 | ||
144 | bhi 1b | ||
145 | |||
143 | bl main | 146 | bl main |
144 | /* main() should never return */ | 147 | /* main() should never return */ |
145 | 148 | ||
@@ -178,12 +181,14 @@ undef_instr_handler: | |||
178 | mov r1, #0 | 181 | mov r1, #0 |
179 | b UIE | 182 | b UIE |
180 | 183 | ||
181 | /* We run supervisor mode most of the time, and should never see a software | 184 | /* We run sys mode most of the time, and should never see a software |
182 | exception being thrown. Perhaps make it illegal and call UIE? | 185 | exception being thrown. Make it illegal and call UIE. |
183 | */ | 186 | */ |
184 | software_int_handler: | 187 | software_int_handler: |
185 | reserved_handler: | 188 | reserved_handler: |
186 | movs pc, lr | 189 | sub r0, lr, #4 |
190 | mov r1, #4 | ||
191 | b UIE | ||
187 | 192 | ||
188 | prefetch_abort_handler: | 193 | prefetch_abort_handler: |
189 | sub r0, lr, #4 | 194 | sub r0, lr, #4 |