Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 2 | * Copyright 2004-2009 Analog Devices Inc. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 3 | * |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 4 | * Licensed under the GPL-2 or later |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <linux/linkage.h> |
| 8 | #include <asm/thread_info.h> |
| 9 | #include <asm/errno.h> |
Graf Yang | 8f65873 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 10 | #include <asm/blackfin.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 11 | #include <asm/asm-offsets.h> |
| 12 | |
Bryan Wu | 639f657 | 2008-08-27 10:51:02 +0800 | [diff] [blame] | 13 | #include <asm/context.S> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 14 | |
| 15 | #ifdef CONFIG_EXCPT_IRQ_SYSC_L1 |
| 16 | .section .l1.text |
| 17 | #else |
| 18 | .text |
| 19 | #endif |
| 20 | |
| 21 | ENTRY(_ret_from_fork) |
Yi Li | 6a01f23 | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 22 | #ifdef CONFIG_IPIPE |
Philippe Gerum | 6b8019c8 | 2009-06-22 18:23:32 +0200 | [diff] [blame] | 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; |
Yi Li | 6a01f23 | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 45 | #endif /* CONFIG_IPIPE */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 46 | SP += -12; |
Barry Song | d86bfb1 | 2010-01-07 04:11:17 +0000 | [diff] [blame] | 47 | pseudo_long_call _schedule_tail, p5; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 48 | SP += 12; |
Al Viro | ee1e17c | 2012-10-13 03:22:53 -0400 | [diff] [blame] | 49 | p1 = [sp++]; |
| 50 | r0 = [sp++]; |
| 51 | cc = p1 == 0; |
| 52 | if cc jump .Lfork; |
| 53 | sp += -12; |
| 54 | call (p1); |
| 55 | sp += 12; |
| 56 | .Lfork: |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 57 | RESTORE_CONTEXT |
| 58 | rti; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 59 | ENDPROC(_ret_from_fork) |