Commit | Line | Data |
---|---|---|
1394f032 | 1 | /* |
96f1050d | 2 | * Copyright 2004-2009 Analog Devices Inc. |
1394f032 | 3 | * |
96f1050d | 4 | * Licensed under the GPL-2 or later |
1394f032 BW |
5 | */ |
6 | ||
7 | #include <linux/linkage.h> | |
8 | #include <asm/thread_info.h> | |
9 | #include <asm/errno.h> | |
8f65873e | 10 | #include <asm/blackfin.h> |
1394f032 BW |
11 | #include <asm/asm-offsets.h> |
12 | ||
639f6571 | 13 | #include <asm/context.S> |
1394f032 BW |
14 | |
15 | #ifdef CONFIG_EXCPT_IRQ_SYSC_L1 | |
16 | .section .l1.text | |
17 | #else | |
18 | .text | |
19 | #endif | |
20 | ||
21 | ENTRY(_ret_from_fork) | |
6a01f230 | 22 | #ifdef CONFIG_IPIPE |
6b8019c8 PG |
23 | /* |
24 | * Hw IRQs are off on entry, and we don't want the scheduling tail | |
25 | * code to starve high priority domains from interrupts while it | |
26 | * runs. Therefore we first stall the root stage to have the | |
27 | * virtual interrupt state reflect IMASK. | |
28 | */ | |
29 | p0.l = ___ipipe_root_status; | |
30 | p0.h = ___ipipe_root_status; | |
31 | r4 = [p0]; | |
32 | bitset(r4, 0); | |
33 | [p0] = r4; | |
34 | /* | |
35 | * Then we may enable hw IRQs, allowing preemption from high | |
36 | * priority domains. schedule_tail() will do local_irq_enable() | |
37 | * since Blackfin does not define __ARCH_WANT_UNLOCKED_CTXSW, so | |
38 | * there is no need to unstall the root domain by ourselves | |
39 | * afterwards. | |
40 | */ | |
41 | p0.l = _bfin_irq_flags; | |
42 | p0.h = _bfin_irq_flags; | |
43 | r4 = [p0]; | |
44 | sti r4; | |
6a01f230 | 45 | #endif /* CONFIG_IPIPE */ |
1394f032 | 46 | SP += -12; |
d86bfb16 | 47 | pseudo_long_call _schedule_tail, p5; |
1394f032 BW |
48 | SP += 12; |
49 | r0 = [sp + PT_IPEND]; | |
50 | cc = bittst(r0,1); | |
51 | if cc jump .Lin_kernel; | |
52 | RESTORE_CONTEXT | |
53 | rti; | |
54 | .Lin_kernel: | |
55 | bitclr(r0,1); | |
56 | [sp + PT_IPEND] = r0; | |
57 | /* do a 'fake' RTI by jumping to [RETI] | |
58 | * to avoid clearing supervisor mode in child | |
aa770aa7 RG |
59 | */ |
60 | r0 = [sp + PT_PC]; | |
61 | [sp + PT_P0] = r0; | |
62 | ||
1394f032 | 63 | RESTORE_ALL_SYS |
1394f032 | 64 | jump (p0); |
51be24c3 | 65 | ENDPROC(_ret_from_fork) |
1394f032 | 66 | |
1394f032 BW |
67 | ENTRY(_sys_vfork) |
68 | r0 = sp; | |
69 | r0 += 24; | |
70 | [--sp] = rets; | |
71 | SP += -12; | |
d86bfb16 | 72 | pseudo_long_call _bfin_vfork, p2; |
1394f032 BW |
73 | SP += 12; |
74 | rets = [sp++]; | |
75 | rts; | |
51be24c3 | 76 | ENDPROC(_sys_vfork) |
1394f032 BW |
77 | |
78 | ENTRY(_sys_clone) | |
79 | r0 = sp; | |
80 | r0 += 24; | |
81 | [--sp] = rets; | |
82 | SP += -12; | |
d86bfb16 | 83 | pseudo_long_call _bfin_clone, p2; |
1394f032 BW |
84 | SP += 12; |
85 | rets = [sp++]; | |
86 | rts; | |
51be24c3 | 87 | ENDPROC(_sys_clone) |
1394f032 BW |
88 | |
89 | ENTRY(_sys_rt_sigreturn) | |
90 | r0 = sp; | |
91 | r0 += 24; | |
92 | [--sp] = rets; | |
93 | SP += -12; | |
d86bfb16 | 94 | pseudo_long_call _do_rt_sigreturn, p2; |
1394f032 BW |
95 | SP += 12; |
96 | rets = [sp++]; | |
97 | rts; | |
51be24c3 | 98 | ENDPROC(_sys_rt_sigreturn) |