Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 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> |
Graf Yang | 8f65873 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 33 | #include <asm/blackfin.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 34 | #include <asm/asm-offsets.h> |
| 35 | |
Bryan Wu | 639f657 | 2008-08-27 10:51:02 +0800 | [diff] [blame] | 36 | #include <asm/context.S> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 37 | |
| 38 | #ifdef CONFIG_EXCPT_IRQ_SYSC_L1 |
| 39 | .section .l1.text |
| 40 | #else |
| 41 | .text |
| 42 | #endif |
| 43 | |
| 44 | ENTRY(_ret_from_fork) |
Yi Li | 6a01f23 | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 45 | #ifdef CONFIG_IPIPE |
| 46 | [--sp] = reti; /* IRQs on. */ |
| 47 | SP += 4; |
| 48 | #endif /* CONFIG_IPIPE */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 49 | SP += -12; |
| 50 | call _schedule_tail; |
| 51 | SP += 12; |
| 52 | r0 = [sp + PT_IPEND]; |
| 53 | cc = bittst(r0,1); |
| 54 | if cc jump .Lin_kernel; |
| 55 | RESTORE_CONTEXT |
| 56 | rti; |
| 57 | .Lin_kernel: |
| 58 | bitclr(r0,1); |
| 59 | [sp + PT_IPEND] = r0; |
| 60 | /* do a 'fake' RTI by jumping to [RETI] |
| 61 | * to avoid clearing supervisor mode in child |
Robin Getz | aa770aa | 2007-10-29 18:14:15 +0800 | [diff] [blame] | 62 | */ |
| 63 | r0 = [sp + PT_PC]; |
| 64 | [sp + PT_P0] = r0; |
| 65 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 66 | RESTORE_ALL_SYS |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 67 | jump (p0); |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 68 | ENDPROC(_ret_from_fork) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 69 | |
| 70 | ENTRY(_sys_fork) |
| 71 | r0 = -EINVAL; |
Michael Hennerich | 2cfebf2 | 2008-07-16 16:59:05 +0800 | [diff] [blame] | 72 | #if (ANOMALY_05000371) |
| 73 | nop; |
| 74 | nop; |
| 75 | nop; |
| 76 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 77 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 78 | ENDPROC(_sys_fork) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 79 | |
| 80 | ENTRY(_sys_vfork) |
| 81 | r0 = sp; |
| 82 | r0 += 24; |
| 83 | [--sp] = rets; |
| 84 | SP += -12; |
| 85 | call _bfin_vfork; |
| 86 | SP += 12; |
| 87 | rets = [sp++]; |
| 88 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 89 | ENDPROC(_sys_vfork) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 90 | |
| 91 | ENTRY(_sys_clone) |
| 92 | r0 = sp; |
| 93 | r0 += 24; |
| 94 | [--sp] = rets; |
| 95 | SP += -12; |
| 96 | call _bfin_clone; |
| 97 | SP += 12; |
| 98 | rets = [sp++]; |
| 99 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 100 | ENDPROC(_sys_clone) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 101 | |
| 102 | ENTRY(_sys_rt_sigreturn) |
| 103 | r0 = sp; |
| 104 | r0 += 24; |
| 105 | [--sp] = rets; |
| 106 | SP += -12; |
| 107 | call _do_rt_sigreturn; |
| 108 | SP += 12; |
| 109 | rets = [sp++]; |
| 110 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 111 | ENDPROC(_sys_rt_sigreturn) |