Lines Matching +full:tmr +full:- +full:inject +full:- +full:1
2 * Low-level system-call handling, trap handlers and context-switching
4 * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2008-2009 PetaLogix
25 #include <asm/asm-offsets.h>
160 /* Define how to call high-level functions. With MMU, virtual mode must be
161 * enabled when calling the high-level function. Clobbers R11.
175 rted r0, TOPHYS(1f); \
177 1:
262 bnei r1, 1f; \
263 /* Kernel-mode state save. */ \
264 /* Reload kernel stack-ptr. */ \
268 /* addik r1, r1, -PT_SIZE; */ \
269 addik r1, r1, CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - PT_SIZE; \
273 1: /* User-mode state save. */ \
280 /* addik r1, r1, -PT_SIZE; */ \
281 addik r1, r1, THREAD_SIZE + CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - PT_SIZE; \
285 swi r0, r1, PT_MODE; /* Was in user-mode. */ \
295 addik r1, r1, -PT_SIZE
302 1:
304 bgtid r9, 1b
313 addik r1, r1, -PT_SIZE
320 1:
322 bgtid r9, 1b
336 * Syscall number in r12, args in r5-r10
353 addik r1, r1, -PT_SIZE; /* Make room on the stack. */
358 swi r0, r1, PT_MODE; /* Was in user-mode. */
367 /* where the trap should return need -8 to adjust for rtsd r15, 8*/
371 * the called function should return. [note that MAKE_SYS_CALL uses label 1] */
382 addik r3, r0, -ENOSYS
399 * should return. [note that MAKE_SYS_CALL uses label 1] */
402 addi r11, r12, -__NR_syscalls;
406 add r12, r12, r12; /* convert num -> ptr */
408 addi r30, r0, 1 /* restarts allowed */
414 addi r3, r3, 1
417 addi r3, r3, 1
423 /* where the trap should return need -8 to adjust for rtsd r15, 8 */
424 addi r15, r0, ret_from_trap-8
430 addi r3, r0, -ENOSYS;
433 /* We re-enable BIP bit before state restore */
447 beqi r11, 1f
451 1:
462 bri 1b
469 addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */
473 bri 1b
482 lwi r1, r1, PT_R1 - PT_SIZE;/* Restore user stack pointer. */
515 addk r5, r0, r19 /* ... and argument - in r19 */
522 addik r5, r1, 0; /* add user context as 1st arg */
530 addik r17, r17, -4
532 /* PC, before IRQ/trap - this is one instruction above */
537 /* where the trap should return need -8 to adjust for rtsd r15, 8 */
538 addik r15, r0, ret_from_exc - 8
568 /* PC, before IRQ/trap - this is one instruction above */
571 /* where the trap should return need -8 to adjust for rtsd r15, 8 */
572 addik r15, r0, ret_from_exc-8
595 /* data and intruction trap - which is choose is resolved int fault.c */
598 /* PC, before IRQ/trap - this is one instruction above */
601 /* where the trap should return need -8 to adjust for rtsd r15, 8 */
602 addik r15, r0, ret_from_exc-8
610 /* PC, before IRQ/trap - this is one instruction above */
613 /* where the trap should return need -8 to adjust for rtsd r15, 8 */
614 addik r15, r0, ret_from_exc-8
628 1:
637 bri 1b
647 * points (for instance, call-saved registers (because the normal
648 * C-compiler calling sequence in the kernel makes sure they're
649 * preserved), and call-clobbered registers in the case of
654 addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */
657 bri 1b
668 lwi r1, r1, PT_R1 - PT_SIZE; /* Restore user stack pointer. */
690 * The stack-pointer (r1) should have already been saved to the memory
701 bnei r1, 1f
703 /* Kernel-mode state save. */
707 /* MS: Make room on the stack -> activation record */
708 addik r1, r1, -PT_SIZE;
711 swi r1, r1, PT_MODE; /* 0 - user mode, 1 - kernel mode */
712 1:
713 /* User-mode state save. */
721 addik r1, r1, -PT_SIZE;
740 1:
747 bri 1b
753 addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */
756 bri 1b
767 lwi r1, r1, PT_R1 - PT_SIZE;
841 addik r3, r3, -1
846 /* return from reset need -8 to adjust for rtsd r15, 8 */
847 addik r15, r0, ret_from_reset - 8
864 * injecting fault in one of the TMR Microblaze core.
873 addik r1, r1, -PT_SIZE - 36
884 * break handler, below code configures the tmr manager
920 addik r3, r3, -1
924 /* return from break need -8 to adjust for rtsd r15, 8 */
925 addik r15, r0, ret_from_break - 8
930 /* flush the d-cache */
935 * To make sure microblaze i-cache is in a proper state
936 * invalidate the i-cache.
943 mbar 1
961 bnei r1, 1f
962 /* MS: Kernel-mode state save - kgdb */
963 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/
966 addik r1, r1, CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - PT_SIZE;
982 addik r11, r1, CONFIG_KERNEL_START - CONFIG_KERNEL_BASE_ADDR + PT_SIZE;
984 /* MS: r31 - current pointer isn't changed */
996 /* MS: User-mode state save - gdb */
997 1: lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */
1003 addik r1, r1, -PT_SIZE; /* Make room on the stack. */
1006 swi r0, r1, PT_MODE; /* Was in user-mode. */
1022 /* MS: Return to user space - gdb */
1023 1:
1033 bri 1b
1039 addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */
1042 bri 1b
1051 lwi r1, r1, PT_R1 - PT_SIZE; /* Restore user stack pointer */
1056 /* MS: Return to kernel state - kgdb */
1089 /* save non-volatile registers */
1112 /* update r31, the current-give me pointer to task which will be next */
1121 /* non-volatile registers */
1161 addik r1, r1, -PT_SIZE
1167 mbar 1
1175 mbar 1
1181 rtbd r0, 1f
1183 1:
1266 * For TMR Inject API which injects the error should
1268 * TMR Inject is programmed with address of 0x200 so that
1283 syscall_table_size=(.-sys_call_table)