Add a set_rtc_mmss() handler for faster timekeeping.
[linux-2.6/linux-mips.git] / arch / mips64 / kernel / entry.S
bloba81f60e134b5b67a5b4240bad35d615c7547a91d
1 /*
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
4  * for more details.
5  *
6  * Copyright (C) 1994 - 2000, 2001, 2003 Ralf Baechle
7  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8  * Copyright (C) 2001 MIPS Technologies, Inc.
9  */
10 #include <linux/config.h>
12 #include <asm/asm.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>
20 #ifdef CONFIG_PREEMPT
21         .macro  preempt_stop reg=t0
22         .endm
23 #else
24         .macro  preempt_stop reg=t0
25         local_irq_disable \reg
26         .endm
27 #define resume_kernel   restore_all
28 #endif
30         .text
31         .align  5
32 FEXPORT(ret_from_exception)
33         preempt_stop
34 FEXPORT(ret_from_irq)
35         LONG_L  t0, PT_STATUS(sp)               # returning to kernel mode?
36         andi    t0, t0, KU_USER
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)
45         bnez    a2, work_pending
46         j       restore_all
48 #ifdef CONFIG_PREEMPT
49 ENTRY(resume_kernel)
50         lw      t0, TI_PRE_COUNT($28)
51         bnez    t0, restore_all
52 need_resched:
53         LONG_L  t0, TI_FLAGS($28)
54         andi    t1, t0, _TIF_NEED_RESCHED
55         beqz    restore_all
56         if (in_exception_path)
57                 goto restore_all;
58         li      t0, PREEMPT_ACTIVE
59         sw      t0, TI_PRE_COUNT($28)
60         local_irq_enable t0
61         jal     schedule
62         local_irq_disable t0
63         b       need_resched
64 #endif
66 FEXPORT(ret_from_fork)
67         jal     schedule_tail
69 FEXPORT(syscall_exit)
70         local_irq_disable               # make sure need_resched and
71                                         # signals dont change between
72                                         # sampling and return
73         LONG_L  a2, TI_FLAGS($28)       # current->work
74         li      t0, _TIF_ALLWORK_MASK
75         and     t0, a2, t0
76         bnez    t0, syscall_exit_work
78 FEXPORT(restore_all)
79         .set    noat
80         RESTORE_ALL_AND_RET
81         .set    at
83 FEXPORT(work_pending)
84         andi    t0, a2, _TIF_NEED_RESCHED
85         bnez    t0, work_notifysig
86 work_resched:
87         jal     schedule
89         local_irq_disable t0            # make sure need_resched and
90                                         # signals dont change between
91                                         # sampling and return
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?
95         beqz    t0, restore_all
96         andi    t0, a2, _TIF_NEED_RESCHED
97         bnez    t0, work_resched
99 work_notifysig:                         # deal with pending signals and
100                                         # notify-resume requests
101         move    a0, sp
102         li      a1, 0
103         jal     do_notify_resume        # a2 already loaded
104         j       restore_all
106 FEXPORT(syscall_exit_work)
107         LONG_L  t0, TI_FLAGS($28)
108         li      t1, _TIF_SYSCALL_TRACE
109         and     t0, t1
110         bgez    t0, work_pending        # trace bit is set
111         local_irq_enable                # could let do_syscall_trace()
112                                         # call schedule() instead
113         jal     do_syscall_trace
114         b       resume_userspace
117  * Common spurious interrupt handler.
118  */
119         .text
120         .align  5
121 LEAF(spurious_interrupt)
122         /*
123          * Someone tried to fool us by sending an interrupt but we
124          * couldn't find a cause for it.
125          */
126 #ifdef CONFIG_SMP
127         lui     t1, %hi(irq_err_count)
128 1:      ll      t0, %lo(irq_err_count)(t1)
129         addiu   t0, 1
130         sc      t0, %lo(irq_err_count)(t1)
131         beqz    t0, 1b
132 #else
133         lui     t1, %hi(irq_err_count)
134         lw      t0, %lo(irq_err_count)(t1)
135         addiu   t0, 1
136         sw      t0, %lo(irq_err_count)(t1)
137 #endif
138         j       ret_from_irq
139         END(spurious_interrupt)