Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight
[sfrench/cifs-2.6.git] / arch / blackfin / kernel / entry.S
1 /*
2  * File:         arch/blackfin/kernel/entry.S
3  * Based on:
4  * Author:
5  *
6  * Created:
7  * Description:
8  *
9  * Modified:
10  *               Copyright 2004-2006 Analog Devices Inc.
11  *
12  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, see the file COPYING, or write
26  * to the Free Software Foundation, Inc.,
27  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
28  */
29
30 #include <linux/linkage.h>
31 #include <asm/thread_info.h>
32 #include <asm/errno.h>
33 #include <asm/blackfin.h>
34 #include <asm/asm-offsets.h>
35
36 #include <asm/context.S>
37
38 #ifdef CONFIG_EXCPT_IRQ_SYSC_L1
39 .section .l1.text
40 #else
41 .text
42 #endif
43
44 ENTRY(_ret_from_fork)
45 #ifdef CONFIG_IPIPE
46         /*
47          * Hw IRQs are off on entry, and we don't want the scheduling tail
48          * code to starve high priority domains from interrupts while it
49          * runs. Therefore we first stall the root stage to have the
50          * virtual interrupt state reflect IMASK.
51          */
52         p0.l = ___ipipe_root_status;
53         p0.h = ___ipipe_root_status;
54         r4 = [p0];
55         bitset(r4, 0);
56         [p0] = r4;
57         /*
58          * Then we may enable hw IRQs, allowing preemption from high
59          * priority domains. schedule_tail() will do local_irq_enable()
60          * since Blackfin does not define __ARCH_WANT_UNLOCKED_CTXSW, so
61          * there is no need to unstall the root domain by ourselves
62          * afterwards.
63          */
64         p0.l = _bfin_irq_flags;
65         p0.h = _bfin_irq_flags;
66         r4 = [p0];
67         sti r4;
68 #endif /* CONFIG_IPIPE */
69         SP += -12;
70         call _schedule_tail;
71         SP += 12;
72         r0 = [sp + PT_IPEND];
73         cc = bittst(r0,1);
74         if cc jump .Lin_kernel;
75         RESTORE_CONTEXT
76         rti;
77 .Lin_kernel:
78         bitclr(r0,1);
79         [sp + PT_IPEND] = r0;
80         /* do a 'fake' RTI by jumping to [RETI]
81          * to avoid clearing supervisor mode in child
82          */
83         r0 = [sp + PT_PC];
84         [sp + PT_P0] = r0;
85
86         RESTORE_ALL_SYS
87         jump (p0);
88 ENDPROC(_ret_from_fork)
89
90 ENTRY(_sys_fork)
91         r0 = -EINVAL;
92 #if (ANOMALY_05000371)
93         nop;
94         nop;
95         nop;
96 #endif
97         rts;
98 ENDPROC(_sys_fork)
99
100 ENTRY(_sys_vfork)
101         r0 = sp;
102         r0 += 24;
103         [--sp] = rets;
104         SP += -12;
105         call _bfin_vfork;
106         SP += 12;
107         rets = [sp++];
108         rts;
109 ENDPROC(_sys_vfork)
110
111 ENTRY(_sys_clone)
112         r0 = sp;
113         r0 += 24;
114         [--sp] = rets;
115         SP += -12;
116         call _bfin_clone;
117         SP += 12;
118         rets = [sp++];
119         rts;
120 ENDPROC(_sys_clone)
121
122 ENTRY(_sys_rt_sigreturn)
123         r0 = sp;
124         r0 += 24;
125         [--sp] = rets;
126         SP += -12;
127         call _do_rt_sigreturn;
128         SP += 12;
129         rets = [sp++];
130         rts;
131 ENDPROC(_sys_rt_sigreturn)