diff options
author | Michal Simek <monstr@monstr.eu> | 2011-01-31 09:10:04 -0500 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2011-03-09 02:09:54 -0500 |
commit | 6e83557c38b40d6e9d1c82ad0ae59d8e5db9c50c (patch) | |
tree | 856d8cf13273c2f8a696473ff9237cdc17c46632 /arch/microblaze | |
parent | d8748e73e882106ff0ffa0fa2192dab111a9f9f8 (diff) |
microblaze: Remove r0_ram pointer and PTO alignment
r0_ram pool was used for saving/restoring register
content if hw exception happen. This poll was replaced by
pt_pool_space with PT_SIZE size.
Based on this change SAVE_STATE_ARG_SPACE was removed which
caused that PTO offset is zero that's why is also removed.
r0_ram space was used as scratchpad by v850. In early
Microblaze Linux developing phase was this part of code
blindly copied.
Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze')
-rw-r--r-- | arch/microblaze/include/asm/entry.h | 36 | ||||
-rw-r--r-- | arch/microblaze/include/asm/processor.h | 2 | ||||
-rw-r--r-- | arch/microblaze/kernel/entry.S | 292 | ||||
-rw-r--r-- | arch/microblaze/kernel/hw_exception_handler.S | 16 | ||||
-rw-r--r-- | arch/microblaze/kernel/process.c | 2 | ||||
-rw-r--r-- | arch/microblaze/kernel/signal.c | 4 | ||||
-rw-r--r-- | arch/microblaze/kernel/vmlinux.lds.S | 5 |
7 files changed, 157 insertions, 200 deletions
diff --git a/arch/microblaze/include/asm/entry.h b/arch/microblaze/include/asm/entry.h index ec89f2ad0fe1..af0144b91b79 100644 --- a/arch/microblaze/include/asm/entry.h +++ b/arch/microblaze/include/asm/entry.h | |||
@@ -31,40 +31,4 @@ DECLARE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */ | |||
31 | DECLARE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */ | 31 | DECLARE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */ |
32 | # endif /* __ASSEMBLY__ */ | 32 | # endif /* __ASSEMBLY__ */ |
33 | 33 | ||
34 | #ifndef CONFIG_MMU | ||
35 | |||
36 | /* noMMU hasn't any space for args */ | ||
37 | # define STATE_SAVE_ARG_SPACE (0) | ||
38 | |||
39 | #else /* CONFIG_MMU */ | ||
40 | |||
41 | /* If true, system calls save and restore all registers (except result | ||
42 | * registers, of course). If false, then `call clobbered' registers | ||
43 | * will not be preserved, on the theory that system calls are basically | ||
44 | * function calls anyway, and the caller should be able to deal with it. | ||
45 | * This is a security risk, of course, as `internal' values may leak out | ||
46 | * after a system call, but that certainly doesn't matter very much for | ||
47 | * a processor with no MMU protection! For a protected-mode kernel, it | ||
48 | * would be faster to just zero those registers before returning. | ||
49 | * | ||
50 | * I can not rely on the glibc implementation. If you turn it off make | ||
51 | * sure that r11/r12 is saved in user-space. --KAA | ||
52 | * | ||
53 | * These are special variables using by the kernel trap/interrupt code | ||
54 | * to save registers in, at a time when there are no spare registers we | ||
55 | * can use to do so, and we can't depend on the value of the stack | ||
56 | * pointer. This means that they must be within a signed 16-bit | ||
57 | * displacement of 0x00000000. | ||
58 | */ | ||
59 | |||
60 | /* A `state save frame' is a struct pt_regs preceded by some extra space | ||
61 | * suitable for a function call stack frame. */ | ||
62 | |||
63 | /* Amount of room on the stack reserved for arguments and to satisfy the | ||
64 | * C calling conventions, in addition to the space used by the struct | ||
65 | * pt_regs that actually holds saved values. */ | ||
66 | #define STATE_SAVE_ARG_SPACE (6*4) /* Up to six arguments */ | ||
67 | |||
68 | #endif /* CONFIG_MMU */ | ||
69 | |||
70 | #endif /* _ASM_MICROBLAZE_ENTRY_H */ | 34 | #endif /* _ASM_MICROBLAZE_ENTRY_H */ |
diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h index 8eeb09211ece..aed2a6be8e27 100644 --- a/arch/microblaze/include/asm/processor.h +++ b/arch/microblaze/include/asm/processor.h | |||
@@ -155,7 +155,7 @@ unsigned long get_wchan(struct task_struct *p); | |||
155 | # define task_regs(task) ((struct pt_regs *)task_tos(task) - 1) | 155 | # define task_regs(task) ((struct pt_regs *)task_tos(task) - 1) |
156 | 156 | ||
157 | # define task_pt_regs_plus_args(tsk) \ | 157 | # define task_pt_regs_plus_args(tsk) \ |
158 | (((void *)task_pt_regs(tsk)) - STATE_SAVE_ARG_SPACE) | 158 | ((void *)task_pt_regs(tsk)) |
159 | 159 | ||
160 | # define task_sp(task) (task_regs(task)->r1) | 160 | # define task_sp(task) (task_regs(task)->r1) |
161 | # define task_pc(task) (task_regs(task)->pc) | 161 | # define task_pc(task) (task_regs(task)->pc) |
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S index 5010f0b22ca6..ff949e362968 100644 --- a/arch/microblaze/kernel/entry.S +++ b/arch/microblaze/kernel/entry.S | |||
@@ -33,12 +33,6 @@ | |||
33 | 33 | ||
34 | #undef DEBUG | 34 | #undef DEBUG |
35 | 35 | ||
36 | /* The size of a state save frame. */ | ||
37 | #define STATE_SAVE_SIZE (PT_SIZE + STATE_SAVE_ARG_SPACE) | ||
38 | |||
39 | /* The offset of the struct pt_regs in a `state save frame' on the stack. */ | ||
40 | #define PTO STATE_SAVE_ARG_SPACE /* 24 the space for args */ | ||
41 | |||
42 | #ifdef DEBUG | 36 | #ifdef DEBUG |
43 | /* Create space for syscalls counting. */ | 37 | /* Create space for syscalls counting. */ |
44 | .section .data | 38 | .section .data |
@@ -181,72 +175,72 @@ syscall_debug_table: | |||
181 | 1: | 175 | 1: |
182 | 176 | ||
183 | #define SAVE_REGS \ | 177 | #define SAVE_REGS \ |
184 | swi r2, r1, PTO+PT_R2; /* Save SDA */ \ | 178 | swi r2, r1, PT_R2; /* Save SDA */ \ |
185 | swi r3, r1, PTO+PT_R3; \ | 179 | swi r3, r1, PT_R3; \ |
186 | swi r4, r1, PTO+PT_R4; \ | 180 | swi r4, r1, PT_R4; \ |
187 | swi r5, r1, PTO+PT_R5; \ | 181 | swi r5, r1, PT_R5; \ |
188 | swi r6, r1, PTO+PT_R6; \ | 182 | swi r6, r1, PT_R6; \ |
189 | swi r7, r1, PTO+PT_R7; \ | 183 | swi r7, r1, PT_R7; \ |
190 | swi r8, r1, PTO+PT_R8; \ | 184 | swi r8, r1, PT_R8; \ |
191 | swi r9, r1, PTO+PT_R9; \ | 185 | swi r9, r1, PT_R9; \ |
192 | swi r10, r1, PTO+PT_R10; \ | 186 | swi r10, r1, PT_R10; \ |
193 | swi r11, r1, PTO+PT_R11; /* save clobbered regs after rval */\ | 187 | swi r11, r1, PT_R11; /* save clobbered regs after rval */\ |
194 | swi r12, r1, PTO+PT_R12; \ | 188 | swi r12, r1, PT_R12; \ |
195 | swi r13, r1, PTO+PT_R13; /* Save SDA2 */ \ | 189 | swi r13, r1, PT_R13; /* Save SDA2 */ \ |
196 | swi r14, r1, PTO+PT_PC; /* PC, before IRQ/trap */ \ | 190 | swi r14, r1, PT_PC; /* PC, before IRQ/trap */ \ |
197 | swi r15, r1, PTO+PT_R15; /* Save LP */ \ | 191 | swi r15, r1, PT_R15; /* Save LP */ \ |
198 | swi r16, r1, PTO+PT_R16; \ | 192 | swi r16, r1, PT_R16; \ |
199 | swi r17, r1, PTO+PT_R17; \ | 193 | swi r17, r1, PT_R17; \ |
200 | swi r18, r1, PTO+PT_R18; /* Save asm scratch reg */ \ | 194 | swi r18, r1, PT_R18; /* Save asm scratch reg */ \ |
201 | swi r19, r1, PTO+PT_R19; \ | 195 | swi r19, r1, PT_R19; \ |
202 | swi r20, r1, PTO+PT_R20; \ | 196 | swi r20, r1, PT_R20; \ |
203 | swi r21, r1, PTO+PT_R21; \ | 197 | swi r21, r1, PT_R21; \ |
204 | swi r22, r1, PTO+PT_R22; \ | 198 | swi r22, r1, PT_R22; \ |
205 | swi r23, r1, PTO+PT_R23; \ | 199 | swi r23, r1, PT_R23; \ |
206 | swi r24, r1, PTO+PT_R24; \ | 200 | swi r24, r1, PT_R24; \ |
207 | swi r25, r1, PTO+PT_R25; \ | 201 | swi r25, r1, PT_R25; \ |
208 | swi r26, r1, PTO+PT_R26; \ | 202 | swi r26, r1, PT_R26; \ |
209 | swi r27, r1, PTO+PT_R27; \ | 203 | swi r27, r1, PT_R27; \ |
210 | swi r28, r1, PTO+PT_R28; \ | 204 | swi r28, r1, PT_R28; \ |
211 | swi r29, r1, PTO+PT_R29; \ | 205 | swi r29, r1, PT_R29; \ |
212 | swi r30, r1, PTO+PT_R30; \ | 206 | swi r30, r1, PT_R30; \ |
213 | swi r31, r1, PTO+PT_R31; /* Save current task reg */ \ | 207 | swi r31, r1, PT_R31; /* Save current task reg */ \ |
214 | mfs r11, rmsr; /* save MSR */ \ | 208 | mfs r11, rmsr; /* save MSR */ \ |
215 | swi r11, r1, PTO+PT_MSR; | 209 | swi r11, r1, PT_MSR; |
216 | 210 | ||
217 | #define RESTORE_REGS \ | 211 | #define RESTORE_REGS \ |
218 | lwi r11, r1, PTO+PT_MSR; \ | 212 | lwi r11, r1, PT_MSR; \ |
219 | mts rmsr , r11; \ | 213 | mts rmsr , r11; \ |
220 | lwi r2, r1, PTO+PT_R2; /* restore SDA */ \ | 214 | lwi r2, r1, PT_R2; /* restore SDA */ \ |
221 | lwi r3, r1, PTO+PT_R3; \ | 215 | lwi r3, r1, PT_R3; \ |
222 | lwi r4, r1, PTO+PT_R4; \ | 216 | lwi r4, r1, PT_R4; \ |
223 | lwi r5, r1, PTO+PT_R5; \ | 217 | lwi r5, r1, PT_R5; \ |
224 | lwi r6, r1, PTO+PT_R6; \ | 218 | lwi r6, r1, PT_R6; \ |
225 | lwi r7, r1, PTO+PT_R7; \ | 219 | lwi r7, r1, PT_R7; \ |
226 | lwi r8, r1, PTO+PT_R8; \ | 220 | lwi r8, r1, PT_R8; \ |
227 | lwi r9, r1, PTO+PT_R9; \ | 221 | lwi r9, r1, PT_R9; \ |
228 | lwi r10, r1, PTO+PT_R10; \ | 222 | lwi r10, r1, PT_R10; \ |
229 | lwi r11, r1, PTO+PT_R11; /* restore clobbered regs after rval */\ | 223 | lwi r11, r1, PT_R11; /* restore clobbered regs after rval */\ |
230 | lwi r12, r1, PTO+PT_R12; \ | 224 | lwi r12, r1, PT_R12; \ |
231 | lwi r13, r1, PTO+PT_R13; /* restore SDA2 */ \ | 225 | lwi r13, r1, PT_R13; /* restore SDA2 */ \ |
232 | lwi r14, r1, PTO+PT_PC; /* RESTORE_LINK PC, before IRQ/trap */\ | 226 | lwi r14, r1, PT_PC; /* RESTORE_LINK PC, before IRQ/trap */\ |
233 | lwi r15, r1, PTO+PT_R15; /* restore LP */ \ | 227 | lwi r15, r1, PT_R15; /* restore LP */ \ |
234 | lwi r16, r1, PTO+PT_R16; \ | 228 | lwi r16, r1, PT_R16; \ |
235 | lwi r17, r1, PTO+PT_R17; \ | 229 | lwi r17, r1, PT_R17; \ |
236 | lwi r18, r1, PTO+PT_R18; /* restore asm scratch reg */ \ | 230 | lwi r18, r1, PT_R18; /* restore asm scratch reg */ \ |
237 | lwi r19, r1, PTO+PT_R19; \ | 231 | lwi r19, r1, PT_R19; \ |
238 | lwi r20, r1, PTO+PT_R20; \ | 232 | lwi r20, r1, PT_R20; \ |
239 | lwi r21, r1, PTO+PT_R21; \ | 233 | lwi r21, r1, PT_R21; \ |
240 | lwi r22, r1, PTO+PT_R22; \ | 234 | lwi r22, r1, PT_R22; \ |
241 | lwi r23, r1, PTO+PT_R23; \ | 235 | lwi r23, r1, PT_R23; \ |
242 | lwi r24, r1, PTO+PT_R24; \ | 236 | lwi r24, r1, PT_R24; \ |
243 | lwi r25, r1, PTO+PT_R25; \ | 237 | lwi r25, r1, PT_R25; \ |
244 | lwi r26, r1, PTO+PT_R26; \ | 238 | lwi r26, r1, PT_R26; \ |
245 | lwi r27, r1, PTO+PT_R27; \ | 239 | lwi r27, r1, PT_R27; \ |
246 | lwi r28, r1, PTO+PT_R28; \ | 240 | lwi r28, r1, PT_R28; \ |
247 | lwi r29, r1, PTO+PT_R29; \ | 241 | lwi r29, r1, PT_R29; \ |
248 | lwi r30, r1, PTO+PT_R30; \ | 242 | lwi r30, r1, PT_R30; \ |
249 | lwi r31, r1, PTO+PT_R31; /* Restore cur task reg */ | 243 | lwi r31, r1, PT_R31; /* Restore cur task reg */ |
250 | 244 | ||
251 | #define SAVE_STATE \ | 245 | #define SAVE_STATE \ |
252 | swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* save stack */ \ | 246 | swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* save stack */ \ |
@@ -259,11 +253,11 @@ syscall_debug_table: | |||
259 | lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ | 253 | lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ |
260 | /* FIXME: I can add these two lines to one */ \ | 254 | /* FIXME: I can add these two lines to one */ \ |
261 | /* tophys(r1,r1); */ \ | 255 | /* tophys(r1,r1); */ \ |
262 | /* addik r1, r1, -STATE_SAVE_SIZE; */ \ | 256 | /* addik r1, r1, -PT_SIZE; */ \ |
263 | addik r1, r1, CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - STATE_SAVE_SIZE; \ | 257 | addik r1, r1, CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - PT_SIZE; \ |
264 | SAVE_REGS \ | 258 | SAVE_REGS \ |
265 | brid 2f; \ | 259 | brid 2f; \ |
266 | swi r1, r1, PTO+PT_MODE; \ | 260 | swi r1, r1, PT_MODE; \ |
267 | 1: /* User-mode state save. */ \ | 261 | 1: /* User-mode state save. */ \ |
268 | lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */\ | 262 | lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */\ |
269 | tophys(r1,r1); \ | 263 | tophys(r1,r1); \ |
@@ -271,12 +265,12 @@ syscall_debug_table: | |||
271 | /* MS these three instructions can be added to one */ \ | 265 | /* MS these three instructions can be added to one */ \ |
272 | /* addik r1, r1, THREAD_SIZE; */ \ | 266 | /* addik r1, r1, THREAD_SIZE; */ \ |
273 | /* tophys(r1,r1); */ \ | 267 | /* tophys(r1,r1); */ \ |
274 | /* addik r1, r1, -STATE_SAVE_SIZE; */ \ | 268 | /* addik r1, r1, -PT_SIZE; */ \ |
275 | addik r1, r1, THREAD_SIZE + CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - STATE_SAVE_SIZE; \ | 269 | addik r1, r1, THREAD_SIZE + CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - PT_SIZE; \ |
276 | SAVE_REGS \ | 270 | SAVE_REGS \ |
277 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ | 271 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ |
278 | swi r11, r1, PTO+PT_R1; /* Store user SP. */ \ | 272 | swi r11, r1, PT_R1; /* Store user SP. */ \ |
279 | swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */ \ | 273 | swi r0, r1, PT_MODE; /* Was in user-mode. */ \ |
280 | /* MS: I am clearing UMS even in case when I come from kernel space */ \ | 274 | /* MS: I am clearing UMS even in case when I come from kernel space */ \ |
281 | clear_ums; \ | 275 | clear_ums; \ |
282 | 2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); | 276 | 2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); |
@@ -308,10 +302,10 @@ C_ENTRY(_user_exception): | |||
308 | lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/ | 302 | lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/ |
309 | tophys(r1,r1); | 303 | tophys(r1,r1); |
310 | 304 | ||
311 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ | 305 | addik r1, r1, -PT_SIZE; /* Make room on the stack. */ |
312 | SAVE_REGS | 306 | SAVE_REGS |
313 | 307 | ||
314 | swi r1, r1, PTO + PT_MODE; /* pt_regs -> kernel mode */ | 308 | swi r1, r1, PT_MODE; /* pt_regs -> kernel mode */ |
315 | brid 2f; | 309 | brid 2f; |
316 | nop; /* Fill delay slot */ | 310 | nop; /* Fill delay slot */ |
317 | 311 | ||
@@ -324,18 +318,18 @@ C_ENTRY(_user_exception): | |||
324 | addik r1, r1, THREAD_SIZE; | 318 | addik r1, r1, THREAD_SIZE; |
325 | tophys(r1,r1); | 319 | tophys(r1,r1); |
326 | 320 | ||
327 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ | 321 | addik r1, r1, -PT_SIZE; /* Make room on the stack. */ |
328 | SAVE_REGS | 322 | SAVE_REGS |
329 | swi r0, r1, PTO + PT_R3 | 323 | swi r0, r1, PT_R3 |
330 | swi r0, r1, PTO + PT_R4 | 324 | swi r0, r1, PT_R4 |
331 | 325 | ||
332 | swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */ | 326 | swi r0, r1, PT_MODE; /* Was in user-mode. */ |
333 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); | 327 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); |
334 | swi r11, r1, PTO+PT_R1; /* Store user SP. */ | 328 | swi r11, r1, PT_R1; /* Store user SP. */ |
335 | clear_ums; | 329 | clear_ums; |
336 | 2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); | 330 | 2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); |
337 | /* Save away the syscall number. */ | 331 | /* Save away the syscall number. */ |
338 | swi r12, r1, PTO+PT_R0; | 332 | swi r12, r1, PT_R0; |
339 | tovirt(r1,r1) | 333 | tovirt(r1,r1) |
340 | 334 | ||
341 | /* where the trap should return need -8 to adjust for rtsd r15, 8*/ | 335 | /* where the trap should return need -8 to adjust for rtsd r15, 8*/ |
@@ -354,18 +348,18 @@ C_ENTRY(_user_exception): | |||
354 | beqi r11, 4f | 348 | beqi r11, 4f |
355 | 349 | ||
356 | addik r3, r0, -ENOSYS | 350 | addik r3, r0, -ENOSYS |
357 | swi r3, r1, PTO + PT_R3 | 351 | swi r3, r1, PT_R3 |
358 | brlid r15, do_syscall_trace_enter | 352 | brlid r15, do_syscall_trace_enter |
359 | addik r5, r1, PTO + PT_R0 | 353 | addik r5, r1, PT_R0 |
360 | 354 | ||
361 | # do_syscall_trace_enter returns the new syscall nr. | 355 | # do_syscall_trace_enter returns the new syscall nr. |
362 | addk r12, r0, r3 | 356 | addk r12, r0, r3 |
363 | lwi r5, r1, PTO+PT_R5; | 357 | lwi r5, r1, PT_R5; |
364 | lwi r6, r1, PTO+PT_R6; | 358 | lwi r6, r1, PT_R6; |
365 | lwi r7, r1, PTO+PT_R7; | 359 | lwi r7, r1, PT_R7; |
366 | lwi r8, r1, PTO+PT_R8; | 360 | lwi r8, r1, PT_R8; |
367 | lwi r9, r1, PTO+PT_R9; | 361 | lwi r9, r1, PT_R9; |
368 | lwi r10, r1, PTO+PT_R10; | 362 | lwi r10, r1, PT_R10; |
369 | 4: | 363 | 4: |
370 | /* Jump to the appropriate function for the system call number in r12 | 364 | /* Jump to the appropriate function for the system call number in r12 |
371 | * (r12 is not preserved), or return an error if r12 is not valid. | 365 | * (r12 is not preserved), or return an error if r12 is not valid. |
@@ -404,10 +398,10 @@ C_ENTRY(_user_exception): | |||
404 | /* Entry point used to return from a syscall/trap */ | 398 | /* Entry point used to return from a syscall/trap */ |
405 | /* We re-enable BIP bit before state restore */ | 399 | /* We re-enable BIP bit before state restore */ |
406 | C_ENTRY(ret_from_trap): | 400 | C_ENTRY(ret_from_trap): |
407 | swi r3, r1, PTO + PT_R3 | 401 | swi r3, r1, PT_R3 |
408 | swi r4, r1, PTO + PT_R4 | 402 | swi r4, r1, PT_R4 |
409 | 403 | ||
410 | lwi r11, r1, PTO + PT_MODE; | 404 | lwi r11, r1, PT_MODE; |
411 | /* See if returning to kernel mode, if so, skip resched &c. */ | 405 | /* See if returning to kernel mode, if so, skip resched &c. */ |
412 | bnei r11, 2f; | 406 | bnei r11, 2f; |
413 | /* We're returning to user mode, so check for various conditions that | 407 | /* We're returning to user mode, so check for various conditions that |
@@ -419,7 +413,7 @@ C_ENTRY(ret_from_trap): | |||
419 | beqi r11, 1f | 413 | beqi r11, 1f |
420 | 414 | ||
421 | brlid r15, do_syscall_trace_leave | 415 | brlid r15, do_syscall_trace_leave |
422 | addik r5, r1, PTO + PT_R0 | 416 | addik r5, r1, PT_R0 |
423 | 1: | 417 | 1: |
424 | /* We're returning to user mode, so check for various conditions that | 418 | /* We're returning to user mode, so check for various conditions that |
425 | * trigger rescheduling. */ | 419 | * trigger rescheduling. */ |
@@ -439,7 +433,7 @@ C_ENTRY(ret_from_trap): | |||
439 | andi r11, r11, _TIF_SIGPENDING; | 433 | andi r11, r11, _TIF_SIGPENDING; |
440 | beqi r11, 1f; /* Signals to handle, handle them */ | 434 | beqi r11, 1f; /* Signals to handle, handle them */ |
441 | 435 | ||
442 | addik r5, r1, PTO; /* Arg 1: struct pt_regs *regs */ | 436 | addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */ |
443 | addi r7, r0, 1; /* Arg 3: int in_syscall */ | 437 | addi r7, r0, 1; /* Arg 3: int in_syscall */ |
444 | bralid r15, do_signal; /* Handle any signals */ | 438 | bralid r15, do_signal; /* Handle any signals */ |
445 | add r6, r0, r0; /* Arg 2: sigset_t *oldset */ | 439 | add r6, r0, r0; /* Arg 2: sigset_t *oldset */ |
@@ -450,7 +444,7 @@ C_ENTRY(ret_from_trap): | |||
450 | VM_OFF; | 444 | VM_OFF; |
451 | tophys(r1,r1); | 445 | tophys(r1,r1); |
452 | RESTORE_REGS; | 446 | RESTORE_REGS; |
453 | addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ | 447 | addik r1, r1, PT_SIZE /* Clean up stack space. */ |
454 | lwi r1, r1, PT_R1 - PT_SIZE;/* Restore user stack pointer. */ | 448 | lwi r1, r1, PT_R1 - PT_SIZE;/* Restore user stack pointer. */ |
455 | bri 6f; | 449 | bri 6f; |
456 | 450 | ||
@@ -459,7 +453,7 @@ C_ENTRY(ret_from_trap): | |||
459 | VM_OFF; | 453 | VM_OFF; |
460 | tophys(r1,r1); | 454 | tophys(r1,r1); |
461 | RESTORE_REGS; | 455 | RESTORE_REGS; |
462 | addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ | 456 | addik r1, r1, PT_SIZE /* Clean up stack space. */ |
463 | tovirt(r1,r1); | 457 | tovirt(r1,r1); |
464 | 6: | 458 | 6: |
465 | TRAP_return: /* Make global symbol for debugging */ | 459 | TRAP_return: /* Make global symbol for debugging */ |
@@ -472,8 +466,8 @@ TRAP_return: /* Make global symbol for debugging */ | |||
472 | 466 | ||
473 | C_ENTRY(sys_fork_wrapper): | 467 | C_ENTRY(sys_fork_wrapper): |
474 | addi r5, r0, SIGCHLD /* Arg 0: flags */ | 468 | addi r5, r0, SIGCHLD /* Arg 0: flags */ |
475 | lwi r6, r1, PTO+PT_R1 /* Arg 1: child SP (use parent's) */ | 469 | lwi r6, r1, PT_R1 /* Arg 1: child SP (use parent's) */ |
476 | addik r7, r1, PTO /* Arg 2: parent context */ | 470 | addik r7, r1, 0 /* Arg 2: parent context */ |
477 | add r8. r0, r0 /* Arg 3: (unused) */ | 471 | add r8. r0, r0 /* Arg 3: (unused) */ |
478 | add r9, r0, r0; /* Arg 4: (unused) */ | 472 | add r9, r0, r0; /* Arg 4: (unused) */ |
479 | brid do_fork /* Do real work (tail-call) */ | 473 | brid do_fork /* Do real work (tail-call) */ |
@@ -493,12 +487,12 @@ C_ENTRY(ret_from_fork): | |||
493 | 487 | ||
494 | C_ENTRY(sys_vfork): | 488 | C_ENTRY(sys_vfork): |
495 | brid microblaze_vfork /* Do real work (tail-call) */ | 489 | brid microblaze_vfork /* Do real work (tail-call) */ |
496 | addik r5, r1, PTO | 490 | addik r5, r1, 0 |
497 | 491 | ||
498 | C_ENTRY(sys_clone): | 492 | C_ENTRY(sys_clone): |
499 | bnei r6, 1f; /* See if child SP arg (arg 1) is 0. */ | 493 | bnei r6, 1f; /* See if child SP arg (arg 1) is 0. */ |
500 | lwi r6, r1, PTO + PT_R1; /* If so, use paret's stack ptr */ | 494 | lwi r6, r1, PT_R1; /* If so, use paret's stack ptr */ |
501 | 1: addik r7, r1, PTO; /* Arg 2: parent context */ | 495 | 1: addik r7, r1, 0; /* Arg 2: parent context */ |
502 | add r8, r0, r0; /* Arg 3: (unused) */ | 496 | add r8, r0, r0; /* Arg 3: (unused) */ |
503 | add r9, r0, r0; /* Arg 4: (unused) */ | 497 | add r9, r0, r0; /* Arg 4: (unused) */ |
504 | brid do_fork /* Do real work (tail-call) */ | 498 | brid do_fork /* Do real work (tail-call) */ |
@@ -506,11 +500,11 @@ C_ENTRY(sys_clone): | |||
506 | 500 | ||
507 | C_ENTRY(sys_execve): | 501 | C_ENTRY(sys_execve): |
508 | brid microblaze_execve; /* Do real work (tail-call).*/ | 502 | brid microblaze_execve; /* Do real work (tail-call).*/ |
509 | addik r8, r1, PTO; /* add user context as 4th arg */ | 503 | addik r8, r1, 0; /* add user context as 4th arg */ |
510 | 504 | ||
511 | C_ENTRY(sys_rt_sigreturn_wrapper): | 505 | C_ENTRY(sys_rt_sigreturn_wrapper): |
512 | brid sys_rt_sigreturn /* Do real work */ | 506 | brid sys_rt_sigreturn /* Do real work */ |
513 | addik r5, r1, PTO; /* add user context as 1st arg */ | 507 | addik r5, r1, 0; /* add user context as 1st arg */ |
514 | 508 | ||
515 | /* | 509 | /* |
516 | * HW EXCEPTION rutine start | 510 | * HW EXCEPTION rutine start |
@@ -521,7 +515,7 @@ C_ENTRY(full_exception_trap): | |||
521 | addik r17, r17, -4 | 515 | addik r17, r17, -4 |
522 | SAVE_STATE /* Save registers */ | 516 | SAVE_STATE /* Save registers */ |
523 | /* PC, before IRQ/trap - this is one instruction above */ | 517 | /* PC, before IRQ/trap - this is one instruction above */ |
524 | swi r17, r1, PTO+PT_PC; | 518 | swi r17, r1, PT_PC; |
525 | tovirt(r1,r1) | 519 | tovirt(r1,r1) |
526 | /* FIXME this can be store directly in PT_ESR reg. | 520 | /* FIXME this can be store directly in PT_ESR reg. |
527 | * I tested it but there is a fault */ | 521 | * I tested it but there is a fault */ |
@@ -531,7 +525,7 @@ C_ENTRY(full_exception_trap): | |||
531 | mfs r7, rfsr; /* save FSR */ | 525 | mfs r7, rfsr; /* save FSR */ |
532 | mts rfsr, r0; /* Clear sticky fsr */ | 526 | mts rfsr, r0; /* Clear sticky fsr */ |
533 | rted r0, full_exception | 527 | rted r0, full_exception |
534 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ | 528 | addik r5, r1, 0 /* parameter struct pt_regs * regs */ |
535 | 529 | ||
536 | /* | 530 | /* |
537 | * Unaligned data trap. | 531 | * Unaligned data trap. |
@@ -557,14 +551,14 @@ C_ENTRY(unaligned_data_trap): | |||
557 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); | 551 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); |
558 | SAVE_STATE /* Save registers.*/ | 552 | SAVE_STATE /* Save registers.*/ |
559 | /* PC, before IRQ/trap - this is one instruction above */ | 553 | /* PC, before IRQ/trap - this is one instruction above */ |
560 | swi r17, r1, PTO+PT_PC; | 554 | swi r17, r1, PT_PC; |
561 | tovirt(r1,r1) | 555 | tovirt(r1,r1) |
562 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ | 556 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ |
563 | addik r15, r0, ret_from_exc-8 | 557 | addik r15, r0, ret_from_exc-8 |
564 | mfs r3, resr /* ESR */ | 558 | mfs r3, resr /* ESR */ |
565 | mfs r4, rear /* EAR */ | 559 | mfs r4, rear /* EAR */ |
566 | rtbd r0, _unaligned_data_exception | 560 | rtbd r0, _unaligned_data_exception |
567 | addik r7, r1, PTO /* parameter struct pt_regs * regs */ | 561 | addik r7, r1, 0 /* parameter struct pt_regs * regs */ |
568 | 562 | ||
569 | /* | 563 | /* |
570 | * Page fault traps. | 564 | * Page fault traps. |
@@ -587,30 +581,30 @@ C_ENTRY(unaligned_data_trap): | |||
587 | C_ENTRY(page_fault_data_trap): | 581 | C_ENTRY(page_fault_data_trap): |
588 | SAVE_STATE /* Save registers.*/ | 582 | SAVE_STATE /* Save registers.*/ |
589 | /* PC, before IRQ/trap - this is one instruction above */ | 583 | /* PC, before IRQ/trap - this is one instruction above */ |
590 | swi r17, r1, PTO+PT_PC; | 584 | swi r17, r1, PT_PC; |
591 | tovirt(r1,r1) | 585 | tovirt(r1,r1) |
592 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ | 586 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ |
593 | addik r15, r0, ret_from_exc-8 | 587 | addik r15, r0, ret_from_exc-8 |
594 | mfs r6, rear /* parameter unsigned long address */ | 588 | mfs r6, rear /* parameter unsigned long address */ |
595 | mfs r7, resr /* parameter unsigned long error_code */ | 589 | mfs r7, resr /* parameter unsigned long error_code */ |
596 | rted r0, do_page_fault | 590 | rted r0, do_page_fault |
597 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ | 591 | addik r5, r1, 0 /* parameter struct pt_regs * regs */ |
598 | 592 | ||
599 | C_ENTRY(page_fault_instr_trap): | 593 | C_ENTRY(page_fault_instr_trap): |
600 | SAVE_STATE /* Save registers.*/ | 594 | SAVE_STATE /* Save registers.*/ |
601 | /* PC, before IRQ/trap - this is one instruction above */ | 595 | /* PC, before IRQ/trap - this is one instruction above */ |
602 | swi r17, r1, PTO+PT_PC; | 596 | swi r17, r1, PT_PC; |
603 | tovirt(r1,r1) | 597 | tovirt(r1,r1) |
604 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ | 598 | /* where the trap should return need -8 to adjust for rtsd r15, 8 */ |
605 | addik r15, r0, ret_from_exc-8 | 599 | addik r15, r0, ret_from_exc-8 |
606 | mfs r6, rear /* parameter unsigned long address */ | 600 | mfs r6, rear /* parameter unsigned long address */ |
607 | ori r7, r0, 0 /* parameter unsigned long error_code */ | 601 | ori r7, r0, 0 /* parameter unsigned long error_code */ |
608 | rted r0, do_page_fault | 602 | rted r0, do_page_fault |
609 | addik r5, r1, PTO /* parameter struct pt_regs * regs */ | 603 | addik r5, r1, 0 /* parameter struct pt_regs * regs */ |
610 | 604 | ||
611 | /* Entry point used to return from an exception. */ | 605 | /* Entry point used to return from an exception. */ |
612 | C_ENTRY(ret_from_exc): | 606 | C_ENTRY(ret_from_exc): |
613 | lwi r11, r1, PTO + PT_MODE; | 607 | lwi r11, r1, PT_MODE; |
614 | bnei r11, 2f; /* See if returning to kernel mode, */ | 608 | bnei r11, 2f; /* See if returning to kernel mode, */ |
615 | /* ... if so, skip resched &c. */ | 609 | /* ... if so, skip resched &c. */ |
616 | 610 | ||
@@ -642,7 +636,7 @@ C_ENTRY(ret_from_exc): | |||
642 | * complete register state. Here we save anything not saved by | 636 | * complete register state. Here we save anything not saved by |
643 | * the normal entry sequence, so that it may be safely restored | 637 | * the normal entry sequence, so that it may be safely restored |
644 | * (in a possibly modified form) after do_signal returns. */ | 638 | * (in a possibly modified form) after do_signal returns. */ |
645 | addik r5, r1, PTO; /* Arg 1: struct pt_regs *regs */ | 639 | addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */ |
646 | addi r7, r0, 0; /* Arg 3: int in_syscall */ | 640 | addi r7, r0, 0; /* Arg 3: int in_syscall */ |
647 | bralid r15, do_signal; /* Handle any signals */ | 641 | bralid r15, do_signal; /* Handle any signals */ |
648 | add r6, r0, r0; /* Arg 2: sigset_t *oldset */ | 642 | add r6, r0, r0; /* Arg 2: sigset_t *oldset */ |
@@ -654,7 +648,7 @@ C_ENTRY(ret_from_exc): | |||
654 | tophys(r1,r1); | 648 | tophys(r1,r1); |
655 | 649 | ||
656 | RESTORE_REGS; | 650 | RESTORE_REGS; |
657 | addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ | 651 | addik r1, r1, PT_SIZE /* Clean up stack space. */ |
658 | 652 | ||
659 | lwi r1, r1, PT_R1 - PT_SIZE; /* Restore user stack pointer. */ | 653 | lwi r1, r1, PT_R1 - PT_SIZE; /* Restore user stack pointer. */ |
660 | bri 6f; | 654 | bri 6f; |
@@ -663,7 +657,7 @@ C_ENTRY(ret_from_exc): | |||
663 | VM_OFF; | 657 | VM_OFF; |
664 | tophys(r1,r1); | 658 | tophys(r1,r1); |
665 | RESTORE_REGS; | 659 | RESTORE_REGS; |
666 | addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ | 660 | addik r1, r1, PT_SIZE /* Clean up stack space. */ |
667 | 661 | ||
668 | tovirt(r1,r1); | 662 | tovirt(r1,r1); |
669 | 6: | 663 | 6: |
@@ -696,10 +690,10 @@ C_ENTRY(_interrupt): | |||
696 | tophys(r1,r1); /* MS: I have in r1 physical address where stack is */ | 690 | tophys(r1,r1); /* MS: I have in r1 physical address where stack is */ |
697 | /* save registers */ | 691 | /* save registers */ |
698 | /* MS: Make room on the stack -> activation record */ | 692 | /* MS: Make room on the stack -> activation record */ |
699 | addik r1, r1, -STATE_SAVE_SIZE; | 693 | addik r1, r1, -PT_SIZE; |
700 | SAVE_REGS | 694 | SAVE_REGS |
701 | brid 2f; | 695 | brid 2f; |
702 | swi r1, r1, PTO + PT_MODE; /* 0 - user mode, 1 - kernel mode */ | 696 | swi r1, r1, PT_MODE; /* 0 - user mode, 1 - kernel mode */ |
703 | 1: | 697 | 1: |
704 | /* User-mode state save. */ | 698 | /* User-mode state save. */ |
705 | /* MS: get the saved current */ | 699 | /* MS: get the saved current */ |
@@ -709,23 +703,23 @@ C_ENTRY(_interrupt): | |||
709 | addik r1, r1, THREAD_SIZE; | 703 | addik r1, r1, THREAD_SIZE; |
710 | tophys(r1,r1); | 704 | tophys(r1,r1); |
711 | /* save registers */ | 705 | /* save registers */ |
712 | addik r1, r1, -STATE_SAVE_SIZE; | 706 | addik r1, r1, -PT_SIZE; |
713 | SAVE_REGS | 707 | SAVE_REGS |
714 | /* calculate mode */ | 708 | /* calculate mode */ |
715 | swi r0, r1, PTO + PT_MODE; | 709 | swi r0, r1, PT_MODE; |
716 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); | 710 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); |
717 | swi r11, r1, PTO+PT_R1; | 711 | swi r11, r1, PT_R1; |
718 | clear_ums; | 712 | clear_ums; |
719 | 2: | 713 | 2: |
720 | lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); | 714 | lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); |
721 | tovirt(r1,r1) | 715 | tovirt(r1,r1) |
722 | addik r15, r0, irq_call; | 716 | addik r15, r0, irq_call; |
723 | irq_call:rtbd r0, do_IRQ; | 717 | irq_call:rtbd r0, do_IRQ; |
724 | addik r5, r1, PTO; | 718 | addik r5, r1, 0; |
725 | 719 | ||
726 | /* MS: we are in virtual mode */ | 720 | /* MS: we are in virtual mode */ |
727 | ret_from_irq: | 721 | ret_from_irq: |
728 | lwi r11, r1, PTO + PT_MODE; | 722 | lwi r11, r1, PT_MODE; |
729 | bnei r11, 2f; | 723 | bnei r11, 2f; |
730 | 724 | ||
731 | lwi r11, CURRENT_TASK, TS_THREAD_INFO; | 725 | lwi r11, CURRENT_TASK, TS_THREAD_INFO; |
@@ -742,7 +736,7 @@ ret_from_irq: | |||
742 | beqid r11, no_intr_resched | 736 | beqid r11, no_intr_resched |
743 | /* Handle a signal return; Pending signals should be in r18. */ | 737 | /* Handle a signal return; Pending signals should be in r18. */ |
744 | addi r7, r0, 0; /* Arg 3: int in_syscall */ | 738 | addi r7, r0, 0; /* Arg 3: int in_syscall */ |
745 | addik r5, r1, PTO; /* Arg 1: struct pt_regs *regs */ | 739 | addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */ |
746 | bralid r15, do_signal; /* Handle any signals */ | 740 | bralid r15, do_signal; /* Handle any signals */ |
747 | add r6, r0, r0; /* Arg 2: sigset_t *oldset */ | 741 | add r6, r0, r0; /* Arg 2: sigset_t *oldset */ |
748 | 742 | ||
@@ -754,7 +748,7 @@ no_intr_resched: | |||
754 | VM_OFF; | 748 | VM_OFF; |
755 | tophys(r1,r1); | 749 | tophys(r1,r1); |
756 | RESTORE_REGS | 750 | RESTORE_REGS |
757 | addik r1, r1, STATE_SAVE_SIZE /* MS: Clean up stack space. */ | 751 | addik r1, r1, PT_SIZE /* MS: Clean up stack space. */ |
758 | lwi r1, r1, PT_R1 - PT_SIZE; | 752 | lwi r1, r1, PT_R1 - PT_SIZE; |
759 | bri 6f; | 753 | bri 6f; |
760 | /* MS: Return to kernel state. */ | 754 | /* MS: Return to kernel state. */ |
@@ -782,7 +776,7 @@ restore: | |||
782 | VM_OFF /* MS: turn off MMU */ | 776 | VM_OFF /* MS: turn off MMU */ |
783 | tophys(r1,r1) | 777 | tophys(r1,r1) |
784 | RESTORE_REGS | 778 | RESTORE_REGS |
785 | addik r1, r1, STATE_SAVE_SIZE /* MS: Clean up stack space. */ | 779 | addik r1, r1, PT_SIZE /* MS: Clean up stack space. */ |
786 | tovirt(r1,r1); | 780 | tovirt(r1,r1); |
787 | 6: | 781 | 6: |
788 | IRQ_return: /* MS: Make global symbol for debugging */ | 782 | IRQ_return: /* MS: Make global symbol for debugging */ |
@@ -805,28 +799,28 @@ C_ENTRY(_debug_exception): | |||
805 | lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/ | 799 | lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/ |
806 | 800 | ||
807 | /* BIP bit is set on entry, no interrupts can occur */ | 801 | /* BIP bit is set on entry, no interrupts can occur */ |
808 | addik r1, r1, CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - STATE_SAVE_SIZE; | 802 | addik r1, r1, CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - PT_SIZE; |
809 | SAVE_REGS; | 803 | SAVE_REGS; |
810 | /* save all regs to pt_reg structure */ | 804 | /* save all regs to pt_reg structure */ |
811 | swi r0, r1, PTO+PT_R0; /* R0 must be saved too */ | 805 | swi r0, r1, PT_R0; /* R0 must be saved too */ |
812 | swi r14, r1, PTO+PT_R14 /* rewrite saved R14 value */ | 806 | swi r14, r1, PT_R14 /* rewrite saved R14 value */ |
813 | swi r16, r1, PTO+PT_PC; /* PC and r16 are the same */ | 807 | swi r16, r1, PT_PC; /* PC and r16 are the same */ |
814 | /* save special purpose registers to pt_regs */ | 808 | /* save special purpose registers to pt_regs */ |
815 | mfs r11, rear; | 809 | mfs r11, rear; |
816 | swi r11, r1, PTO+PT_EAR; | 810 | swi r11, r1, PT_EAR; |
817 | mfs r11, resr; | 811 | mfs r11, resr; |
818 | swi r11, r1, PTO+PT_ESR; | 812 | swi r11, r1, PT_ESR; |
819 | mfs r11, rfsr; | 813 | mfs r11, rfsr; |
820 | swi r11, r1, PTO+PT_FSR; | 814 | swi r11, r1, PT_FSR; |
821 | 815 | ||
822 | /* stack pointer is in physical address at it is decrease | 816 | /* stack pointer is in physical address at it is decrease |
823 | * by STATE_SAVE_SIZE but we need to get correct R1 value */ | 817 | * by PT_SIZE but we need to get correct R1 value */ |
824 | addik r11, r1, CONFIG_KERNEL_START - CONFIG_KERNEL_BASE_ADDR + STATE_SAVE_SIZE; | 818 | addik r11, r1, CONFIG_KERNEL_START - CONFIG_KERNEL_BASE_ADDR + PT_SIZE; |
825 | swi r11, r1, PTO+PT_R1 | 819 | swi r11, r1, PT_R1 |
826 | /* MS: r31 - current pointer isn't changed */ | 820 | /* MS: r31 - current pointer isn't changed */ |
827 | tovirt(r1,r1) | 821 | tovirt(r1,r1) |
828 | #ifdef CONFIG_KGDB | 822 | #ifdef CONFIG_KGDB |
829 | addi r5, r1, PTO /* pass pt_reg address as the first arg */ | 823 | addi r5, r1, 0 /* pass pt_reg address as the first arg */ |
830 | la r15, r0, dbtrap_call; /* return address */ | 824 | la r15, r0, dbtrap_call; /* return address */ |
831 | rtbd r0, microblaze_kgdb_break | 825 | rtbd r0, microblaze_kgdb_break |
832 | nop; | 826 | nop; |
@@ -842,16 +836,16 @@ C_ENTRY(_debug_exception): | |||
842 | addik r1, r1, THREAD_SIZE; /* calculate kernel stack pointer */ | 836 | addik r1, r1, THREAD_SIZE; /* calculate kernel stack pointer */ |
843 | tophys(r1,r1); | 837 | tophys(r1,r1); |
844 | 838 | ||
845 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ | 839 | addik r1, r1, -PT_SIZE; /* Make room on the stack. */ |
846 | SAVE_REGS; | 840 | SAVE_REGS; |
847 | swi r16, r1, PTO+PT_PC; /* Save LP */ | 841 | swi r16, r1, PT_PC; /* Save LP */ |
848 | swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */ | 842 | swi r0, r1, PT_MODE; /* Was in user-mode. */ |
849 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); | 843 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); |
850 | swi r11, r1, PTO+PT_R1; /* Store user SP. */ | 844 | swi r11, r1, PT_R1; /* Store user SP. */ |
851 | lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); | 845 | lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); |
852 | tovirt(r1,r1) | 846 | tovirt(r1,r1) |
853 | set_vms; | 847 | set_vms; |
854 | addik r5, r1, PTO; | 848 | addik r5, r1, 0; |
855 | addik r15, r0, dbtrap_call; | 849 | addik r15, r0, dbtrap_call; |
856 | dbtrap_call: /* Return point for kernel/user entry + 8 because of rtsd r15, 8 */ | 850 | dbtrap_call: /* Return point for kernel/user entry + 8 because of rtsd r15, 8 */ |
857 | rtbd r0, sw_exception | 851 | rtbd r0, sw_exception |
@@ -859,7 +853,7 @@ dbtrap_call: /* Return point for kernel/user entry + 8 because of rtsd r15, 8 */ | |||
859 | 853 | ||
860 | /* MS: The first instruction for the second part of the gdb/kgdb */ | 854 | /* MS: The first instruction for the second part of the gdb/kgdb */ |
861 | set_bip; /* Ints masked for state restore */ | 855 | set_bip; /* Ints masked for state restore */ |
862 | lwi r11, r1, PTO + PT_MODE; | 856 | lwi r11, r1, PT_MODE; |
863 | bnei r11, 2f; | 857 | bnei r11, 2f; |
864 | /* MS: Return to user space - gdb */ | 858 | /* MS: Return to user space - gdb */ |
865 | /* Get current task ptr into r11 */ | 859 | /* Get current task ptr into r11 */ |
@@ -878,7 +872,7 @@ dbtrap_call: /* Return point for kernel/user entry + 8 because of rtsd r15, 8 */ | |||
878 | andi r11, r11, _TIF_SIGPENDING; | 872 | andi r11, r11, _TIF_SIGPENDING; |
879 | beqi r11, 1f; /* Signals to handle, handle them */ | 873 | beqi r11, 1f; /* Signals to handle, handle them */ |
880 | 874 | ||
881 | addik r5, r1, PTO; /* Arg 1: struct pt_regs *regs */ | 875 | addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */ |
882 | addi r7, r0, 0; /* Arg 3: int in_syscall */ | 876 | addi r7, r0, 0; /* Arg 3: int in_syscall */ |
883 | bralid r15, do_signal; /* Handle any signals */ | 877 | bralid r15, do_signal; /* Handle any signals */ |
884 | add r6, r0, r0; /* Arg 2: sigset_t *oldset */ | 878 | add r6, r0, r0; /* Arg 2: sigset_t *oldset */ |
@@ -889,7 +883,7 @@ dbtrap_call: /* Return point for kernel/user entry + 8 because of rtsd r15, 8 */ | |||
889 | tophys(r1,r1); | 883 | tophys(r1,r1); |
890 | /* MS: Restore all regs */ | 884 | /* MS: Restore all regs */ |
891 | RESTORE_REGS | 885 | RESTORE_REGS |
892 | addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space */ | 886 | addik r1, r1, PT_SIZE /* Clean up stack space */ |
893 | lwi r1, r1, PT_R1 - PT_SIZE; /* Restore user stack pointer */ | 887 | lwi r1, r1, PT_R1 - PT_SIZE; /* Restore user stack pointer */ |
894 | DBTRAP_return_user: /* MS: Make global symbol for debugging */ | 888 | DBTRAP_return_user: /* MS: Make global symbol for debugging */ |
895 | rtbd r16, 0; /* MS: Instructions to return from a debug trap */ | 889 | rtbd r16, 0; /* MS: Instructions to return from a debug trap */ |
@@ -900,9 +894,9 @@ DBTRAP_return_user: /* MS: Make global symbol for debugging */ | |||
900 | tophys(r1,r1); | 894 | tophys(r1,r1); |
901 | /* MS: Restore all regs */ | 895 | /* MS: Restore all regs */ |
902 | RESTORE_REGS | 896 | RESTORE_REGS |
903 | lwi r14, r1, PTO+PT_R14; | 897 | lwi r14, r1, PT_R14; |
904 | lwi r16, r1, PTO+PT_PC; | 898 | lwi r16, r1, PT_PC; |
905 | addik r1, r1, STATE_SAVE_SIZE; /* MS: Clean up stack space */ | 899 | addik r1, r1, PT_SIZE; /* MS: Clean up stack space */ |
906 | tovirt(r1,r1); | 900 | tovirt(r1,r1); |
907 | DBTRAP_return_kernel: /* MS: Make global symbol for debugging */ | 901 | DBTRAP_return_kernel: /* MS: Make global symbol for debugging */ |
908 | rtbd r16, 0; /* MS: Instructions to return from a debug trap */ | 902 | rtbd r16, 0; /* MS: Instructions to return from a debug trap */ |
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S index ec5e99dd5d75..2401fa4b7ce1 100644 --- a/arch/microblaze/kernel/hw_exception_handler.S +++ b/arch/microblaze/kernel/hw_exception_handler.S | |||
@@ -93,7 +93,7 @@ | |||
93 | lwi r6, r1, PT_R6; \ | 93 | lwi r6, r1, PT_R6; \ |
94 | lwi r11, r1, PT_R11; \ | 94 | lwi r11, r1, PT_R11; \ |
95 | lwi r31, r1, PT_R31; \ | 95 | lwi r31, r1, PT_R31; \ |
96 | lwi r1, r0, TOPHYS(r0_ram + 0); | 96 | lwi r1, r1, PT_R1; |
97 | #endif /* CONFIG_MMU */ | 97 | #endif /* CONFIG_MMU */ |
98 | 98 | ||
99 | #define LWREG_NOP \ | 99 | #define LWREG_NOP \ |
@@ -208,8 +208,8 @@ | |||
208 | * | . | | 208 | * | . | |
209 | * | . | | 209 | * | . | |
210 | * | 210 | * |
211 | * NO_MMU kernel use the same r0_ram pointed space - look to vmlinux.lds.S | 211 | * MMU kernel uses the same 'pt_pool_space' pointed space |
212 | * which is used for storing register values - old style was, that value were | 212 | * which is used for storing register values - noMMu style was, that values were |
213 | * stored in stack but in case of failure you lost information about register. | 213 | * stored in stack but in case of failure you lost information about register. |
214 | * Currently you can see register value in memory in specific place. | 214 | * Currently you can see register value in memory in specific place. |
215 | * In compare to with previous solution the speed should be the same. | 215 | * In compare to with previous solution the speed should be the same. |
@@ -228,8 +228,12 @@ | |||
228 | */ | 228 | */ |
229 | 229 | ||
230 | /* wrappers to restore state before coming to entry.S */ | 230 | /* wrappers to restore state before coming to entry.S */ |
231 | |||
232 | #ifdef CONFIG_MMU | 231 | #ifdef CONFIG_MMU |
232 | .section .data | ||
233 | .align 4 | ||
234 | pt_pool_space: | ||
235 | .space PT_SIZE | ||
236 | |||
233 | #ifdef DEBUG | 237 | #ifdef DEBUG |
234 | /* Create space for exception counting. */ | 238 | /* Create space for exception counting. */ |
235 | .section .data | 239 | .section .data |
@@ -299,10 +303,10 @@ _hw_exception_handler: | |||
299 | #ifndef CONFIG_MMU | 303 | #ifndef CONFIG_MMU |
300 | addik r1, r1, -(EX_HANDLER_STACK_SIZ); /* Create stack frame */ | 304 | addik r1, r1, -(EX_HANDLER_STACK_SIZ); /* Create stack frame */ |
301 | #else | 305 | #else |
302 | swi r1, r0, TOPHYS(r0_ram + 0); /* GET_SP */ | 306 | swi r1, r0, TOPHYS(pt_pool_space + PT_R1); /* GET_SP */ |
303 | /* Save date to kernel memory. Here is the problem | 307 | /* Save date to kernel memory. Here is the problem |
304 | * when you came from user space */ | 308 | * when you came from user space */ |
305 | ori r1, r0, TOPHYS(r0_ram + 28); | 309 | ori r1, r0, TOPHYS(pt_pool_space); |
306 | #endif | 310 | #endif |
307 | swi r3, r1, PT_R3 | 311 | swi r3, r1, PT_R3 |
308 | swi r4, r1, PT_R4 | 312 | swi r4, r1, PT_R4 |
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c index ba7c4b16ed35..968648a81c1e 100644 --- a/arch/microblaze/kernel/process.c +++ b/arch/microblaze/kernel/process.c | |||
@@ -159,7 +159,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
159 | } | 159 | } |
160 | 160 | ||
161 | /* FIXME STATE_SAVE_PT_OFFSET; */ | 161 | /* FIXME STATE_SAVE_PT_OFFSET; */ |
162 | ti->cpu_context.r1 = (unsigned long)childregs - STATE_SAVE_ARG_SPACE; | 162 | ti->cpu_context.r1 = (unsigned long)childregs; |
163 | /* we should consider the fact that childregs is a copy of the parent | 163 | /* we should consider the fact that childregs is a copy of the parent |
164 | * regs which were saved immediately after entering the kernel state | 164 | * regs which were saved immediately after entering the kernel state |
165 | * before enabling VM. This MSR will be restored in switch_to and | 165 | * before enabling VM. This MSR will be restored in switch_to and |
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c index d8d3bb396cd6..580d052ae814 100644 --- a/arch/microblaze/kernel/signal.c +++ b/arch/microblaze/kernel/signal.c | |||
@@ -93,7 +93,7 @@ static int restore_sigcontext(struct pt_regs *regs, | |||
93 | asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) | 93 | asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) |
94 | { | 94 | { |
95 | struct rt_sigframe __user *frame = | 95 | struct rt_sigframe __user *frame = |
96 | (struct rt_sigframe __user *)(regs->r1 + STATE_SAVE_ARG_SPACE); | 96 | (struct rt_sigframe __user *)(regs->r1); |
97 | 97 | ||
98 | sigset_t set; | 98 | sigset_t set; |
99 | int rval; | 99 | int rval; |
@@ -247,7 +247,7 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
247 | goto give_sigsegv; | 247 | goto give_sigsegv; |
248 | 248 | ||
249 | /* Set up registers for signal handler */ | 249 | /* Set up registers for signal handler */ |
250 | regs->r1 = (unsigned long) frame - STATE_SAVE_ARG_SPACE; | 250 | regs->r1 = (unsigned long) frame; |
251 | 251 | ||
252 | /* Signal handler args: */ | 252 | /* Signal handler args: */ |
253 | regs->r5 = signal; /* arg 0: signum */ | 253 | regs->r5 = signal; /* arg 0: signum */ |
diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S index 3451bdec9f05..ac0e1a5d4782 100644 --- a/arch/microblaze/kernel/vmlinux.lds.S +++ b/arch/microblaze/kernel/vmlinux.lds.S | |||
@@ -70,11 +70,6 @@ SECTIONS { | |||
70 | RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE) | 70 | RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE) |
71 | _edata = . ; | 71 | _edata = . ; |
72 | 72 | ||
73 | /* Reserve some low RAM for r0 based memory references */ | ||
74 | . = ALIGN(0x4) ; | ||
75 | r0_ram = . ; | ||
76 | . = . + PAGE_SIZE; /* a page should be enough */ | ||
77 | |||
78 | /* Under the microblaze ABI, .sdata and .sbss must be contiguous */ | 73 | /* Under the microblaze ABI, .sdata and .sbss must be contiguous */ |
79 | . = ALIGN(8); | 74 | . = ALIGN(8); |
80 | .sdata : AT(ADDR(.sdata) - LOAD_OFFSET) { | 75 | .sdata : AT(ADDR(.sdata) - LOAD_OFFSET) { |