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>
21 .macro preempt_stop reg=t0
24 .macro preempt_stop reg=t0
25 local_irq_disable \reg
27 #define resume_kernel restore_all
32 FEXPORT(ret_from_exception)
35 LONG_L t0, PT_STATUS(sp) # returning to kernel mode?
37 beqz t0, resume_kernel
39 FEXPORT(resume_userspace)
40 local_irq_disable t0 # make sure we dont miss an
41 # interrupt setting need_resched
42 # between sampling and return
43 LONG_L a2, TI_FLAGS($28) # current->work
44 andi a2, _TIF_WORK_MASK # (ignoring syscall_trace)
50 lw t0, TI_PRE_COUNT($28)
53 LONG_L t0, TI_FLAGS($28)
54 andi t1, t0, _TIF_NEED_RESCHED
56 if (in_exception_path)
59 sw t0, TI_PRE_COUNT($28)
66 FEXPORT(ret_from_fork)
70 local_irq_disable # make sure need_resched and
71 # signals dont change between
73 LONG_L a2, TI_FLAGS($28) # current->work
74 li t0, _TIF_ALLWORK_MASK
76 bnez t0, syscall_exit_work
84 andi t0, a2, _TIF_NEED_RESCHED
85 bnez t0, work_notifysig
89 local_irq_disable t0 # make sure need_resched and
90 # signals dont change between
92 LONG_L a2, TI_FLAGS($28)
93 andi t0, a2, _TIF_WORK_MASK # is there any work to be done
94 # other than syscall tracing?
96 andi t0, a2, _TIF_NEED_RESCHED
99 work_notifysig: # deal with pending signals and
100 # notify-resume requests
103 jal do_notify_resume # a2 already loaded
106 FEXPORT(syscall_exit_work)
107 LONG_L t0, TI_FLAGS($28)
108 li t1, _TIF_SYSCALL_TRACE
110 bgez t0, work_pending # trace bit is set
111 local_irq_enable # could let do_syscall_trace()
112 # call schedule() instead
117 * Common spurious interrupt handler.
121 LEAF(spurious_interrupt)
123 * Someone tried to fool us by sending an interrupt but we
124 * couldn't find a cause for it.
127 lui t1, %hi(irq_err_count)
128 1: ll t0, %lo(irq_err_count)(t1)
130 sc t0, %lo(irq_err_count)(t1)
133 lui t1, %hi(irq_err_count)
134 lw t0, %lo(irq_err_count)(t1)
136 sw t0, %lo(irq_err_count)(t1)
139 END(spurious_interrupt)