diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/microblaze/kernel/entry.S | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S index 6c117ceaabea..bf6b2b122485 100644 --- a/arch/microblaze/kernel/entry.S +++ b/arch/microblaze/kernel/entry.S | |||
@@ -318,42 +318,23 @@ | |||
318 | * are masked. This is nice, means we don't have to CLI before state save | 318 | * are masked. This is nice, means we don't have to CLI before state save |
319 | */ | 319 | */ |
320 | C_ENTRY(_user_exception): | 320 | C_ENTRY(_user_exception): |
321 | swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */ | ||
322 | addi r14, r14, 4 /* return address is 4 byte after call */ | 321 | addi r14, r14, 4 /* return address is 4 byte after call */ |
322 | swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */ | ||
323 | 323 | ||
324 | mfs r1, rmsr | ||
325 | nop | ||
326 | andi r1, r1, MSR_UMS | ||
327 | bnei r1, 1f | ||
328 | |||
329 | /* Kernel-mode state save - kernel execve */ | ||
330 | lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/ | ||
331 | tophys(r1,r1); | ||
332 | |||
333 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ | ||
334 | SAVE_REGS | ||
335 | |||
336 | swi r1, r1, PTO + PT_MODE; /* pt_regs -> kernel mode */ | ||
337 | brid 2f; | ||
338 | nop; /* Fill delay slot */ | ||
339 | |||
340 | /* User-mode state save. */ | ||
341 | 1: | ||
342 | lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */ | 324 | lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */ |
343 | tophys(r1,r1); | 325 | tophys(r1,r1); |
344 | lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */ | 326 | lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */ |
345 | /* calculate kernel stack pointer from task struct 8k */ | 327 | /* MS these three instructions can be added to one */ |
346 | addik r1, r1, THREAD_SIZE; | 328 | /* addik r1, r1, THREAD_SIZE; */ |
347 | tophys(r1,r1); | 329 | /* tophys(r1,r1); */ |
348 | 330 | /* addik r1, r1, -STATE_SAVE_SIZE; */ | |
349 | addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ | 331 | addik r1, r1, THREAD_SIZE + CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - STATE_SAVE_SIZE; |
350 | SAVE_REGS | 332 | SAVE_REGS |
351 | 333 | ||
352 | swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */ | ||
353 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); | 334 | lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); |
354 | swi r11, r1, PTO+PT_R1; /* Store user SP. */ | 335 | swi r11, r1, PTO+PT_R1; /* Store user SP. */ |
355 | clear_ums; | 336 | clear_ums; |
356 | 2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); | 337 | lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); |
357 | /* Save away the syscall number. */ | 338 | /* Save away the syscall number. */ |
358 | swi r12, r1, PTO+PT_R0; | 339 | swi r12, r1, PTO+PT_R0; |
359 | tovirt(r1,r1) | 340 | tovirt(r1,r1) |
@@ -423,9 +404,6 @@ C_ENTRY(ret_from_trap): | |||
423 | swi r3, r1, PTO + PT_R3 | 404 | swi r3, r1, PTO + PT_R3 |
424 | swi r4, r1, PTO + PT_R4 | 405 | swi r4, r1, PTO + PT_R4 |
425 | 406 | ||
426 | lwi r11, r1, PTO + PT_MODE; | ||
427 | /* See if returning to kernel mode, if so, skip resched &c. */ | ||
428 | bnei r11, 2f; | ||
429 | /* 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 |
430 | * trigger rescheduling. */ | 408 | * trigger rescheduling. */ |
431 | /* FIXME: Restructure all these flag checks. */ | 409 | /* FIXME: Restructure all these flag checks. */ |
@@ -468,16 +446,6 @@ C_ENTRY(ret_from_trap): | |||
468 | RESTORE_REGS; | 446 | RESTORE_REGS; |
469 | addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ | 447 | addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ |
470 | lwi r1, r1, PT_R1 - PT_SIZE;/* Restore user stack pointer. */ | 448 | lwi r1, r1, PT_R1 - PT_SIZE;/* Restore user stack pointer. */ |
471 | bri 6f; | ||
472 | |||
473 | /* Return to kernel state. */ | ||
474 | 2: set_bip; /* Ints masked for state restore */ | ||
475 | VM_OFF; | ||
476 | tophys(r1,r1); | ||
477 | RESTORE_REGS; | ||
478 | addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ | ||
479 | tovirt(r1,r1); | ||
480 | 6: | ||
481 | TRAP_return: /* Make global symbol for debugging */ | 449 | TRAP_return: /* Make global symbol for debugging */ |
482 | rtbd r14, 0; /* Instructions to return from an IRQ */ | 450 | rtbd r14, 0; /* Instructions to return from an IRQ */ |
483 | nop; | 451 | nop; |