/*1* Copyright 2004-2009 Analog Devices Inc.2*3* Licensed under the GPL-2 or later4*/56#include <linux/linkage.h>7#include <asm/thread_info.h>8#include <asm/errno.h>9#include <asm/blackfin.h>10#include <asm/asm-offsets.h>1112#include <asm/context.S>1314#ifdef CONFIG_EXCPT_IRQ_SYSC_L115.section .l1.text16#else17.text18#endif1920ENTRY(_ret_from_fork)21#ifdef CONFIG_IPIPE22/*23* Hw IRQs are off on entry, and we don't want the scheduling tail24* code to starve high priority domains from interrupts while it25* runs. Therefore we first stall the root stage to have the26* virtual interrupt state reflect IMASK.27*/28p0.l = ___ipipe_root_status;29p0.h = ___ipipe_root_status;30r4 = [p0];31bitset(r4, 0);32[p0] = r4;33/*34* Then we may enable hw IRQs, allowing preemption from high35* priority domains. schedule_tail() will do local_irq_enable()36* since Blackfin does not define __ARCH_WANT_UNLOCKED_CTXSW, so37* there is no need to unstall the root domain by ourselves38* afterwards.39*/40p0.l = _bfin_irq_flags;41p0.h = _bfin_irq_flags;42r4 = [p0];43sti r4;44#endif /* CONFIG_IPIPE */45SP += -12;46pseudo_long_call _schedule_tail, p5;47SP += 12;48r0 = [sp + PT_IPEND];49cc = bittst(r0,1);50if cc jump .Lin_kernel;51RESTORE_CONTEXT52rti;53.Lin_kernel:54bitclr(r0,1);55[sp + PT_IPEND] = r0;56/* do a 'fake' RTI by jumping to [RETI]57* to avoid clearing supervisor mode in child58*/59r0 = [sp + PT_PC];60[sp + PT_P0] = r0;6162RESTORE_ALL_SYS63jump (p0);64ENDPROC(_ret_from_fork)6566ENTRY(_sys_fork)67r0 = -EINVAL;68#if (ANOMALY_05000371)69nop;70nop;71nop;72#endif73rts;74ENDPROC(_sys_fork)7576ENTRY(_sys_vfork)77r0 = sp;78r0 += 24;79[--sp] = rets;80SP += -12;81pseudo_long_call _bfin_vfork, p2;82SP += 12;83rets = [sp++];84rts;85ENDPROC(_sys_vfork)8687ENTRY(_sys_clone)88r0 = sp;89r0 += 24;90[--sp] = rets;91SP += -12;92pseudo_long_call _bfin_clone, p2;93SP += 12;94rets = [sp++];95rts;96ENDPROC(_sys_clone)9798ENTRY(_sys_rt_sigreturn)99r0 = sp;100r0 += 24;101[--sp] = rets;102SP += -12;103pseudo_long_call _do_rt_sigreturn, p2;104SP += 12;105rets = [sp++];106rts;107ENDPROC(_sys_rt_sigreturn)108109110