bfin: remove inline keyword
[xenomai-head.git] / include / asm-nios2 / bits / shadow.h
blob8754eace024d4dadfbf4d5c9ff5b531406ff8418
1 /*
2 * Copyright (C) 2009 Philippe Gerum <rpm@xenomai.org>.
4 * Xenomai is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * Xenomai is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Xenomai; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17 * 02111-1307, USA.
20 #ifndef _XENO_ASM_NIOS2_BITS_SHADOW_H
21 #define _XENO_ASM_NIOS2_BITS_SHADOW_H
23 #ifndef __KERNEL__
24 #error "Pure kernel header included from user-space!"
25 #endif
27 #include <asm/cacheflush.h>
29 static inline void xnarch_init_shadow_tcb(xnarchtcb_t * tcb,
30 struct xnthread *thread,
31 const char *name)
33 struct task_struct *task = current;
35 tcb->user_task = task;
36 tcb->active_task = NULL;
37 tcb->tsp = &task->thread;
38 tcb->mm = task->mm;
39 tcb->active_mm = NULL;
40 #ifdef CONFIG_XENO_HW_UNLOCKED_SWITCH
41 tcb->tip = task_thread_info(task);
42 #endif
43 tcb->entry = NULL;
44 tcb->cookie = NULL;
45 tcb->self = thread;
46 tcb->imask = 0;
47 tcb->name = name;
50 static inline int xnarch_local_syscall(struct pt_regs *regs)
52 unsigned long ptr, x, r;
54 switch (__xn_reg_arg1(regs)) {
55 case __xn_lsys_xchg:
57 /* lsys_xchg(ptr,newval,&oldval) */
58 ptr = __xn_reg_arg2(regs);
59 x = __xn_reg_arg3(regs);
60 r = xchg((unsigned long *)ptr, x);
61 __xn_put_user(r, (unsigned long *)__xn_reg_arg4(regs));
62 break;
64 default:
66 return -ENOSYS;
69 return 0;
72 #define xnarch_schedule_tail(prev) do { } while(0)
74 #ifdef XNARCH_HAVE_MAYDAY
76 static inline void xnarch_setup_mayday_page(void *page)
79 * We want this code to appear at the top of the MAYDAY page:
81 * 00c00334 movhi r3,#__xn_sys_mayday
82 * 18c08ac4 addi r3,r3,#__xn_sys_mux
83 * 00800004 movi r2,0
84 * 003b683a trap
85 * 003fff06 br .
87 static const struct {
88 u32 movhi_r3h;
89 u32 addi_r3l;
90 u32 movi_r2;
91 u32 syscall;
92 u32 bug;
93 } code = {
94 .movhi_r3h = 0x00c00334,
95 .addi_r3l = 0x18c08ac4,
96 .movi_r2 = 0x00800004,
97 .syscall = 0x003b683a,
98 .bug = 0x003fff06
101 memcpy(page, &code, sizeof(code));
103 flush_dcache_range((unsigned long)page,
104 (unsigned long)page + sizeof(code));
107 static inline void xnarch_call_mayday(struct task_struct *p)
109 rthal_return_intercept(p);
112 static inline void xnarch_handle_mayday(struct xnarchtcb *tcb,
113 struct pt_regs *regs,
114 unsigned long tramp)
116 tcb->mayday.ea = regs->ea;
117 tcb->mayday.r2 = regs->r2;
118 tcb->mayday.r3 = regs->r3;
119 regs->ea = tramp;
122 static inline void xnarch_fixup_mayday(struct xnarchtcb *tcb,
123 struct pt_regs *regs)
125 regs->ea = tcb->mayday.ea;
126 regs->r2 = tcb->mayday.r2;
127 regs->r3 = tcb->mayday.r3;
130 #endif /* XNARCH_HAVE_MAYDAY */
132 #endif /* !_XENO_ASM_NIOS2_BITS_SHADOW_H */