2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1994 - 2000, 2001, 2003 Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
10 #include <linux/config.h>
13 #include <asm/asmmacro.h>
14 #include <asm/regdef.h>
15 #include <asm/mipsregs.h>
16 #include <asm/stackframe.h>
17 #include <asm/isadep.h>
18 #include <asm/thread_info.h>
22 .macro preempt_stop reg=t0
25 .macro preempt_stop reg=t0
26 local_irq_disable \reg
28 #define resume_kernel restore_all
33 FEXPORT(ret_from_exception)
36 LONG_L t0, PT_STATUS(sp) # returning to kernel mode?
38 beqz t0, resume_kernel
40 FEXPORT(resume_userspace)
41 local_irq_disable t0 # make sure we dont miss an
42 # interrupt setting need_resched
43 # between sampling and return
44 LONG_L a2, TI_FLAGS($28) # current->work
45 andi a2, _TIF_WORK_MASK # (ignoring syscall_trace)
51 lw t0, TI_PRE_COUNT($28)
54 LONG_L t0, TI_FLAGS($28)
55 andi t1, t0, _TIF_NEED_RESCHED
57 LONG_L t0, PT_STATUS(sp) # Interrupts off?
61 sw t0, TI_PRE_COUNT($28)
64 sw zero, TI_PRE_COUNT($28)
69 FEXPORT(ret_from_fork)
70 jal schedule_tail # a0 = task_t *prev
73 local_irq_disable # make sure need_resched and
74 # signals dont change between
76 LONG_L a2, TI_FLAGS($28) # current->work
77 li t0, _TIF_ALLWORK_MASK
79 bnez t0, syscall_exit_work
81 FEXPORT(restore_all) # restore full frame
86 FEXPORT(restore_partial) # restore partial frame
92 andi t0, a2, _TIF_NEED_RESCHED
93 beqz t0, work_notifysig
97 local_irq_disable t0 # make sure need_resched and
98 # signals dont change between
100 LONG_L a2, TI_FLAGS($28)
101 andi t0, a2, _TIF_WORK_MASK # is there any work to be done
102 # other than syscall tracing?
104 andi t0, a2, _TIF_NEED_RESCHED
105 bnez t0, work_resched
107 work_notifysig: # deal with pending signals and
108 # notify-resume requests
111 jal do_notify_resume # a2 already loaded
114 FEXPORT(syscall_exit_work_partial)
116 FEXPORT(syscall_exit_work)
117 LONG_L t0, TI_FLAGS($28)
118 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
120 beqz t0, work_pending # trace bit is set
121 local_irq_enable # could let do_syscall_trace()
122 # call schedule() instead
129 * Common spurious interrupt handler.
133 LEAF(spurious_interrupt)
135 * Someone tried to fool us by sending an interrupt but we
136 * couldn't find a cause for it.
139 lui t1, %hi(irq_err_count)
140 1: ll t0, %lo(irq_err_count)(t1)
142 sc t0, %lo(irq_err_count)(t1)
149 lui t1, %hi(irq_err_count)
150 lw t0, %lo(irq_err_count)(t1)
152 sw t0, %lo(irq_err_count)(t1)
155 END(spurious_interrupt)