blob: f33792cc1a0d8a9b9cd553d379726886f5c3c22e [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * Copyright 2004-2009 Analog Devices Inc.
Bryan Wu1394f032007-05-06 14:50:22 -07003 *
Robin Getz96f10502009-09-24 14:11:24 +00004 * Licensed under the GPL-2 or later
Bryan Wu1394f032007-05-06 14:50:22 -07005 */
6
7#include <linux/linkage.h>
8#include <asm/thread_info.h>
9#include <asm/errno.h>
Graf Yang8f658732008-11-18 17:48:22 +080010#include <asm/blackfin.h>
Bryan Wu1394f032007-05-06 14:50:22 -070011#include <asm/asm-offsets.h>
12
Bryan Wu639f6572008-08-27 10:51:02 +080013#include <asm/context.S>
Bryan Wu1394f032007-05-06 14:50:22 -070014
15#ifdef CONFIG_EXCPT_IRQ_SYSC_L1
16.section .l1.text
17#else
18.text
19#endif
20
21ENTRY(_ret_from_fork)
Yi Li6a01f232009-01-07 23:14:39 +080022#ifdef CONFIG_IPIPE
Philippe Gerum6b8019c82009-06-22 18:23:32 +020023 /*
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;
Yi Li6a01f232009-01-07 23:14:39 +080045#endif /* CONFIG_IPIPE */
Bryan Wu1394f032007-05-06 14:50:22 -070046 SP += -12;
Barry Songd86bfb12010-01-07 04:11:17 +000047 pseudo_long_call _schedule_tail, p5;
Bryan Wu1394f032007-05-06 14:50:22 -070048 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
Robin Getzaa770aa2007-10-29 18:14:15 +080059 */
60 r0 = [sp + PT_PC];
61 [sp + PT_P0] = r0;
62
Bryan Wu1394f032007-05-06 14:50:22 -070063 RESTORE_ALL_SYS
Bryan Wu1394f032007-05-06 14:50:22 -070064 jump (p0);
Mike Frysinger51be24c2007-06-11 15:31:30 +080065ENDPROC(_ret_from_fork)
Bryan Wu1394f032007-05-06 14:50:22 -070066
Bryan Wu1394f032007-05-06 14:50:22 -070067ENTRY(_sys_vfork)
68 r0 = sp;
69 r0 += 24;
70 [--sp] = rets;
71 SP += -12;
Barry Songd86bfb12010-01-07 04:11:17 +000072 pseudo_long_call _bfin_vfork, p2;
Bryan Wu1394f032007-05-06 14:50:22 -070073 SP += 12;
74 rets = [sp++];
75 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +080076ENDPROC(_sys_vfork)
Bryan Wu1394f032007-05-06 14:50:22 -070077
78ENTRY(_sys_clone)
79 r0 = sp;
80 r0 += 24;
81 [--sp] = rets;
82 SP += -12;
Barry Songd86bfb12010-01-07 04:11:17 +000083 pseudo_long_call _bfin_clone, p2;
Bryan Wu1394f032007-05-06 14:50:22 -070084 SP += 12;
85 rets = [sp++];
86 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +080087ENDPROC(_sys_clone)
Bryan Wu1394f032007-05-06 14:50:22 -070088
89ENTRY(_sys_rt_sigreturn)
90 r0 = sp;
91 r0 += 24;
92 [--sp] = rets;
93 SP += -12;
Barry Songd86bfb12010-01-07 04:11:17 +000094 pseudo_long_call _do_rt_sigreturn, p2;
Bryan Wu1394f032007-05-06 14:50:22 -070095 SP += 12;
96 rets = [sp++];
97 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +080098ENDPROC(_sys_rt_sigreturn)