entry.S (777537905744c28b02c283692e7f75f5445c1afa) entry.S (b1d70c62fff3e8b6224699801c610c244882685a)
1/*
2 * Low-level system-call handling, trap handlers and context-switching
3 *
4 * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2008-2009 PetaLogix
6 * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
7 * Copyright (C) 2001,2002 NEC Corporation
8 * Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>

--- 291 unchanged lines hidden (view full) ---

300 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */
301 SAVE_REGS
302
303 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */
304 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
305 swi r11, r1, PTO+PT_R1; /* Store user SP. */
306 addi r11, r0, 1;
307 swi r11, r0, TOPHYS(PER_CPU(KM)); /* Now we're in kernel-mode. */
1/*
2 * Low-level system-call handling, trap handlers and context-switching
3 *
4 * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2008-2009 PetaLogix
6 * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
7 * Copyright (C) 2001,2002 NEC Corporation
8 * Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>

--- 291 unchanged lines hidden (view full) ---

300 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */
301 SAVE_REGS
302
303 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */
304 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
305 swi r11, r1, PTO+PT_R1; /* Store user SP. */
306 addi r11, r0, 1;
307 swi r11, r0, TOPHYS(PER_CPU(KM)); /* Now we're in kernel-mode. */
3082: lwi r31, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */
3082: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
309 /* Save away the syscall number. */
310 swi r12, r1, PTO+PT_R0;
311 tovirt(r1,r1)
312
313/* where the trap should return need -8 to adjust for rtsd r15, 8*/
314/* Jump to the appropriate function for the system call number in r12
315 * (r12 is not preserved), or return an error if r12 is not valid. The LP
316 * register should point to the location where
317 * the called function should return. [note that MAKE_SYS_CALL uses label 1] */
318
319 # Step into virtual mode.
320 set_vms;
321 addik r11, r0, 3f
322 rtid r11, 0
323 nop
3243:
309 /* Save away the syscall number. */
310 swi r12, r1, PTO+PT_R0;
311 tovirt(r1,r1)
312
313/* where the trap should return need -8 to adjust for rtsd r15, 8*/
314/* Jump to the appropriate function for the system call number in r12
315 * (r12 is not preserved), or return an error if r12 is not valid. The LP
316 * register should point to the location where
317 * the called function should return. [note that MAKE_SYS_CALL uses label 1] */
318
319 # Step into virtual mode.
320 set_vms;
321 addik r11, r0, 3f
322 rtid r11, 0
323 nop
3243:
325 add r11, r0, CURRENT_TASK /* Get current task ptr into r11 */
326 lwi r11, r11, TS_THREAD_INFO /* get thread info */
325 lwi r11, CURRENT_TASK, TS_THREAD_INFO /* get thread info */
327 lwi r11, r11, TI_FLAGS /* get flags in thread info */
328 andi r11, r11, _TIF_WORK_SYSCALL_MASK
329 beqi r11, 4f
330
331 addik r3, r0, -ENOSYS
332 swi r3, r1, PTO + PT_R3
333 brlid r15, do_syscall_trace_enter
334 addik r5, r1, PTO + PT_R0

--- 42 unchanged lines hidden (view full) ---

377/* Entry point used to return from a syscall/trap */
378/* We re-enable BIP bit before state restore */
379C_ENTRY(ret_from_trap):
380 set_bip; /* Ints masked for state restore*/
381 lwi r11, r1, PTO+PT_MODE;
382/* See if returning to kernel mode, if so, skip resched &c. */
383 bnei r11, 2f;
384
326 lwi r11, r11, TI_FLAGS /* get flags in thread info */
327 andi r11, r11, _TIF_WORK_SYSCALL_MASK
328 beqi r11, 4f
329
330 addik r3, r0, -ENOSYS
331 swi r3, r1, PTO + PT_R3
332 brlid r15, do_syscall_trace_enter
333 addik r5, r1, PTO + PT_R0

--- 42 unchanged lines hidden (view full) ---

376/* Entry point used to return from a syscall/trap */
377/* We re-enable BIP bit before state restore */
378C_ENTRY(ret_from_trap):
379 set_bip; /* Ints masked for state restore*/
380 lwi r11, r1, PTO+PT_MODE;
381/* See if returning to kernel mode, if so, skip resched &c. */
382 bnei r11, 2f;
383
384 swi r3, r1, PTO + PT_R3
385 swi r4, r1, PTO + PT_R4
386
385 /* We're returning to user mode, so check for various conditions that
386 * trigger rescheduling. */
387 /* We're returning to user mode, so check for various conditions that
388 * trigger rescheduling. */
387 # FIXME: Restructure all these flag checks.
388 add r11, r0, CURRENT_TASK; /* Get current task ptr into r11 */
389 lwi r11, r11, TS_THREAD_INFO; /* get thread info */
389 /* FIXME: Restructure all these flag checks. */
390 lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */
390 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
391 andi r11, r11, _TIF_WORK_SYSCALL_MASK
392 beqi r11, 1f
393
391 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
392 andi r11, r11, _TIF_WORK_SYSCALL_MASK
393 beqi r11, 1f
394
394 swi r3, r1, PTO + PT_R3
395 swi r4, r1, PTO + PT_R4
396 brlid r15, do_syscall_trace_leave
397 addik r5, r1, PTO + PT_R0
395 brlid r15, do_syscall_trace_leave
396 addik r5, r1, PTO + PT_R0
398 lwi r3, r1, PTO + PT_R3
399 lwi r4, r1, PTO + PT_R4
4001:
3971:
401
402 /* We're returning to user mode, so check for various conditions that
403 * trigger rescheduling. */
398 /* We're returning to user mode, so check for various conditions that
399 * trigger rescheduling. */
404 /* Get current task ptr into r11 */
405 add r11, r0, CURRENT_TASK; /* Get current task ptr into r11 */
406 lwi r11, r11, TS_THREAD_INFO; /* get thread info */
400 /* get thread info from current task */
401 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
407 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
408 andi r11, r11, _TIF_NEED_RESCHED;
409 beqi r11, 5f;
410
402 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
403 andi r11, r11, _TIF_NEED_RESCHED;
404 beqi r11, 5f;
405
411 swi r3, r1, PTO + PT_R3; /* store syscall result */
412 swi r4, r1, PTO + PT_R4;
413 bralid r15, schedule; /* Call scheduler */
414 nop; /* delay slot */
406 bralid r15, schedule; /* Call scheduler */
407 nop; /* delay slot */
415 lwi r3, r1, PTO + PT_R3; /* restore syscall result */
416 lwi r4, r1, PTO + PT_R4;
417
418 /* Maybe handle a signal */
408
409 /* Maybe handle a signal */
4195: add r11, r0, CURRENT_TASK; /* Get current task ptr into r11 */
420 lwi r11, r11, TS_THREAD_INFO; /* get thread info */
4105: /* get thread info from current task*/
411 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
421 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
422 andi r11, r11, _TIF_SIGPENDING;
423 beqi r11, 1f; /* Signals to handle, handle them */
424
412 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
413 andi r11, r11, _TIF_SIGPENDING;
414 beqi r11, 1f; /* Signals to handle, handle them */
415
425 swi r3, r1, PTO + PT_R3; /* store syscall result */
426 swi r4, r1, PTO + PT_R4;
427 la r5, r1, PTO; /* Arg 1: struct pt_regs *regs */
428 add r6, r0, r0; /* Arg 2: sigset_t *oldset */
429 addi r7, r0, 1; /* Arg 3: int in_syscall */
430 bralid r15, do_signal; /* Handle any signals */
431 nop;
416 la r5, r1, PTO; /* Arg 1: struct pt_regs *regs */
417 add r6, r0, r0; /* Arg 2: sigset_t *oldset */
418 addi r7, r0, 1; /* Arg 3: int in_syscall */
419 bralid r15, do_signal; /* Handle any signals */
420 nop;
421
422/* Finally, return to user state. */
4231:
432 lwi r3, r1, PTO + PT_R3; /* restore syscall result */
433 lwi r4, r1, PTO + PT_R4;
434
424 lwi r3, r1, PTO + PT_R3; /* restore syscall result */
425 lwi r4, r1, PTO + PT_R4;
426
435/* Finally, return to user state. */
4361: swi r0, r0, PER_CPU(KM); /* Now officially in user state. */
427 swi r0, r0, PER_CPU(KM); /* Now officially in user state. */
437 add r11, r0, CURRENT_TASK; /* Get current task ptr into r11 */
438 swi r11, r0, PER_CPU(CURRENT_SAVE); /* save current */
439 VM_OFF;
440 tophys(r1,r1);
441 RESTORE_REGS;
442 addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */
443 lwi r1, r1, PT_R1 - PT_SIZE;/* Restore user stack pointer. */
444 bri 6f;

--- 115 unchanged lines hidden (view full) ---

560 /* PC, before IRQ/trap - this is one instruction above FIXME*/ \
561 swi r17, r1, PTO+PT_PC; \
562 \
563 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ \
564 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
565 swi r11, r1, PTO+PT_R1; /* Store user SP. */ \
566 addi r11, r0, 1; \
567 swi r11, r0, TOPHYS(PER_CPU(KM)); /* Now we're in kernel-mode.*/\
428 add r11, r0, CURRENT_TASK; /* Get current task ptr into r11 */
429 swi r11, r0, PER_CPU(CURRENT_SAVE); /* save current */
430 VM_OFF;
431 tophys(r1,r1);
432 RESTORE_REGS;
433 addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */
434 lwi r1, r1, PT_R1 - PT_SIZE;/* Restore user stack pointer. */
435 bri 6f;

--- 115 unchanged lines hidden (view full) ---

551 /* PC, before IRQ/trap - this is one instruction above FIXME*/ \
552 swi r17, r1, PTO+PT_PC; \
553 \
554 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ \
555 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
556 swi r11, r1, PTO+PT_R1; /* Store user SP. */ \
557 addi r11, r0, 1; \
558 swi r11, r0, TOPHYS(PER_CPU(KM)); /* Now we're in kernel-mode.*/\
5682: lwi r31, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */\
5592: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); \
569 /* Save away the syscall number. */ \
570 swi r0, r1, PTO+PT_R0; \
571 tovirt(r1,r1)
572
573C_ENTRY(full_exception_trap):
574 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */
575 /* adjust exception address for privileged instruction
576 * for finding where is it */

--- 91 unchanged lines hidden (view full) ---

668C_ENTRY(ret_from_exc):
669 set_bip; /* Ints masked for state restore*/
670 lwi r11, r1, PTO+PT_MODE;
671 bnei r11, 2f; /* See if returning to kernel mode, */
672 /* ... if so, skip resched &c. */
673
674 /* We're returning to user mode, so check for various conditions that
675 trigger rescheduling. */
560 /* Save away the syscall number. */ \
561 swi r0, r1, PTO+PT_R0; \
562 tovirt(r1,r1)
563
564C_ENTRY(full_exception_trap):
565 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */
566 /* adjust exception address for privileged instruction
567 * for finding where is it */

--- 91 unchanged lines hidden (view full) ---

659C_ENTRY(ret_from_exc):
660 set_bip; /* Ints masked for state restore*/
661 lwi r11, r1, PTO+PT_MODE;
662 bnei r11, 2f; /* See if returning to kernel mode, */
663 /* ... if so, skip resched &c. */
664
665 /* We're returning to user mode, so check for various conditions that
666 trigger rescheduling. */
676 /* Get current task ptr into r11 */
677 add r11, r0, CURRENT_TASK; /* Get current task ptr into r11 */
678 lwi r11, r11, TS_THREAD_INFO; /* get thread info */
667 lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */
679 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
680 andi r11, r11, _TIF_NEED_RESCHED;
681 beqi r11, 5f;
682
683/* Call the scheduler before returning from a syscall/trap. */
684 bralid r15, schedule; /* Call scheduler */
685 nop; /* delay slot */
686
687 /* Maybe handle a signal */
668 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
669 andi r11, r11, _TIF_NEED_RESCHED;
670 beqi r11, 5f;
671
672/* Call the scheduler before returning from a syscall/trap. */
673 bralid r15, schedule; /* Call scheduler */
674 nop; /* delay slot */
675
676 /* Maybe handle a signal */
6885: add r11, r0, CURRENT_TASK; /* Get current task ptr into r11 */
689 lwi r11, r11, TS_THREAD_INFO; /* get thread info */
6775: lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */
690 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
691 andi r11, r11, _TIF_SIGPENDING;
692 beqi r11, 1f; /* Signals to handle, handle them */
693
694 /*
695 * Handle a signal return; Pending signals should be in r18.
696 *
697 * Not all registers are saved by the normal trap/interrupt entry

--- 99 unchanged lines hidden (view full) ---

797 swi r0, r1, PTO + PT_MODE;
798 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
799 swi r11, r1, PTO+PT_R1;
800 /* setup kernel mode to KM */
801 addi r11, r0, 1;
802 swi r11, r0, TOPHYS(PER_CPU(KM));
803
8042:
678 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
679 andi r11, r11, _TIF_SIGPENDING;
680 beqi r11, 1f; /* Signals to handle, handle them */
681
682 /*
683 * Handle a signal return; Pending signals should be in r18.
684 *
685 * Not all registers are saved by the normal trap/interrupt entry

--- 99 unchanged lines hidden (view full) ---

785 swi r0, r1, PTO + PT_MODE;
786 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
787 swi r11, r1, PTO+PT_R1;
788 /* setup kernel mode to KM */
789 addi r11, r0, 1;
790 swi r11, r0, TOPHYS(PER_CPU(KM));
791
7922:
805 lwi r31, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
793 lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
806 swi r0, r1, PTO + PT_R0;
807 tovirt(r1,r1)
808 la r5, r1, PTO;
809 set_vms;
810 la r11, r0, do_IRQ;
811 la r15, r0, irq_call;
812irq_call:rtbd r11, 0;
813 nop;
814
815/* MS: we are in virtual mode */
816ret_from_irq:
817 lwi r11, r1, PTO + PT_MODE;
818 bnei r11, 2f;
819
794 swi r0, r1, PTO + PT_R0;
795 tovirt(r1,r1)
796 la r5, r1, PTO;
797 set_vms;
798 la r11, r0, do_IRQ;
799 la r15, r0, irq_call;
800irq_call:rtbd r11, 0;
801 nop;
802
803/* MS: we are in virtual mode */
804ret_from_irq:
805 lwi r11, r1, PTO + PT_MODE;
806 bnei r11, 2f;
807
820 add r11, r0, CURRENT_TASK;
821 lwi r11, r11, TS_THREAD_INFO;
808 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
822 lwi r11, r11, TI_FLAGS; /* MS: get flags from thread info */
823 andi r11, r11, _TIF_NEED_RESCHED;
824 beqi r11, 5f
825 bralid r15, schedule;
826 nop; /* delay slot */
827
828 /* Maybe handle a signal */
809 lwi r11, r11, TI_FLAGS; /* MS: get flags from thread info */
810 andi r11, r11, _TIF_NEED_RESCHED;
811 beqi r11, 5f
812 bralid r15, schedule;
813 nop; /* delay slot */
814
815 /* Maybe handle a signal */
8295: add r11, r0, CURRENT_TASK;
830 lwi r11, r11, TS_THREAD_INFO; /* MS: get thread info */
8165: lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* MS: get thread info */
831 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
832 andi r11, r11, _TIF_SIGPENDING;
833 beqid r11, no_intr_resched
834/* Handle a signal return; Pending signals should be in r18. */
835 addi r7, r0, 0; /* Arg 3: int in_syscall */
836 la r5, r1, PTO; /* Arg 1: struct pt_regs *regs */
837 bralid r15, do_signal; /* Handle any signals */
838 add r6, r0, r0; /* Arg 2: sigset_t *oldset */

--- 11 unchanged lines hidden (view full) ---

850 lwi r4, r1, PTO + PT_R4;
851 RESTORE_REGS
852 addik r1, r1, STATE_SAVE_SIZE /* MS: Clean up stack space. */
853 lwi r1, r1, PT_R1 - PT_SIZE;
854 bri 6f;
855/* MS: Return to kernel state. */
8562:
857#ifdef CONFIG_PREEMPT
817 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
818 andi r11, r11, _TIF_SIGPENDING;
819 beqid r11, no_intr_resched
820/* Handle a signal return; Pending signals should be in r18. */
821 addi r7, r0, 0; /* Arg 3: int in_syscall */
822 la r5, r1, PTO; /* Arg 1: struct pt_regs *regs */
823 bralid r15, do_signal; /* Handle any signals */
824 add r6, r0, r0; /* Arg 2: sigset_t *oldset */

--- 11 unchanged lines hidden (view full) ---

836 lwi r4, r1, PTO + PT_R4;
837 RESTORE_REGS
838 addik r1, r1, STATE_SAVE_SIZE /* MS: Clean up stack space. */
839 lwi r1, r1, PT_R1 - PT_SIZE;
840 bri 6f;
841/* MS: Return to kernel state. */
8422:
843#ifdef CONFIG_PREEMPT
858 add r11, r0, CURRENT_TASK;
859 lwi r11, r11, TS_THREAD_INFO;
844 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
860 /* MS: get preempt_count from thread info */
861 lwi r5, r11, TI_PREEMPT_COUNT;
862 bgti r5, restore;
863
864 lwi r5, r11, TI_FLAGS; /* get flags in thread info */
865 andi r5, r5, _TIF_NEED_RESCHED;
866 beqi r5, restore /* if zero jump over */
867
868preempt:
869 /* interrupts are off that's why I am calling preempt_chedule_irq */
870 bralid r15, preempt_schedule_irq
871 nop
845 /* MS: get preempt_count from thread info */
846 lwi r5, r11, TI_PREEMPT_COUNT;
847 bgti r5, restore;
848
849 lwi r5, r11, TI_FLAGS; /* get flags in thread info */
850 andi r5, r5, _TIF_NEED_RESCHED;
851 beqi r5, restore /* if zero jump over */
852
853preempt:
854 /* interrupts are off that's why I am calling preempt_chedule_irq */
855 bralid r15, preempt_schedule_irq
856 nop
872 add r11, r0, CURRENT_TASK; /* Get current task ptr into r11 */
873 lwi r11, r11, TS_THREAD_INFO; /* get thread info */
857 lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */
874 lwi r5, r11, TI_FLAGS; /* get flags in thread info */
875 andi r5, r5, _TIF_NEED_RESCHED;
876 bnei r5, preempt /* if non zero jump to resched */
877restore:
878#endif
879 VM_OFF /* MS: turn off MMU */
880 tophys(r1,r1)
881 lwi r3, r1, PTO + PT_R3; /* MS: restore saved r3, r4 registers */

--- 51 unchanged lines hidden (view full) ---

933 swi r4, r1, PTO + PT_R4;
934 SAVE_REGS;
935
936 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */
937 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
938 swi r11, r1, PTO+PT_R1; /* Store user SP. */
939 addi r11, r0, 1;
940 swi r11, r0, TOPHYS(PER_CPU(KM)); /* Now we're in kernel-mode. */
858 lwi r5, r11, TI_FLAGS; /* get flags in thread info */
859 andi r5, r5, _TIF_NEED_RESCHED;
860 bnei r5, preempt /* if non zero jump to resched */
861restore:
862#endif
863 VM_OFF /* MS: turn off MMU */
864 tophys(r1,r1)
865 lwi r3, r1, PTO + PT_R3; /* MS: restore saved r3, r4 registers */

--- 51 unchanged lines hidden (view full) ---

917 swi r4, r1, PTO + PT_R4;
918 SAVE_REGS;
919
920 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */
921 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
922 swi r11, r1, PTO+PT_R1; /* Store user SP. */
923 addi r11, r0, 1;
924 swi r11, r0, TOPHYS(PER_CPU(KM)); /* Now we're in kernel-mode. */
9412: lwi r31, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */
9252: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
942 /* Save away the syscall number. */
943 swi r0, r1, PTO+PT_R0;
944 tovirt(r1,r1)
945
946 addi r5, r0, SIGTRAP /* send the trap signal */
947 add r6, r0, CURRENT_TASK; /* Get current task ptr into r11 */
948 addk r7, r0, r0 /* 3rd param zero */
949
950 set_vms;
951 la r11, r0, send_sig;
952 la r15, r0, dbtrap_call;
953dbtrap_call: rtbd r11, 0;
954 nop;
955
956 set_bip; /* Ints masked for state restore*/
957 lwi r11, r1, PTO+PT_MODE;
958 bnei r11, 2f;
959
960 /* Get current task ptr into r11 */
926 /* Save away the syscall number. */
927 swi r0, r1, PTO+PT_R0;
928 tovirt(r1,r1)
929
930 addi r5, r0, SIGTRAP /* send the trap signal */
931 add r6, r0, CURRENT_TASK; /* Get current task ptr into r11 */
932 addk r7, r0, r0 /* 3rd param zero */
933
934 set_vms;
935 la r11, r0, send_sig;
936 la r15, r0, dbtrap_call;
937dbtrap_call: rtbd r11, 0;
938 nop;
939
940 set_bip; /* Ints masked for state restore*/
941 lwi r11, r1, PTO+PT_MODE;
942 bnei r11, 2f;
943
944 /* Get current task ptr into r11 */
961 add r11, r0, CURRENT_TASK; /* Get current task ptr into r11 */
962 lwi r11, r11, TS_THREAD_INFO; /* get thread info */
945 lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */
963 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
964 andi r11, r11, _TIF_NEED_RESCHED;
965 beqi r11, 5f;
966
967/* Call the scheduler before returning from a syscall/trap. */
968
969 bralid r15, schedule; /* Call scheduler */
970 nop; /* delay slot */
971 /* XXX Is PT_DTRACE handling needed here? */
972 /* XXX m68knommu also checks TASK_STATE & TASK_COUNTER here. */
973
974 /* Maybe handle a signal */
946 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
947 andi r11, r11, _TIF_NEED_RESCHED;
948 beqi r11, 5f;
949
950/* Call the scheduler before returning from a syscall/trap. */
951
952 bralid r15, schedule; /* Call scheduler */
953 nop; /* delay slot */
954 /* XXX Is PT_DTRACE handling needed here? */
955 /* XXX m68knommu also checks TASK_STATE & TASK_COUNTER here. */
956
957 /* Maybe handle a signal */
9755: add r11, r0, CURRENT_TASK; /* Get current task ptr into r11 */
976 lwi r11, r11, TS_THREAD_INFO; /* get thread info */
9585: lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */
977 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
978 andi r11, r11, _TIF_SIGPENDING;
979 beqi r11, 1f; /* Signals to handle, handle them */
980
981/* Handle a signal return; Pending signals should be in r18. */
982 /* Not all registers are saved by the normal trap/interrupt entry
983 points (for instance, call-saved registers (because the normal
984 C-compiler calling sequence in the kernel makes sure they're

--- 40 unchanged lines hidden (view full) ---

1025DBTRAP_return: /* Make global symbol for debugging */
1026 rtbd r14, 0; /* Instructions to return from an IRQ */
1027 nop;
1028
1029
1030
1031ENTRY(_switch_to)
1032 /* prepare return value */
959 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
960 andi r11, r11, _TIF_SIGPENDING;
961 beqi r11, 1f; /* Signals to handle, handle them */
962
963/* Handle a signal return; Pending signals should be in r18. */
964 /* Not all registers are saved by the normal trap/interrupt entry
965 points (for instance, call-saved registers (because the normal
966 C-compiler calling sequence in the kernel makes sure they're

--- 40 unchanged lines hidden (view full) ---

1007DBTRAP_return: /* Make global symbol for debugging */
1008 rtbd r14, 0; /* Instructions to return from an IRQ */
1009 nop;
1010
1011
1012
1013ENTRY(_switch_to)
1014 /* prepare return value */
1033 addk r3, r0, r31
1015 addk r3, r0, CURRENT_TASK
1034
1035 /* save registers in cpu_context */
1036 /* use r11 and r12, volatile registers, as temp register */
1037 /* give start of cpu_context for previous process */
1038 addik r11, r5, TI_CPU_CONTEXT
1039 swi r1, r11, CC_R1
1040 swi r2, r11, CC_R2
1041 /* skip volatile registers.

--- 27 unchanged lines hidden (view full) ---

1069 swi r12, r11, CC_EAR
1070 mfs r12, resr
1071 nop
1072 swi r12, r11, CC_ESR
1073 mfs r12, rfsr
1074 nop
1075 swi r12, r11, CC_FSR
1076
1016
1017 /* save registers in cpu_context */
1018 /* use r11 and r12, volatile registers, as temp register */
1019 /* give start of cpu_context for previous process */
1020 addik r11, r5, TI_CPU_CONTEXT
1021 swi r1, r11, CC_R1
1022 swi r2, r11, CC_R2
1023 /* skip volatile registers.

--- 27 unchanged lines hidden (view full) ---

1051 swi r12, r11, CC_EAR
1052 mfs r12, resr
1053 nop
1054 swi r12, r11, CC_ESR
1055 mfs r12, rfsr
1056 nop
1057 swi r12, r11, CC_FSR
1058
1077 /* update r31, the current */
1078 lwi r31, r6, TI_TASK/* give me pointer to task which will be next */
1059 /* update r31, the current-give me pointer to task which will be next */
1060 lwi CURRENT_TASK, r6, TI_TASK
1079 /* stored it to current_save too */
1061 /* stored it to current_save too */
1080 swi r31, r0, PER_CPU(CURRENT_SAVE)
1062 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE)
1081
1082 /* get new process' cpu context and restore */
1083 /* give me start where start context of next task */
1084 addik r11, r6, TI_CPU_CONTEXT
1085
1086 /* non-volatile registers */
1087 lwi r30, r11, CC_R30
1088 lwi r29, r11, CC_R29

--- 66 unchanged lines hidden ---
1063
1064 /* get new process' cpu context and restore */
1065 /* give me start where start context of next task */
1066 addik r11, r6, TI_CPU_CONTEXT
1067
1068 /* non-volatile registers */
1069 lwi r30, r11, CC_R30
1070 lwi r29, r11, CC_R29

--- 66 unchanged lines hidden ---